@@ -58,8 +58,8 @@ def __add_widget_property(self, widget, name, valueEl, key, defaultValue="", pro
58
58
property .append (string )
59
59
widget .append (property )
60
60
61
- def __create_editor_widget (self , field , prefix = "" ):
62
- editWidget = self . maplayer .find ("fieldConfiguration/field[@name='%s']/editWidget" % field )
61
+ def __create_editor_widget (self , maplayer , field , prefix = "" ):
62
+ editWidget = maplayer .find ("fieldConfiguration/field[@name='%s']/editWidget" % field )
63
63
if (
64
64
editWidget is None
65
65
or editWidget .get ("type" ) == "Hidden" or editWidget .get ("type" ) == "RelationReference"
@@ -68,9 +68,9 @@ def __create_editor_widget(self, field, prefix=""):
68
68
if not editWidget .get ("type" ):
69
69
self .logger .warning ("Warning: field '%s' has empty widget type" % field )
70
70
return None
71
- editableField = self . maplayer .find ("editable/field[@name='%s']" % field )
71
+ editableField = maplayer .find ("editable/field[@name='%s']" % field )
72
72
editable = editableField is None or editableField .get ("editable" ) == "1"
73
- constraintField = self . maplayer .find ("constraints/constraint[@field='%s']" % field )
73
+ constraintField = maplayer .find ("constraints/constraint[@field='%s']" % field )
74
74
required = constraintField is not None and constraintField .get ("notnull_strength" ) == "1"
75
75
if editWidget .get ("type" ) == "CheckBox" :
76
76
# Don't translate NOT NULL constraint into required for checkboxes
@@ -82,7 +82,7 @@ def __create_editor_widget(self, field, prefix=""):
82
82
self .__add_widget_property (widget , "required" , None , None , "true" if required else "false" , "property" , "bool" )
83
83
84
84
# Compatibility with deprecated <filename>__upload convention
85
- uploadField = self . maplayer .find ("expressionfields/field[@name='%s__upload']" % field )
85
+ uploadField = maplayer .find ("expressionfields/field[@name='%s__upload']" % field )
86
86
if uploadField is not None :
87
87
widget .set ("class" , "QLineEdit" )
88
88
widget .set ("name" , "%s__upload" % (prefix + field ))
@@ -352,7 +352,7 @@ def __add_tablayout_fields(self, parent, container, aliases):
352
352
elif child .tag == "attributeEditorField" :
353
353
tabWidget = None
354
354
355
- editorWidget = self .__create_editor_widget (child .get ("name" ))
355
+ editorWidget = self .__create_editor_widget (self . maplayer , child .get ("name" ))
356
356
if editorWidget is None :
357
357
continue
358
358
@@ -409,7 +409,7 @@ def __add_autolayout_fields(self, parent, aliases):
409
409
row = 0
410
410
411
411
for field in fields :
412
- editorWidget = self .__create_editor_widget (field .get ("name" ))
412
+ editorWidget = self .__create_editor_widget (self . maplayer , field .get ("name" ))
413
413
if editorWidget is None :
414
414
continue
415
415
0 commit comments