Full Documentation

Modules

datadriveninputmask

class datadriveninputmask.DataDrivenInputMask(iface)[source]

Main class for the QGIS plugin

configureMask()[source]

SLOT: configure the mask for the active layer using the config tables in the db

createFeature(layer)[source]

create a new QgsFeature for the layer

debug(str)[source]

show str in QgsMessageLog

getConfigFeature(configLayer, ddTable)[source]

returns the QgsFeature for this ddTable in configLayer (public.dd_table)

initGui()[source]

Add menu and menu items.

initializeLayer()[source]

SLOT: Create the mask for the active layer

isSuitableLayer(layer)[source]

check if layer is suitable to apply a DataDrivenInputMaskl

showInputForm()[source]

SLOT: Show the mask for the selected features in the active layer

showMultiForm()[source]

SLOT: Show the mask for the first selected features in the active layer Apply changes to all selected features in one go

showSearchForm()[source]

SLOT: Show the search form for the active layer

unload()[source]

Remove the plugin menu item and icon

ddmanager

Class that steers the DataDrivenUI

class ddmanager.DdManager(iface)[source]

DdManager manages all masks in the current project

addAction(layer, actionName=u'showDdForm', ddManagerName='ddManager')[source]

api method to add an action to the layer with a self defined name

addFormWidget(layer, label, toolTip=None, toUi=True, toSearchUi=True)[source]
addInputWidget(layer, inputWidget, ddFormWidgetIndex=None, beforeWidget=None, toUi=True, toSearchUi=True)[source]

api method to add a DdWidget into the ui of a layer

addInputWidgetAfter(layer, inputWidget, afterAttributeName, toUi=True, toSearchUi=True)[source]

api method to add a DdWidget into the ui of a layer after the widget of attribute with afterAttributeName. Will be placed in the same form

addInputWidgetBefore(layer, inputWidget, beforeAttributeName, toUi=True, toSearchUi=True)[source]

api method to add a DdWidget into the ui of a layer before the widget of attribute with beforeAttributeName. Will be placed in the same form

changeConfigTables(db)[source]

function to update the config tables if anything changes

createConfigTables(db)[source]
createDdTable(db, schemaName, tableName, withOid=True, withComment=True)[source]

create a DdTable object from the passed in variables

editingStarted()[source]
editingStopped()[source]
enableInputWidget(layer, attributeName, doEnable)[source]

api method to enable a DdWidget, i.e. set its Ddattribute to enableWidget

existsInDb(ddTable, db)[source]
findPostgresLayer(db, ddTable)[source]
getDbForLayer(layer)[source]
getGroupIndex(groupName)[source]

Find the index for groupName in the legend

getInputWidget(layer, attributeName)[source]

api method returning the DdWidget for a certain attribute

getSearchPath()[source]
highlightFeature(layer, feature)[source]

highlight the feature if it has a geometry

initLayer(layer, skip=[], labels={}, fieldOrder=[], fieldGroups={}, minMax={}, noSearchFields=[], showParents=True, createAction=True, db=None, inputMask=True, searchMask=True, inputUi=None, searchUi=None, helpText='', fieldDisable=[])[source]

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()

  • layer [QgsVectorLayer]
  • skip [array [string]]: field names to not show
  • labels [dict] with entries: “fieldname”: “label”
  • fieldOrder [array[string]]: containing the field names in the order they should be shown
  • fieldGroups [dict] with entries: fieldName: [tabTitle, tabTooltip] for each group a tab is created and the fields from fieldName onwards (refers to fieldOrder) are grouped in this tab; tabTooltip is optional
  • minMax [dict] with entries: “fieldname”: [min, max] - strings; use for numerical or date fields only!
  • noSearchFields [array[string]] with fields not to be shown in the search form, if empty all fields are shown. Skipped fields are never shown in the search form, no matter if they are included here
  • showParents [Boolean] show tabs for 1-to-1 relations (parents)
  • createAction [Boolean]: add an action to the layer’s list of actions
  • db [QtSql.QSqlDatabase]
  • inputMask [Boolean]: create a data-edit mask
  • searchMask [Boolean]: create a data-search mask
  • inputUi [ddui.DdDialogWidget]: apply this inputUi
  • searchUi [ddui.DdDialogWidget]: apply this as search ui
  • helpText [string] help text for this mask, may be html formatted
  • fieldDisable [array[string]]: field names whose DdInputWidget shall be disabled in the inputMask
