send_command: Use in syntax

More concisely checks for key existence in `dict`
This commit is contained in:
atse 2024-08-14 12:57:42 +08:00
parent b768d61e39
commit 3ee32a5cef

View File

@ -266,7 +266,7 @@ class MainWindow(QtWidgets.QMainWindow):
for inner_param, change, data in changes:
if change == "value":
if inner_param.opts.get("param", None) is not None:
if "param" in inner_param.opts:
if inner_param.opts.get("suffix", None) == "mA":
data /= 1000 # Given in mA
@ -282,13 +282,13 @@ class MainWindow(QtWidgets.QMainWindow):
await self.client.set_param(*set_param_args)
param.child(*param.childPath(inner_param)).setOpts(lock=False)
if inner_param.opts.get("pid_autotune", None) is not None:
if "pid_autotune" in inner_param.opts:
auto_tuner_param = inner_param.opts["pid_autotune"][0]
if inner_param.opts["pid_autotune"][1] != "ch":
ch = inner_param.opts["pid_autotune"][1]
self.autotuners.set_params(auto_tuner_param, ch, data)
if inner_param.opts.get("activaters", None) is not None:
if "activaters" in inner_param.opts:
activater = inner_param.opts["activaters"][
inner_param.opts["limits"].index(data)
]