fancywidgets.pyQtBased package

Submodules

fancywidgets.pyQtBased.ArgSetter module

class fancywidgets.pyQtBased.ArgSetter.ArgSetter(title, argdict, stayOpen=False, saveLoadButton=False, savePath='config.txt', loadPath='config.txt', introduction=None, unpackDict=False)[source]

Bases: PyQt4.QtGui.QDialog

Create an window to setup attributes graphically

useful as quick configurator for other functions/classes that need keyword arguments that must be passed graphically e.g. for py2exe/pyinstaller apps

check()[source]

check whether all attributes are setted and have the right dtype

closeEvent(evt)[source]
done(result)[source]

save the geometry before dialog is close to restore it later

run(processClass)[source]
show()[source]

if the dialog is showed again or is not started with exec_ naming the done button to ‘update’ make more sense because now the dialog doesn’t block (anymore)

stayOpen()[source]

optional dialog restore

validators = {<type 'int'>: <class 'PyQt4.QtGui.QIntValidator'>, <type 'float'>: <class 'PyQt4.QtGui.QDoubleValidator'>}

fancywidgets.pyQtBased.CircleWidget module

class fancywidgets.pyQtBased.CircleWidget.CircleWidget(parent=None, circle_size=6, pen_size=2, circle_color=7, pen_color=13, antialiased=True)[source]

Bases: PyQt4.QtGui.QWidget

a simple circle - useful as indicator

paintEvent(event)[source]

fancywidgets.pyQtBased.CodeEditor module

class fancywidgets.pyQtBased.CodeEditor.CodeEditor(dialog=None)[source]

Bases: PyQt4.QtGui.QWidget

A simple code editor with a QPlainTextEdit and line numbers of the left side

addGlobals(g)[source]

g ==> {name:description,...}

fancywidgets.pyQtBased.Console module

class fancywidgets.pyQtBased.Console.Console(outputSignal=None, errorSignal=None, *args, **kwargs)[source]

Bases: PyQt4.QtGui.QTextEdit

A simple qWidget with one read-only QTextEdit with a limited number of lines to display output generated with messages which print() in black and raise() in red color

MAXLINES = 300
addText(text)[source]

append text in the chosen color

addTextErr(text)[source]

add red text

addTextOut(text)[source]

add black text

contextMenuEvent(event)[source]

Add menu action: * ‘Show line numbers’ * ‘Save to file’

setActive()[source]
setInactive()[source]

fancywidgets.pyQtBased.Dialogs module

class fancywidgets.pyQtBased.Dialogs.Dialogs(dirname=None)[source]

Bases: object

  • saves the last path to save and open a file/directory
getExistingDirectory(**kwargs)[source]
getOpenFileName(**kwargs)[source]
getOpenFileNames(**kwargs)[source]
getSaveFileName(*args, **kwargs)[source]

analog to QtGui.QFileDialog.getSaveFileNameAndFilter but returns the filename + chosen file ending even if not typed in gui

restoreState(state)[source]

restore options from file ‘dialogs.conf’

saveState()[source]

save options to file ‘dialogs.conf’

fancywidgets.pyQtBased.FingerTabWidget module

A vertical tab widget - code origin from: https://gist.github.com/LegoStormtroopr/5075267

class fancywidgets.pyQtBased.FingerTabWidget.AutoResizeFingerTabWidget(parent=None, *args, **kwargs)[source]

Bases: fancywidgets.pyQtBased.FingerTabWidget.FingerTabWidget

forceResize(evt)[source]
class fancywidgets.pyQtBased.FingerTabWidget.FingerTabBarWidget(parent=None, *args, **kwargs)[source]

Bases: PyQt4.QtGui.QTabBar

paintEvent(event)[source]
tabSizeHint(index)[source]
class fancywidgets.pyQtBased.FingerTabWidget.FingerTabWidget(parent=None, *args, **kwargs)[source]