isAccessible(db, ddTable, showError=True)[source]

check if user has right to access this table

isEditable(layer)[source]

check if data provider allows editing of table

loadPostGISLayer(db, ddTable, displayName=None, geomColumn=None, whereClause=None, keyColumn=None, intoDdGroup=True)[source]
makeDdTable(layer, db=None)[source]

make a DdTable object from the passed in layer, returns None, if layer is not suitable

quit()[source]
removeAction(layer, actionName)[source]

api method to remove an action from the layer

removeInputWidget(layer, attributeName, fromUi=True, fromSearchUi=True)[source]

api method to remove the DdWidget for a certain attribute

replaceInputWidget(layer, attributeName, newWidget, toUi=True, toSearchUi=True)[source]

api method to replace a DdWidget in the ui of a layer with another one

saveSearchPath(path='')[source]
setDb(layer, db)[source]

api method to set the db for a layer

setLastSearch(layer, root)[source]
setUi(layer, ui, searchUi=None, showParents=None, thisSize=None)[source]

api method to exchange the default ui with a custom ui

showDdForm(fid)[source]
showError(msg)[source]
showFeatureForm(layer, feature, showParents=True, title=None, askForSave=True, multiEdit=False)[source]

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 the 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 if multiEdit is True then the changes are applied to all selected Features in the layer returns 1 if user clicked OK, 0 if CANCEL

showQueryError(query, withSql=False)[source]
showSearchForm(layer, root=None)[source]

api method showSearchForm: show the data-driven search mask for a layer root is a search-XML Element to be applied upon startup, if not given lastSearch is applied returns 1 if user clicked OK, 0 if CANCEL

ddattribute

Each DdAttribute corresponds to an input widget in the mask or each input widget is based on exactly one DdAttribute.

General rules:

  1. every field has an input widget suitable for its type
  2. no ARRAY typees are supported
  3. supported types are: int4, int8, float, date, boolean, char, varchar, text
  4. foreign keys are represented as comboboxes and are only supported if based on one field (exactly one fk field in the table references exactly one pk field in the referenced table)
  5. the table referenced by a foreign key should have at least one field wit a notNull constraint apart from the primary key. This field will be used as display field in the combobox
  6. if a varchar field is present in a table referenced by a foreign key it is used as display field in the combobox, if there are several the one defined earlier is used
  7. if no varchar field is present any char field is used
  8. if no varchar or char fields are available the pk field is used for display
  9. table inheritance is not covered
  10. if a table’s pk is a fk to another table’s pk the other table’s mask is shown in a second tab
class ddattribute.DdAttribute(table, type, notNull, name, comment, label, min=None, max=None, enableWidget=True)[source]

abstract super class for all DdAttributes

debug(msg)[source]
getLabel()[source]
isTypeChar()[source]
isTypeFloat()[source]
isTypeInt()[source]
setMinMax(min, max)[source]
class ddattribute.DdCheckableTableAttribute(relationTable, relatedTable, comment, label, relationFeatureIdField, relationRelatedIdField, relatedIdField, relatedDisplayField, attributes, catalogTable=None, relatedCatalogIdField=None, catalogIdField=None, catalogDisplayField=None, catalogLabel=None, enableWidget=True)[source]
class ddattribute.DdDateLayerAttribute(table, type, notNull, name, comment, attNum, isPK, isFK, default, hasDefault, length, label=None, min=None, max=None, dateFormat='yyyy-MM-dd', enableWidget=True, isArray=False, arrayDelim='')[source]

a DdAttribute for a date field in a QGIS layer if you want to specify today as min or max, simply pass “today”

formatDate(thisDate)[source]

thisDate may be either a QDate or a string

setMinMax(min, max)[source]

reimplemented from DdAttribute

