From a8539e77bc17e0fd1492a96a2f4e27740f945693 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Sun, 3 Jan 2021 12:05:58 -0800 Subject: [PATCH] Added enum placeholder text and disable labels when entry field is disabled. --- .../Gui/Resources/panels/PropertyCreate.ui | 80 ++++++++----------- .../Path/PathScripts/PathPropertyBagGui.py | 24 +++--- 2 files changed, 46 insertions(+), 58 deletions(-) diff --git a/src/Mod/Path/Gui/Resources/panels/PropertyCreate.ui b/src/Mod/Path/Gui/Resources/panels/PropertyCreate.ui index f06eea2054..c65c02ea82 100644 --- a/src/Mod/Path/Gui/Resources/panels/PropertyCreate.ui +++ b/src/Mod/Path/Gui/Resources/panels/PropertyCreate.ui @@ -7,7 +7,7 @@ 0 0 480 - 468 + 452 @@ -15,7 +15,7 @@ - + Name @@ -28,45 +28,20 @@ - - - - Group + + + + <html><head/><body><p>The category group the property belongs to.</p></body></html> + + + true - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - <html><head/><body><p>The category group the property belongs to.</p></body></html> - - - true - - - - - - - - + + - Type + Group @@ -77,20 +52,17 @@ - - + + - Enums + Type - - - - - - ToolTip + + + val1,val2,val3,... @@ -104,6 +76,20 @@ + + + + Enums + + + + + + + ToolTip + + + @@ -154,7 +140,7 @@ propertyName propertyGroup propertyType - enumValues + propertyEnum propertyInfo createAnother diff --git a/src/Mod/Path/PathScripts/PathPropertyBagGui.py b/src/Mod/Path/PathScripts/PathPropertyBagGui.py index 1167a54a02..854e030017 100644 --- a/src/Mod/Path/PathScripts/PathPropertyBagGui.py +++ b/src/Mod/Path/PathScripts/PathPropertyBagGui.py @@ -149,19 +149,19 @@ class PropertyCreate(object): self.form.propertyGroup.currentIndexChanged.connect(self.updateUI) self.form.propertyName.textChanged.connect(self.updateUI) self.form.propertyType.currentIndexChanged.connect(self.updateUI) - self.form.enumValues.textChanged.connect(self.updateUI) + self.form.propertyEnum.textChanged.connect(self.updateUI) def updateUI(self): typeSet = True if self.propertyIsEnumeration(): - self.form.enumLabel.setEnabled(True) - self.form.enumValues.setEnabled(True) - typeSet = self.form.enumValues.text().strip() != '' + self.form.labelEnum.setEnabled(True) + self.form.propertyEnum.setEnabled(True) + typeSet = self.form.propertyEnum.text().strip() != '' else: - self.form.enumLabel.setEnabled(False) - self.form.enumValues.setEnabled(False) - if self.form.enumValues.text().strip(): - self.form.enumValues.setText('') + self.form.labelEnum.setEnabled(False) + self.form.propertyEnum.setEnabled(False) + if self.form.propertyEnum.text().strip(): + self.form.propertyEnum.setText('') ok = self.form.buttonBox.button(QtGui.QDialogButtonBox.Ok) @@ -181,7 +181,7 @@ class PropertyCreate(object): def createAnother(self): return self.form.createAnother.isChecked() def propertyEnumerations(self): - return [s.strip() for s in self.form.enumValues.text().strip().split(',')] + return [s.strip() for s in self.form.propertyEnum.text().strip().split(',')] def propertyIsEnumeration(self): return self.propertyType() == 'App::PropertyEnumeration' @@ -190,17 +190,19 @@ class PropertyCreate(object): # property exists - this is an edit operation self.form.propertyName.setText(name) if self.propertyIsEnumeration(): - self.form.enumValues.setText(','.join(self.obj.getEnumerationsOfProperty(name))) + self.form.propertyEnum.setText(','.join(self.obj.getEnumerationsOfProperty(name))) self.form.propertyInfo.setText(self.obj.getDocumentationOfProperty(name)) + self.form.labelName.setEnabled(False) self.form.propertyName.setEnabled(False) + self.form.labelType.setEnabled(False) self.form.propertyType.setEnabled(False) self.form.createAnother.setEnabled(False) else: self.form.propertyName.setText('') self.form.propertyInfo.setText('') - self.form.enumValues.setText('') + self.form.propertyEnum.setText('') #self.form.propertyName.setFocus() self.updateUI()