Main class for the QGIS plugin
SLOT: configure the mask for the active layer using the config tables in the db
create a new QgsFeature for the layer
show str in QgsMessageLog
returns the QgsFeature for this ddTable in configLayer (public.dd_table)
check if layer is suitable to apply a DataDrivenInputMaskl
SLOT: Show the search form for the active layer
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
function to update the config tables if anything changes
highlight the feature if it has a geometry
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()
check if user has right to access this table
check if data provider allows editing of table
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”
thisDate may be either a QDate or a string
reimplemented from DdAttribute
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
builld the subset string to be applied as filter on the layer
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
returns a boolean representing the value in this field for this feature
Set this inputWidget to NULL
Bases: ddui.DdLineEdit
input widget (QComboBox) for a foreign key
returns a value representing the value in this field for this feature
user can type in comboBox, appropriate values are displayed
read the values to be shown in the QComboBox from the db
Bases: ddui.DdLineEdit
input widget (QDateEdit) for a date field
returns a QDate representing the value in this field for this feature
set the min and max date if attribute has min/max use either the passed values or attributes min/max
Bases: ddui.DdWidget
This is the mask ui
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
Bases: ddui.DdWidget
abstract super class for any input widget, corresponds to a DdAttribute
querys schema.table in db to get the highest occuring values for this DdInputWidget’s attribute
enable the inputWidget
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.
checks if value is within min/max range (if defined)
slot: disables the input widget if the null checkbox is checked and vice versa
function to strip quotation marks and data type from default string
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
create search sql-string
Set this inputWidget to NULL
set a validator, if needed must be implemented in child classes
Bases: ddui.DdLineEdit
input widget (QLineEdit) for a char or varchar
Bases: ddui.DdLineEdit
input widget (QLineEdit) for a DoubleValue
sets an appropriate QValidator for the QLineEdit if this DdInputWidget’s attribute has min/max values validator is set to them
Bases: ddui.DdLineEdit
input widget (QLineEdit) for an IntegerValue
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
slot to be called when the user double clicks on the QTableWidget
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
create a new QgsFeature for the relation table with this fid
Bases: ddui.DdLineEdit
input widget (QTextEdit) for a text field
Bases: object
abstract base class of all ui-widgets
check if input is valid returns True if not implemented in child class
initialize this widget for feature in layer must be implemented in child classes
reset anything changed by the DdWidget
creates search string must be implemented in child classes