generic-ui

How to add a generic ui-element

tba.

The abstractGeneric Ui

variables

dataTypes

pipeLion.ui.utils.genericUi.dataTypes = {<type 'float'>: {'default': <class 'pipeLion.ui.utils.genericUi.PlDoubleSpinBox'>}, <type 'list'>: {'default': <class 'pipeLion.ui.utils.genericUi.PlListWidget'>}, <type 'int'>: {'default': <class 'pipeLion.ui.utils.genericUi.PlSpinBox'>, 'version': <class 'pipeLion.ui.utils.genericUi.PlVersionBox'>, 'bid_days': <class 'pipeLion.ui.utils.genericUi.PlBidDaysBox'>}, <type 'bool'>: {'default': <class 'pipeLion.ui.utils.genericUi.PlLabel'>, 'workOnWeekends': <class 'pipeLion.ui.utils.genericUi.PlCheckBox'>}, <type 'str'>: {'name': <class 'pipeLion.ui.utils.genericUi.PlLineEdit'>, 'default': <class 'pipeLion.ui.utils.genericUi.PlTextEdit'>, 'image': <class 'pipeLion.ui.utils.genericUi.PlLineEdit'>, 'project': <class 'pipeLion.ui.utils.genericUi.PlLabel'>, 'type': <class 'pipeLion.ui.utils.genericUi.PlLabel'>, 'id': <class 'pipeLion.ui.utils.genericUi.PlLabel'>}, <type 'datetime.datetime'>: {'default': <class 'pipeLion.ui.utils.genericUi.PlDateEdit'>}, None: {'pipelineTd': <class 'pipeLion.ui.utils.genericUi.PlLabel'>, 'default': <class 'pipeLion.ui.utils.genericUi.PlLabel'>, 'user': <class 'pipeLion.ui.utils.genericUi.PlUserBox'>, 'producer': <class 'pipeLion.ui.utils.genericUi.PlLabel'>, 'connectedTo': <class 'pipeLion.ui.utils.genericUi.PlListWidget'>}, <class 'pipeLion.assets.user.User'>: {'default': <class 'pipeLion.ui.utils.genericUi.PlUserBox'>}, <class 'pipeLion.core.id.Id'>: {'default': <class 'pipeLion.ui.utils.genericUi.PlLabel'>}}

dataTypes is a dictionary which maps certain types to different Widget-classes

functions

getUiElement

pipeLion.ui.utils.genericUi.getUiElement(asset, attribute, mainLayout)[source]

method to generate one special widget for a given attribute of the given asset

Parameters:
  • asset (AbstractAsset) – the asset the attribute should be taken from
  • attribute (string) – name of the attribute, of the asset
  • mainLayout (PlLayout) – layout the created widget should be added to.
Returns:

the newly generated widget

Return type:

GenericUI & QWidget

getSettingsWidget

pipeLion.ui.utils.genericUi.getSettingsWidget(asset)[source]

wrapper around getUiElement to generate one generic-widget for each attribute of the given asset

Parameters:asset (AbstractAsset) – the asset which should create the attributes
Returns:a Widget which holds all generic-widgets
Return type:QWidget

classes

GenericUI

class pipeLion.ui.utils.genericUi.GenericUI(asset, attribute, mainLayout, parent=None)[source]

GenericUI is a class which defines different functions to set or get an attribute of an asset.

the idea behind this object is that by changing the class-variables:

getter
setter
changeSignal

most of the custom widgets can update their values and provide a possibility to automatically edit the underlying asset-object

In certain cases these three attributes might not be enough and the functions:

getGuiValue
getAssetValue
setGuiValue
setAssetValue

can be reimplemented.

changeSignal = ''

changeSignal is the name of the QtCore.,SIGNAL method which is emitted when in case the value in the ui changes, due to a user input.eg:: valueChanged (int)

getAssetValue()[source]

method is used to get the value of the underlying asset function can be reimplemented by subclasses

Returns:the underlying asset-attribute value
Return type:variant object
getGuiValue()[source]

method is used to get the value of the ui-element function can be reimplemented by subclasses

Returns:the underlying ui-elements value
Return type:variant object
getter = ''

getter is the name of the QWidget method to get a value from the Ui.eg:: value

setAssetValue(nil=None)[source]

method is used toset the value of asset-attribute to the value of the underlying ui-element function can be reimplemented by subclasses

Returns:the asset-attributes value
Return type:variant object
setGuiValue()[source]

method is used toset the value of the ui-element to the asset-attributes value function can be reimplemented by subclasses

Returns:the underlying ui-elements value
Return type:variant object
setter = ''

setter is the name of the QWidget method to change a value in the Ui.eg:: setValue

PlLayout

class pipeLion.ui.utils.genericUi.PlLayout(parent=None)[source]

PlLayout is derived by QVBoxLayout the only difference of this layout is, that it stores child-Widgets in a list called widgets

updateAllChildren()[source]

method will update all child-widgets at once

implemented custom widgets

classes

PlVersionBox

class pipeLion.ui.utils.genericUi.PlVersionBox(asset, attribute, mainLayout, parent=None)[source]

PlVersionBox is derived by QComboBox and GenericUI