class ddattribute.DdFkLayerAttribute(table, type, notNull, name, comment, attNum, isPK, default, hasDefault, queryForCbx, label=None, enableWidget=True)[source]

a DdAttribute for field in a QGIS layer that represents a foreign key

getQueryForCbx()[source]
setQueryForCbx(newQuery)[source]
class ddattribute.DdGeometryAttribute(table, type, name, comment, attNum)[source]

a DdAttribute for a geometry field in a QGIS layer

class ddattribute.DdLayerAttribute(table, type, notNull, name, comment, attNum, isPK, isFK, default, hasDefault, length, label=None, min=None, max=None, enableWidget=True, isArray=False, arrayDelim='')[source]

a DdAttribute for a field in a QGIS layer

class ddattribute.DdManyToManyAttribute(relationTable, type, relationFeatureIdField, comment, label, enableWidget=True)[source]

abstract class for any many2many attribute

buildSubsetString(relationFeatureIdField)[source]

builld the subset string to be applied as filter on the layer

setSubsetString(subsetString=None)[source]
class ddattribute.DdN2mAttribute(relationTable, relatedTable, subType, comment, label, relationFeatureIdField, relationRelatedIdField, relatedIdField, relatedDisplayField, fieldList=[], relatedForeignKeys=[], enableWidget=True)[source]

a DdAttribute for a n2m relation, subtype can be list or tree relationTable and relatedTable are DdTable objects

buildDeleteStatement(relationSchema, relationTable, relationFeatureIdField)[source]
buildDisplayStatement(relationSchema, relationTable, relatedSchema, relatedTable, relationFeatureIdField, relatedIdField, relatedDisplayField, relationRelatedIdField, fieldList)[source]
buildInsertStatement(relationSchema, relationTable, relationFeatureIdField, relationRelatedIdField, fieldList)[source]
setDeleteStatement(deleteStatement=None)[source]
setDisplayStatement(displayStatement=None)[source]
setInsertStatement(insertStatement=None)[source]
class ddattribute.DdPushButtonAttribute(comment, label, enableWidget=True)[source]

a DdAttribute that draws a pushButton in the mask. the button must be implemented as subclass of dduserclass.DdPushButton

class ddattribute.DdTable(oid=None, schemaName='None', tableName='None', comment='', title=None)[source]

holds all information for a DB table relation

class ddattribute.DdTableAttribute(relationTable, comment, label, relationFeatureIdField, attributes, maxRows, showParents, pkAttName, enableWidget=True)[source]

a DdAttribute for a relationTable

ddui

Classes that make up or steer the DataDrivenUI

class ddui.DataDrivenUi(iface)[source]

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

configureLayer(ddTable, skip, labels, fieldOrder, fieldGroups, minMax, noSearchFields, db, createAction, helpText, fieldDisable)[source]

read configuration from db

createUi(thisTable, db, skip=[], labels={}, fieldOrder=[], fieldGroups={}, minMax={}, noSearchFields=[], showParents=True, showChildren=True, inputMask=True, searchMask=True, helpText='', createAction=True, readConfigTables=False, fieldDisable=[])[source]

creates default uis for this table (DdTable instance) showChildren [Boolean]: show tabs for 1-to-1 relations (children) see ddmanager.initLayer for other parameters

getAttributes(thisTable, db, labels, minMax, skip=[], fieldDisable=[])[source]

query the DB and create DdAttributes

getForeignKeys(thisTable, db)[source]

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]

getN2mAttributes(db, thisTable, attName, attNum, labels, showChildren, skip=[], fieldDisable=[])[source]

find those tables (n2mtable) where our pk is a fk

getOid(thisTable, db)[source]

query the DB to get a table’s oid

getParent(thisTable, db)[source]

deprecated

getParents(thisTable, db)[source]

query the DB to get a table’s parents if any A table has a parent if its primary key is defined on one field only and is at the same time a foreign key to another table’s primary key. Thus there is a 1:1 relationship between the two.

isSupportedType(typ)[source]
class ddui.DdArrayTableWidget(attribute)[source]

Bases: ddui.DdLineEdit

