diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2024-06-20 16:56:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-20 16:56:00 +0200 |
| commit | c017cae01aa33a876795ec5da1438e8ec0f11fc5 (patch) | |
| tree | ace90dd7c09b6bbddd53cf4b351cb55ef56f42c0 /lib/extensions/params.py | |
| parent | c030e3283530bc1d0f4bad219f4c61db22750506 (diff) | |
gray out randomize stitch length param when random stitch length is disabled (#3002)
Diffstat (limited to 'lib/extensions/params.py')
| -rw-r--r-- | lib/extensions/params.py | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/lib/extensions/params.py b/lib/extensions/params.py index ef4dc616..b4efdc1b 100644 --- a/lib/extensions/params.py +++ b/lib/extensions/params.py @@ -97,7 +97,8 @@ class ParamsTab(ScrolledPanel): if self.toggle: self.update_toggle_state() - # end wxGlade + + self.update_enable_widgets() def pair(self, tab): self.paired_tab = tab @@ -349,6 +350,28 @@ class ParamsTab(ScrolledPanel): widgets[3].Show(True) choice["last_initialized_choice"] = current_selection + def update_enable_widgets(self, event=None): + if event is None: + for param in self.params: + if param.enables is not None: + value = self.param_inputs[param.name].GetValue() + for item in param.enables: + enable_input = self.param_inputs[item] + enable_input.Enable(value) + enable_input.GetPrevSibling().Enable(value) + else: + input = event.GetEventObject() + param = [param for param in self.params if param.name == input.Name] + if not param: + return + param = param[0] + if param.enables is not None: + value = input.GetValue() + for item in param.enables: + enable_input = self.param_inputs[item] + enable_input.Enable(value) + enable_input.GetPrevSibling().Enable(value) + def __do_layout(self, only_settings_grid=False): # noqa: C901 # just to add space around the settings @@ -393,7 +416,8 @@ class ParamsTab(ScrolledPanel): input = wx.CheckBox(self) if param.values: input.SetValue(param.values[0]) - + input.SetName(param.name) + input.Bind(wx.EVT_CHECKBOX, self.update_enable_widgets) input.Bind(wx.EVT_CHECKBOX, self.changed) elif param.type == 'dropdown': input = wx.Choice(self, wx.ID_ANY, choices=param.options) |
