Match statement

This commit is contained in:
atse 2023-08-04 11:51:16 +08:00
parent fde4e42069
commit 98f2d70cf6
1 changed files with 5 additions and 4 deletions

View File

@ -606,10 +606,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
line = getattr(self, f'ch{ch}_t_line')
line.setVisible(False)
elif param.opts.get("commands", None) is not None:
if param.name() == 'Temperature PID':
getattr(self, f'ch{param.opts["payload"]}_t_line').setVisible(True)
elif param.name() == 'Set Temperature':
getattr(self, f'ch{param.opts["payload"]}_t_line').setValue(data)
match param.name():
case 'Temperature PID':
getattr(self, f'ch{param.opts["payload"]}_t_line').setVisible(True)
case 'Set Temperature':
getattr(self, f'ch{param.opts["payload"]}_t_line').setValue(data)
await asyncio.gather(*[self.client._command(x.format(value=data)) for x in param.opts["commands"]])
def _set_param_tree(self):