a table widget to show/edit values of an array field

add()[source]

slot to be called when the user clicks on the add button

appendRow(aValue, link=None, operator=None, checkIfNone=True)[source]

add a new row to the QTableWidget

applySearch(parentElement)[source]
cellChanged(thisRow, thisColumn)[source]
cellClicked(thisRow, thisColumn)[source]
chkStateChanged(newState)[source]

slot: disables the input widget if the null checkbox is checked and vice versa

createInputWidget(parent)[source]
createSearch(parentElement)[source]

create the search XML

extractCellWidgetValue(thisCellWidget)[source]
extractValues()[source]

extract the values from the cells; implementation for strings

fillRow(thisRow, aValue, link=None, operator=None, checkIfNone=True)[source]

fill thisRow with aValue

focusLost(thisRow=None)[source]

implementation in child classes

fromString(aValue)[source]

convert aValue from its string representation to a value of the appropriate class default implementation for string

getDefault()[source]

function to strip quotation marks and data type from default string

getDefaultItemValue()[source]

returns the default value to be added for new items

getFeatureValue(layer, feature)[source]

returns an array[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 is returned.

getValue()[source]
initialize(layer, feature, db, mode=0)[source]
insertRow(thisRow, aValue, link=None, operator=None)[source]

add a new row to the QTableWidget

nullChkStateChanged(newState)[source]
remove()[source]

slot to be called when the user clicks on the remove button

save(layer, feature, db)[source]
search(layer)[source]

create search sql-string

selectionChanged()[source]

slot to be called when the QTableWidget’s selection has changed

setCellWidget(thisRow, aValue)[source]

replace the QTableWidget item with an appropriate QWidget

setNull(setnull)[source]

Set this inputWidget to NULL

setRowValue(thisRow, aValue, checkIfNon=True)[source]

sets this row’s value to thisValue; default implementation for strings

setSearchCombo(thisRow, link=None, operator=None)[source]

sets combo boxes for searching to columns 0 and 1

setSizeMax(widget)[source]
setValue(thisValue)[source]

sets thisValue into the input widget

setupUi(parent, db)[source]
toSqlString(aValue)[source]

convert aValue to a string representation that can be used in a SQL statement default implementation for string

validate(thisValue, layer, feature, showMsg=True)[source]

checks if values are within min/max range (if defined)

class ddui.DdArrayTableWidgetBool(attribute)[source]

Bases: ddui.DdArrayTableWidget

a table widget to show/edit values of a boolean array field

extractCellWidgetValue(thisCellWidget)[source]
focusLost(thisRow=None)[source]
fromString(aValue)[source]
getDefaultItemValue()[source]
setCellWidget(thisRow, aValue)[source]
toSqlString(aValue)[source]
class ddui.DdArrayTableWidgetDate(attribute)[source]

Bases: ddui.DdArrayTableWidget

a table widget to show/edit values of a date array field

extractCellWidgetValue(thisCellWidget)[source]
focusLost(thisRow=None)[source]
fromString(aValue)[source]
getDefaultItemValue()[source]
setCellWidget(thisRow, aValue)[source]
toSqlString(aValue)[source]
toString(thisValue)[source]
class ddui.DdArrayTableWidgetDouble(attribute)[source]

Bases: ddui.DdArrayTableWidget

a table widget to show/edit values of an integer array field

fromString(aValue)[source]
getDefaultItemValue()[source]
setCellWidget(thisRow, aValue)[source]
toSqlString(aValue)[source]
toString(thisValue)[source]
class ddui.DdArrayTableWidgetInt(attribute)[source]

Bases: ddui.DdArrayTableWidget

a table widget to show/edit values of an integer array field

fromString(aValue)[source]
getDefaultItemValue()[source]
setCellWidget(thisRow, aValue)[source]
toSqlString(aValue)[source]
toString(thisValue)[source]
class ddui.DdCheckBox(attribute)[source]

Bases: ddui.DdLineEditBoolean

subclass DdLineEditBoolean to issue a deprecation warning

class ddui.DdComboBox(attribute)[source]

Bases: ddui.DdLineEdit

input widget (QComboBox) for a foreign key

createInputWidget(parent)[source]
fill()[source]

fill the QComboBox with the values

getFeatureValue(layer, feature)[source]

returns a value representing the value in this field for this feature

getValue()[source]
prepareCompleter()[source]

user can type in comboBox, appropriate values are displayed

readValues(db)[source]

read the values to be shown in the QComboBox from the db

setNull(setnull)[source]
setSearchValue(thisValue)[source]

search value is always type string (because it is stored in xml) foreign keys normally are of type int

setValue(thisValue)[source]
setupUi(parent, db)[source]
class ddui.DdDateEdit(attribute)[source]

Bases: ddui.DdLineEdit

input widget (QDateEdit) for a date field

createInputWidget(parent)[source]
getBetweenValue()[source]
getFeatureValue(layer, feature)[source]

returns a QDate representing the value in this field for this feature

getValue()[source]
setBetweenValue(thisValue)[source]

sets the between value

setNull(setnull)[source]
setSearchValue(thisValue)[source]

sets the search value

setValidator(min=None, max=None)[source]

set the min and max date if attribute has min/max use either the passed values or attributes min/max

setValue(thisValue)[source]
toString(thisValue)[source]
class ddui.DdDialogWidget[source]

Bases: ddui.DdWidget

This is the mask ui

addFormWidget(ddFormWidget)[source]

add this DdFormWidget to the ui

addInputWidget(inputWidget, ddFormWidgetIndex=None, beforeWidget=None)[source]

add inputWidget to form with ddFormWidgetIndex beforeWidget (index in form)

applySearch(parentElement)[source]
checkInput(layer, feature)[source]
createSearch(parentElement)[source]
discard()[source]
initialize(layer, feature, db, mode=0)[source]
save(layer, feature, db)[source]
search(layer)[source]
setHelpText(helpText)[source]
setupUi(ddDialog, db)[source]
class ddui.DdEventFilter[source]

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

doubleClicked
eventFilter(watchedObject, event)[source]
class ddui.DdFormHelper(thisDialog, layerId, featureId)[source]
class ddui.DdFormWidget(ddTable, hasToolBox=False, layer=None)[source]

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

addInputWidget(ddInputWidget, beforeWidget=None)[source]

insert this DdInputWidget into this DdForm before Widget

applySearch(parentElement)[source]
checkInput(layer, feature)[source]
createSearch(parentElement)[source]
discard()[source]
initialize(layer, feature, db, mode=0)[source]
reset()[source]
save(layer, feature, db)[source]
search(layer)[source]
setupUi(parent, db)[source]
class ddui.DdInputWidget(ddAttribute)[source]

Bases: ddui.DdWidget

abstract super class for any input widget, corresponds to a DdAttribute

boolToString(thisValue)[source]

convert boolean to string

createLabel(parent)[source]

creates a QLabel object

dateToString(thisValue)[source]

convert QDate to a string

doubleToString(thisValue)[source]

convert a double to string

enableAccordingToDdAttribute()[source]
getLabel()[source]

returns the label for this DdInputWidget

getMaxValueFromTable(schemaName, tableName, db)[source]

querys schema.table in db to get the highest occuring values for this DdInputWidget’s attribute

intToString(thisValue)[source]

convert an integer to a string

registerChange(thisValue)[source]

slot to be called when user changes the input

setEnabled(enable)[source]

enable the inputWidget

class ddui.DdLineEdit(attribute)[source]

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.

applySearch(parentElement)[source]
checkInput(layer, feature)[source]

check if current value is an acceptable result

chkStateChanged(newState)[source]

slot: disables the input widget if the null checkbox is checked and vice versa

createInputWidget(parent)[source]
createSearch(parentElement)[source]

create the search XML

getBetweenValue()[source]
getDefault()[source]

function to strip quotation marks and data type from default string

getFeatureValue(layer, feature)[source]

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.

getFieldIndex(layer)[source]

return the field index for this DdInputWidget’s attribute’s name in this layer

getValue()[source]
initialize(layer, feature, db, mode=0)[source]
manageChk(thisValue)[source]

check/uncheck the null checkbox depending on the value and the attribute’s notNull property

onDoubleClick()[source]

slot called when event filter on self.inputWidget throws doubleClick signal

save(layer, feature, db)[source]
search(layer)[source]

create search sql-string

searchCbxChanged(thisIndex)[source]

steer visibility of betweenWidget

setBetweenValue(thisValue)[source]

sets thisValue into the betweenWidget

setEnabled(enable)[source]
setNull(setnull)[source]

Set this inputWidget to NULL

setSearchValue(thisValue)[source]

sets the search value, diverging implementations in subclasses

setValidator(min=None, max=None)[source]

set a validator, if needed must be implemented in child classes

setValue(thisValue)[source]

sets thisValue into the input widget

setupUi(parent, db)[source]

setup the label and add the inputWidget to parents formLayout

toString(thisValue)[source]
validate(thisValue, layer, feature, showMsg=True)[source]

checks if value is within min/max range (if defined) and returns the value; subclasses can manipulate thisValue in order to make it valid input

class ddui.DdLineEditBoolean(attribute)[source]

Bases: ddui.DdLineEdit

input widget Radio Buttons labeld with yes/no for a boolean field

createInputWidget(parent)[source]
getFeatureValue(layer, feature)[source]

returns a boolean representing the value in this field for this feature

getValue()[source]
setNull(setnull)[source]

Set this inputWidget to NULL

setValue(thisValue)[source]
setupUi(parent, db)[source]

setup the label and add the inputWidget to parents formLayout

class ddui.DdLineEditChar(attribute)[source]

Bases: ddui.DdLineEdit

input widget (QLineEdit) for a char or varchar

checkInput(layer, feature)[source]
class ddui.DdLineEditDouble(attribute)[source]

Bases: ddui.DdLineEdit

input widget (QLineEdit) for a DoubleValue

getBetweenValue()[source]
getValue()[source]
setBetweenValue(thisValue)[source]
setValidator(min=None, max=None)[source]

sets an appropriate QValidator for the QLineEdit if this DdInputWidget’s attribute has min/max values validator is set to them

setValue(thisValue)[source]
toString(thisValue)[source]
validate(thisValue, layer, feature, showMsg=True)[source]
class ddui.DdLineEditGeometry(attribute)[source]

Bases: ddui.DdLineEditInt

checkDefault(feature)[source]
checkInput(layer, feature)[source]
getFeatureValue(layer, feature)[source]
save(layer, feature, db)[source]
validate(thisValue, layer, feature, showMsg=True)[source]
class ddui.DdLineEditInt(attribute)[source]

Bases: ddui.DdLineEdit

input widget (QLineEdit) for an IntegerValue

checkDefault(feature)[source]
getFeatureValue(layer, feature)[source]
getValue(noSerial=False)[source]
save(layer, feature, db)[source]
setNull(setnull)[source]

Set this inputWidget to NULL; set only to default if default is an integer

setValidator(min=None, max=None)[source]

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

setValue(thisValue)[source]
toString(thisValue)[source]
validate(thisValue, layer, feature, showMsg=True)[source]
class ddui.DdN2mListWidget(attribute)[source]

Bases: ddui.DdN2mWidget

input widget (clickable QListWidget) for simple n2m relations

applySearch(parentElement)[source]
createInputWidget(parent)[source]
createSearch(parentElement)[source]
createWidgetItem(parentId, parent)[source]
fill()[source]

fill the listbox with items

initialize(layer, feature, db, mode=0)[source]
registerChange(thisItem)[source]
search(layer)[source]
class ddui.DdN2mTableWidget(attribute)[source]

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

add()[source]

slot to be called when the user clicks on the add button

appendRow(thisFeature)[source]

add a new row to the QTableWidget

applySearch(parentElement)[source]
createInputWidget(parent)[source]
createSearch(parentElement)[source]
createTableWidgetItem(aValue)[source]
doubleClick(thisRow, thisColumn)[source]

slot to be called when the user double clicks on the QTableWidget

enableAccordingToDdAttribute()[source]
fill()[source]
fillRow(thisRow, thisFeature)[source]

fill thisRow with values from thisFeature

getFeatureValues(thisFeature)[source]

get a string representation of the values of this feature, None values are returned as “NULL”

getFkValues(db)[source]
initialize(layer, feature, db, mode=0)[source]
remove()[source]

slot to be called when the user clicks on the remove button

search(layer)[source]

create search sql-string

selectionChanged()[source]

slot to be called when the QTableWidget’s selection has changed

setupUi(parent, db)[source]
class ddui.DdN2mTreeWidget(attribute)[source]

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

applySearch(parentElement)[source]
createInputWidget(parent)[source]
createSearch(parentElement)[source]
createWidgetItem(parentId, childs)[source]
fill()[source]
initialize(layer, feature, db, mode=0)[source]
registerChange(thisItem, thisColumn)[source]
search(layer)[source]
class ddui.DdN2mWidget(attribute)[source]

Bases: ddui.DdInputWidget

abstract class for any n-to-m relation

applySubsetString(reset=True)[source]
createFeature(fid=None)[source]

create a new QgsFeature for the relation table with this fid

discard()[source]
filter()[source]

Slot when user clicks on filter button

filterTxlChanged(newText)[source]
forwardAccept()[source]

Slot to be called from self.timer

initialize(layer, feature, db, mode=0)[source]

This method needs to be called by all subclasses!

initializeLayer(layer, feature, db, doShowParents=False, withMask=False, skip=[])[source]
initializeTableLayer(db, doShowParents=False, withMask=False, skip=[])[source]
keyForChild(parentId)[source]
prepareFeatureIdForSubsetString()[source]
removeFilter()[source]
reset()[source]

save column widths

save(layer, feature, db)[source]
setSizeMax(widget)[source]
setupUi(parent, db)[source]
class ddui.DdTextEdit(attribute)[source]

Bases: ddui.DdLineEdit

input widget (QTextEdit) for a text field

createInputWidget(parent)[source]
getValue()[source]
registerChange()[source]
setValue(thisValue)[source]
class ddui.DdWidget[source]

Bases: object

abstract base class of all ui-widgets

applySearch(parentElement)[source]

read the appropriate parentElement’s tag and apply to the widget

checkInput(layer, feature)[source]

check if input is valid returns True if not implemented in child class

createSearch(parentElement)[source]

creates search xml

debug(msg)[source]
discard()[source]

discards the input

getPk(feature, layer)[source]

only relevant for QGIS 2.16 and newer: read the pk-id value either from the feature itself or, in case of a bigint pk field from the field

initialize(layer, feature, db, mode=0)[source]

initialize this widget for feature in layer must be implemented in child classes

reset()[source]

reset anything changed by the DdWidget

save(layer, feature, db)[source]

saves the input must be implemented in child classes

search(layer)[source]

creates search string must be implemented in child classes

setupUi(parent, db)[source]

create the ui must be implemented in child classes

ddui.ddFormInit(dialog, layerId, featureId)[source]
ddui.ddFormInit1(dialog, layerId, featureId)[source]

dddialog

class dddialog.DdDialog(ddManager, ui, layer, feature, db, multiEdit=False, parent=None, title=None)[source]

Each mask is a DdDialog instance, thus a child of QDialog

accept()[source]
debug(str)[source]
helpRequested()[source]
initialize()[source]
reject()[source]
setForwardReturn(doForward=True)[source]
setTitle(title=None)[source]
class dddialog.DdSearchDialog(ui, layer, db, parent=None, root=None)[source]

Each searchDialog is a child of QDialog

accept()[source]
applySearch(root)[source]
clicked(thisButton)[source]
createSearch()[source]
debug(str)[source]
initialize()[source]
loadSearch()[source]
reject()[source]
saveSearch()[source]
setForwardReturn(doForward=True)[source]
setTitle()[source]

dderror

Error classes

class dderror.DbError(query, fatal=True)[source]

error querying the DB

class dderror.DdError(value, fatal=False, iface=None, showInLog=False)[source]

General error

exception dderror.FatalError(value)[source]