Package pytsonui
[hide private]
[frames] | no frames]

Package pytsonui

source code

Submodules [hide private]

Classes [hide private]
  UiLoader
QUILoader subclass to omit the parent widget from being recreated.
Functions [hide private]
 
ts3print(msg, level, channel, aid) source code
 
setIcon(obj, iconpack, pluginicons=None)
Sets the icon of a QWidget (if it has a property Icon) to an icon in the iconpack represented by a variable which is acquired by the property 'pytsonicon' of the object.
source code
 
connectSignalSlotsByName(sender, receiver)
Connects pythonqt signals by name (receiver.on_<sender.objectname>_<signalname>)
source code
 
retrieveWidgets(obj, parent, widgets, seticons=True, iconpack=None, pluginicons=None)
Retrieves widgets from a list and adds them as attribute to another object.
source code
 
retrieveAllWidgets(obj, parent, seticons=True, iconpack=None, pluginicons=None)
Retrieves all child widgets from a parent widget and adds them as attribute to another object.
source code
 
setupUi(obj, uipath, widgets=None, seticons=True, iconpack=None, pluginicons=None, extraWidgets=None)
Loads a Qt designer file (.ui), creates the widgets defined in and adds them as property to a given object.
source code
Function Details [hide private]

setIcon(obj, iconpack, pluginicons=None)

source code 

Sets the icon of a QWidget (if it has a property Icon) to an icon in the iconpack represented by a variable which is acquired by the property 'pytsonicon' of the object. If the property instead contains a string formated as "octicons:filename.png", the icon is set to filename.png of the octicons pack. If no such property is available, nothing is done.

Parameters:
  • obj (QWidget) - the widget
  • iconpack (ts3client.IconPack) - the iconpack
  • pluginicons (Callable(str) -> str or QIcon) - callable which gets a string and either returns the path to the image file or returns a QPixmap to set the icon property to; defaults to None

connectSignalSlotsByName(sender, receiver)

source code 

Connects pythonqt signals by name (receiver.on_<sender.objectname>_<signalname>)

Parameters:
  • sender (QObject) - the sender of signals
  • receiver (object) - the receiver which has slots as callables defined

retrieveWidgets(obj, parent, widgets, seticons=True, iconpack=None, pluginicons=None)

source code 

Retrieves widgets from a list and adds them as attribute to another object. If defined, signals from widgets are connected by name to methods in obj.

Parameters:
  • obj (object) - the object which will get the attributes added
  • parent (QWidget) - the toplevel widget
  • widgets (list[tuple(str, bool, list(...))]) - a recursive (parent-relation of widgets) list of tuples, defining which widgets should be added as attributes to obj. The elements must be children of parent. First element of tuple must held the widget's objectname. If second element is True, the widget will be added as property (by objectname) to obj. Third element of the tuple are the child widgets, which should be handled by setupui
  • seticons (bool) - if True, icons will be set according to the widgets 'pytsonicon' attribute
  • iconpack (ts3client.IconPack) - the iconpack
  • pluginicons (Callable(str) -> str or QIcon) - callable which gets a string and either returns the path to the image file or returns a QPixmap to set the icon property to; defaults to None

retrieveAllWidgets(obj, parent, seticons=True, iconpack=None, pluginicons=None)

source code 

Retrieves all child widgets from a parent widget and adds them as attribute to another object. If defined, signals from widgets are connected by name to methods in obj.

Parameters:
  • obj (object) - the object which will get the attributes added
  • parent (QWidget) - the toplevel widget
  • seticons (bool) - if True, icons will be set according to the widgets 'pytsonicon' attribute
  • iconpack (ts3client.IconPack) - the iconpack
  • pluginicons (Callable(str) -> str or QIcon) - callable which gets a string and either returns the path to the image file or returns a QPixmap to set the icon property to; defaults to None

setupUi(obj, uipath, widgets=None, seticons=True, iconpack=None, pluginicons=None, extraWidgets=None)

source code 

Loads a Qt designer file (.ui), creates the widgets defined in and adds them as property to a given object. This internally calls retrieveWidgets, so signals from widgets are connected by name to obj.

Parameters:
  • obj (QWidget) - The object which will act as parent of the loaded ui (this object will receive a new layout)
  • uipath (str) - the path to the Qt designer file
  • widgets (list[tuple(str, bool, list(...))] or None) - optional argument; a recursive (parent-relation of widgets) list of tuples, defining which widgets should be added as attributes to obj. See retrieveWidgets for details. If you omit this or pass None, recursively all child widgets will be stored
  • seticons (bool) - if True, widgets containing a string-property called 'pytsonicon' will get the icon of a soundpack (value of property = variable in soundpack)
  • iconpack (ts3client.IconPack) - if set, the iconpack will be used, if None, the current iconpack is used
  • pluginicons (Callable(str) -> str or QIcon) - callable which gets a string and either returns the path to the image file or returns a QPixmap to set the icon property to; defaults to None
  • extraWidgets (list(QWidget type)) - list of extra classes to be created, there must be a constructor which takes only the parent object