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 = getattr(self, f'ch{ch}_t_line')
line.setVisible(False) line.setVisible(False)
elif param.opts.get("commands", None) is not None: elif param.opts.get("commands", None) is not None:
if param.name() == 'Temperature PID': match param.name():
getattr(self, f'ch{param.opts["payload"]}_t_line').setVisible(True) case 'Temperature PID':
elif param.name() == 'Set Temperature': getattr(self, f'ch{param.opts["payload"]}_t_line').setVisible(True)
getattr(self, f'ch{param.opts["payload"]}_t_line').setValue(data) 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"]]) await asyncio.gather(*[self.client._command(x.format(value=data)) for x in param.opts["commands"]])
def _set_param_tree(self): def _set_param_tree(self):