Skip to content

Commit 8dc6f03

Browse files
committed
Re-add maplayer arg to __create_editor_widget
1 parent d2777bd commit 8dc6f03

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/config_generator/dnd_form_generator.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def __add_widget_property(self, widget, name, valueEl, key, defaultValue="", pro
5858
property.append(string)
5959
widget.append(property)
6060

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)
6363
if (
6464
editWidget is None
6565
or editWidget.get("type") == "Hidden" or editWidget.get("type") == "RelationReference"
@@ -68,9 +68,9 @@ def __create_editor_widget(self, field, prefix=""):
6868
if not editWidget.get("type"):
6969
self.logger.warning("Warning: field '%s' has empty widget type" % field)
7070
return None
71-
editableField = self.maplayer.find("editable/field[@name='%s']" % field)
71+
editableField = maplayer.find("editable/field[@name='%s']" % field)
7272
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)
7474
required = constraintField is not None and constraintField.get("notnull_strength") == "1"
7575
if editWidget.get("type") == "CheckBox":
7676
# Don't translate NOT NULL constraint into required for checkboxes
@@ -82,7 +82,7 @@ def __create_editor_widget(self, field, prefix=""):
8282
self.__add_widget_property(widget, "required", None, None, "true" if required else "false", "property", "bool")
8383

8484
# 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)
8686
if uploadField is not None:
8787
widget.set("class", "QLineEdit")
8888
widget.set("name", "%s__upload" % (prefix + field))
@@ -352,7 +352,7 @@ def __add_tablayout_fields(self, parent, container, aliases):
352352
elif child.tag == "attributeEditorField":
353353
tabWidget = None
354354

355-
editorWidget = self.__create_editor_widget(child.get("name"))
355+
editorWidget = self.__create_editor_widget(self.maplayer, child.get("name"))
356356
if editorWidget is None:
357357
continue
358358

@@ -409,7 +409,7 @@ def __add_autolayout_fields(self, parent, aliases):
409409
row = 0
410410

411411
for field in fields:
412-
editorWidget = self.__create_editor_widget(field.get("name"))
412+
editorWidget = self.__create_editor_widget(self.maplayer, field.get("name"))
413413
if editorWidget is None:
414414
continue
415415

0 commit comments

Comments
 (0)