forked from M-Labs/thermostat
Refactor a bit to update lines only via poll
Model-View-Controller thing, don't edit UI when UI value changed
This commit is contained in:
parent
6014dce158
commit
744a472566
|
@ -625,17 +625,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||||
for inner_param, change, data in changes:
|
for inner_param, change, data in changes:
|
||||||
if change == 'value':
|
if change == 'value':
|
||||||
if inner_param.opts.get("commands", None) is not None:
|
if inner_param.opts.get("commands", None) is not None:
|
||||||
ch = param.value()
|
if inner_param.name() == 'Control Method' and not data:
|
||||||
match inner_param.name():
|
return
|
||||||
case 'Control Method':
|
|
||||||
pid_enabled = data
|
|
||||||
getattr(self, f'ch{ch}_t_line').setVisible(pid_enabled)
|
|
||||||
if pid_enabled:
|
|
||||||
getattr(self, f'ch{ch}_t_line').setValue(inner_param.child('Set Temperature').value())
|
|
||||||
else:
|
|
||||||
return
|
|
||||||
case 'Set Temperature':
|
|
||||||
getattr(self, f'ch{ch}_t_line').setValue(data)
|
|
||||||
await asyncio.gather(*[self.client._command(x.format(value=data)) for x in inner_param.opts["commands"]])
|
await asyncio.gather(*[self.client._command(x.format(value=data)) for x in inner_param.opts["commands"]])
|
||||||
elif inner_param.opts.get("param", None) is not None:
|
elif inner_param.opts.get("param", None) is not None:
|
||||||
await asyncio.gather(*[self.client.set_param(*x, data) for x in inner_param.opts["param"]])
|
await asyncio.gather(*[self.client.set_param(*x, data) for x in inner_param.opts["param"]])
|
||||||
|
|
Loading…
Reference in New Issue