Path: Remove duplicate populateCombobox() definitions

Apply python DRY philosophy to `populateCombobox()` method throughout PathScripts modules.
This commit is contained in:
Russell Johnson
2022-02-10 23:27:41 -06:00
parent f5f2f95587
commit ea1d28c2a4
9 changed files with 11 additions and 121 deletions

View File

@@ -95,21 +95,6 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
return form
def populateCombobox(self, form, enumTups, comboBoxesPropertyMap):
"""fillComboboxes(form, comboBoxesPropertyMap) ... populate comboboxes with translated enumerations
** comboBoxesPropertyMap will be unnecessary if UI files use strict combobox naming protocol.
Args:
form = UI form
enumTups = list of (translated_text, data_string) tuples
comboBoxesPropertyMap = list of (translated_text, data_string) tuples
"""
# Load appropriate enumerations in each combobox
for cb, prop in comboBoxesPropertyMap:
box = getattr(form, cb) # Get the combobox
box.clear() # clear the combobox
for text, data in enumTups[prop]: # load enumerations
box.addItem(text, data)
def updateMinTravel(self, obj, setModel=True):
if obj.UseStartPoint:
self.form.minTravel.setEnabled(True)