Main class for the QGIS plugin
SLOT: configure the mask for the active layer using the config tables in the db
Class that steers the DataDrivenUI
DdManager manages all masks in the current project
api method to add an action to the layer with a self defined name
api method initLayer: initialize this layer with a data-driven input mask. In case there is configuration for this layer in the database read this configuration and apply what is provided there. Returns a Boolean stating the success of the initialization Parameters: WARNING: if config tables are used, the parameters’ objects survive and are thus applied to the next layer, too. Be sure to also pass ALL optional paramerters when calling initLayer()
make a DdTable object from the passed in layer, returns None, if layer is not suitable
api method to exchange the default ui with a custom ui
api method showFeatureForm: show the data-driven input mask for a layer and a feature if the data provider allows editing the layer is turned into editing mode if the user clicks OK all changes to teh feature are committed (no undo!) if askForSave is true and the layer has pending changes the user is asked if the changes shall be commited before the mask is opened returns 1 if user clicked OK, 0 if CANCEL
Each DdAttribute corresponds to an input widget in the mask or each input widget is based on exactly one DdAttribute.
abstract super class for all DdAttributes
a DdAttribute for a date field in a QGIS layer if you want to specify today as min or max, simply pass “today”
a DdAttribute for field in a QGIS layer that represents a foreign key
a DdAttribute for a field in a QGIS layer
abstract class for any many2many attribute
a DdAttribute for a n2m relation, subtype can be list or tree relationTable and relatedTable are DdTable objects
a DdAttribute that draws a pushButton in the mask. the button must be implemented as subclass of dduserclass.DdPushButton
Classes that make up or steer the DataDrivenUI
Bases: object
Creates the DataDrivenUi
When subclassing this class, you want to rewrite createUi and use DdManager’s setUi method to apply your custom ui to the layer
read configuration from db
creates default uis for this table (DdTable instance) showChildren [Boolean]: show tabs for 1-to-1 relations (children) see ddmanager.initLayer for other parameters
querys this table’s foreign keys and returns a dict attnum: [str: Type of the lookup field, str: sql to query lookup values, str: Name of the value field in the lookup table, str: Comment on lookup table]
find those tables (n2mtable) where our pk is a fk
Bases: ddui.DdLineEdit
input widget (QCheckBox) for a boolean field
Bases: ddui.DdLineEdit
input widget (QComboBox) for a foreign key
returns a value representing the value in this field for this feature
Bases: ddui.DdLineEdit
input widget (QDateEdit) for a date field
returns a QDate representing the value in this field for this feature
Bases: ddui.DdWidget
This is the mask ui
Bases: PyQt4.QtCore.QObject
Event filter class to be applied to DdLineEdit’s input widgets throws a signal even when the input widget is not enabled
Bases: ddui.DdWidget
DdForms are the content of DdDialog, each DdDialog needs at least one DdForm (tab). The class arranges its input widgets either in a QToolBox or in the DdDialogWidget’s current tab A form can represent a (parent) layer with the corresponding (parent) feature
Bases: ddui.DdWidget
abstract super class for any input widget, corresponds to a DdAttribute
Bases: ddui.DdInputWidget
abstract class for all Input Widgets that can be represented in one line, creates a QLineEdit as default InputWidget, adds it together with a QCheckBox (to store null values) and a label to a QFormLayout.
slot: disables the input widget if the null checkbox is checked and vice versa
returns a str representing the value in this field for this feature; if the value is null, None is returned, if it is a new feature the default value is returned if available.
return the field index for this DdInputWidget’s attribute’s name in this layer
check/uncheck the null checkbox depending on the value and the attribute’s notNull property
slot called when event filter on self.inputWidget throws doubleClick signal
Bases: ddui.DdLineEdit
input widget (QLineEdit) for a char or varchar
Bases: ddui.DdLineEdit
input widget (QLineEdit) for a DoubleValue
Bases: ddui.DdLineEdit
input widget (QLineEdit) for an IntegerValue
Set this inputWidget to NULL; set only to default if default is an integer
sets an appropriate QValidator for the QLineEdit if this DdInputWidget’s attribute has min/max values validator is set to them A Python2 int covers PostgreSQL’s int2, int4 and int8 Upon initialization setValidator is called with the current value as min and max
Bases: ddui.DdN2mWidget
input widget (clickable QListWidget) for simple n2m relations
Bases: ddui.DdN2mWidget
a input widget for n-to-m relations with more than one field in the relation table The input widget consists of a QTableWidget and an add (+) and a remove (-) button
Bases: ddui.DdN2mWidget
input widget (clickable QTreeWidget) for n2m relations with more than one additional field in the related table TreeWidget is initialized directly from the DB
Bases: ddui.DdInputWidget
abstract class for any n-to-m relation
Bases: ddui.DdLineEdit
input widget (QTextEdit) for a text field
Bases: object
abstract base class of all ui-widgets
read the appropriate parentElement’s tag and apply to the widget
check if input is valid returns True if not implemented in child class