it sets the class-variables:

setter = 'versionSetter'
getter = 'versionGetter'
changeSignal = 'currentIndexChanged (int)'
setAssetValue(nil=None)[source]

is a wrapper around updateAssetDict

Returns:the output of updateAssetDict
Return type:dictionary
updateAssetDict()[source]

method will update the whole assetDict of an asset with the assetDict of the selected version

Returns:the assetDict of the underlying asset
Return type:dictionary
versionGetter()[source]

method will gather the data behind the string shown in the comboBox

Returns:the user, who’s name was selected in the comboBox
Return type:User
versionSetter(_=None)[source]

method will set the value in the combo-box to the value of the underlying asset

PlUserBox

class pipeLion.ui.utils.genericUi.PlUserBox(asset, attribute, mainLayout, parent=None)[source]

PlUserBox is derived by QComboBox and GenericUI

it sets the class-variables:

setter = 'userSetter'
getter = 'userGetter'
changeSignal = 'currentIndexChanged (int)'
setAssetValue(nil=None)[source]

assigns or deassigns users from the underlying asset

Returns:the user of the underlying asset
Return type:User or None
userGetter()[source]

method will gather the data behind the string shown in the comboBox

Returns:the user, who’s name was selected in the comboBox
Return type:User
userSetter(_=None)[source]

method will set the value in the combo-box to the value of the underlying asset

PlListWidget

class pipeLion.ui.utils.genericUi.PlListWidget(asset, attribute, mainLayout, parent=None)[source]

PlListWidget is derived by QWidget and GenericUI

it sets the class-variables:

setter = 'nil'
getter = 'nil'
changeSignal = 'currentRowChanged (int)'

the PlListWidget is a container-widget for three types of widget:

listViewWidget -> type 0 : lists all list entries, no user-interaction possible
connectionWidget -> type 1 : allows the user to set input or output connection types
dependencyWidget -> type 2 : allows the user to connect other assets to this node

depending on the inputList the Layout will be setup differently.

addConnection()[source]

method gathers if an input-connection-type should be set or if there should be added a outputtype after gathering it will call either the addInputType or addOutputType on the underlying asset

addDay()[source]

method will connect the selected list-entry in the right list to the underlying asset

addDependency()[source]

method will connect the selected list-entry in the right list to the underlying asset

nil(_=None)[source]

method does nothing

removeConnection()[source]

method gathers if an input-connection-type or an outputtype should be removed after gathering it will call either the removeInputType or removeOutputType on the underlying asset

removeDay()[source]

method will disconnect the selected list-entry in the left list from the underlying asset

removeDependency()[source]

method will disconnect the selected list-entry in the left list from the underlying asset

setup()[source]

the list widgets

setupLayout(type)[source]

method to shows or hides the three widgets in the PlListWidget depending on the given type

Parameters:type (int) – type of the PlListWidget (0 : listViewWidget 1 : connectionWidget, 2 : dependencyWidget)

PlDateEdit

class pipeLion.ui.utils.genericUi.PlDateEdit(asset, attribute, mainLayout, parent=None)[source]

PlDateEdit is derived by QDateEdit and GenericUI

it sets the class-variables:

setter = 'dateSetter'
getter = 'dateGetter'
changeSignal = 'dateChanged (const QDate&)'
dateGetter()[source]

method gets the date from the uiElement

Returns:the date set in the ui
Return type:datetime.datetime
dateSetter(date)[source]

method sets the giveb date to the uiElement

Parameters:date (datetime.datetime) – date with year, month and day
Returns:the date set in the ui
Return type:QDate

PlDoubleSpinBox

class pipeLion.ui.utils.genericUi.PlDoubleSpinBox(asset, attribute, mainLayout, parent=None)[source]

PlDoubleSpinBox is derived by QDoubleSpinBox and GenericUI

it sets the class-variables:

setter = 'setValue'
getter = 'value'
changeSignal = 'valueChanged (double)'

PlSpinBox

class pipeLion.ui.utils.genericUi.PlSpinBox(asset, attribute, mainLayout, parent=None)[source]

PlSpinBox is derived by QSpinBox and GenericUI

it sets the class-variables:

setter = 'setValue'
getter = 'value'
changeSignal = 'valueChanged (int)'

PlLabel

class pipeLion.ui.utils.genericUi.PlLabel(asset, attribute, mainLayout, parent=None)[source]

PlLabel is derived by QLabel and GenericUI

it sets the class-variables:

setter = 'labelSet'
getter = 'text'
changeSignal = ''

PlTextEdit

class pipeLion.ui.utils.genericUi.PlTextEdit(asset, attribute, mainLayout, parent=None)[source]

PlTextEdit is derived by QTextEdit and GenericUI

it sets the class-variables:

setter = 'setText'
getter = 'toPlainText'
changeSignal = 'textChanged ()'

PlLineEdit

class pipeLion.ui.utils.genericUi.PlLineEdit(asset, attribute, mainLayout, parent=None)[source]

PlLineEdit is derived by QLineEdit and GenericUI

it sets the class-variables:

setter = 'setText'
getter = 'text'
changeSignal = 'editingFinished ()'