ddattribute
Each DdAttribute corresponds to an input widget in the mask or each input widget is based on exactly one DdAttribute.
General rules:
- every field has an input widget suitable for its type
- no ARRAY typees are supported
- supported types are: int4, int8, float, date, boolean, char, varchar, text
- 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)
- 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
- 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
- if no varchar field is present any char field is used
- if no varchar or char fields are available the pk field is used for display
- table inheritance is not covered
- 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)[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)[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')[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)[source]
a DdAttribute for field in a QGIS layer that represents a foreign key
-
class ddattribute.DdLayerAttribute(table, type, notNull, name, comment, attNum, isPK, isFK, default, hasDefault, length, label=None, min=None, max=None)[source]
a DdAttribute for a field in a QGIS layer
-
class ddattribute.DdManyToManyAttribute(relationTable, type, relationFeatureIdField, comment, label)[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=[])[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)[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)[source]
a DdAttribute for a relationTable