Bases: PyQt4.QtGui.QTabWidget

A QTabWidget equivalent which uses our FingerTabBarWidget

fancywidgets.pyQtBased.FwMinimalTextEditor module

class fancywidgets.pyQtBased.FwMinimalTextEditor.FwMinimalTextEditor(parent=None)[source]

Bases: fancywidgets.pyQtBased._textEditorUtils.MainWindow

fancywidgets.pyQtBased.FwTabWidget module

class fancywidgets.pyQtBased.FwTabWidget.FwTabWidget(defaultTabWidget=<class 'PyQt4.QtGui.QWidget'>)[source]

Bases: PyQt4.QtGui.QTabWidget

  • allow to iterate over all tabs using for tab in TabWidget...

  • allow to give tabs (and not indexes) to:
    • removeTab
    • tabText

also: interactive... * adding of new tabs, * tab removal * tab renaming

addEmptyTab(text='')[source]

Add a new DEFAULT_TAB_WIDGET, open editor to set text if no text is given

next()[source]
removeTab(tab)[source]

allows to remove a tab directly -not only by giving its index

setTabsAddable(addable)[source]
setTabsRenamable(renamable)[source]
sigTabAdded
tabText(tab)[source]

allow index or tab widget instance

widgetByName(name)[source]

fancywidgets.pyQtBased.FwTextEditor module

class fancywidgets.pyQtBased.FwTextEditor.FwTextEditor(parent=None)[source]

Bases: fancywidgets.pyQtBased._textEditorUtils.MainWindow

fancywidgets.pyQtBased.MenuBar module

class fancywidgets.pyQtBased.MenuBar.MenuBar[source]

Bases: PyQt4.QtGui.QMenuBar

QMenuBar with easier insertMenu methods methods are used from: http://scribus.info/svn/Scribus/trunk/Scribus/scribus/plugins/scripter/python/scripter_hooks.py

actionForMenu(menu)[source]
findMenu(title)[source]

find a menu with a given title

@type title: string @param title: English title of the menu @rtype: QMenu @return: None if no menu was found, else the menu with title

insertMenuBefore(before_menu, new_menu)[source]

Insert a menu after another menu in the menubar

@type: before_menu QMenu instance or title string of menu @param before_menu: menu which should be after the newly inserted menu @rtype: QAction instance @return: action for inserted menu

iter_inner_menus(menu)[source]
iter_menus()[source]

fancywidgets.pyQtBased.Table module

class fancywidgets.pyQtBased.Table.Table(rows=3, cols=3, colFiled=False, rowFixed=False, parent=None)[source]

Bases: PyQt4.QtGui.QTableWidget

A QTableWidget with: * Shortcuts: copy, paste, cut, insert/delete row/column * Context Menu * Cell range operations (copy, paste on multiple cells) * Save/open * import from clipboard * dynamic add of new rows and cells when needed

cleanTable()[source]
copy()[source]
cut()[source]
delete()[source]
static fromText(text)[source]
importTable(table, startRow=None, startCol=None)[source]
insertBlankCells()[source]
keyPressEvent(event)[source]
mousePressEvent(event)[source]
open(path)[source]
paste()[source]
removeBlankCells()[source]
restore(path)[source]
save()[source]

save to file - override last saved file

saveAs(path)[source]

save to file under given name

setColumnsFixed(value)[source]
setItemText(row, col, text)[source]
sigPathChanged
table()[source]

fancywidgets.pyQtBased.highlighter module

class fancywidgets.pyQtBased.highlighter.Highlighter(parent, mode)[source]

Bases: PyQt4.QtGui.QSyntaxHighlighter

highlightBlock(text)[source]

Takes a block, applies format to the document. according to what’s in it.

class fancywidgets.pyQtBased.highlighter.QFormatter[source]

Bases: pygments.formatter.Formatter

format(tokensource, outfile)[source]
fancywidgets.pyQtBased.highlighter.hex2QColor(c)[source]