From 137004e6b5b0267b1a53720e56e742811ef6f1f9 Mon Sep 17 00:00:00 2001 From: atse Date: Wed, 16 Aug 2023 17:35:13 +0800 Subject: [PATCH] Loop through trees to set them up --- pytec/tec_qt.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index 7989421..26fc706 100644 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -266,10 +266,9 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): await asyncio.gather(*[self.tec_client._command(x.format(value=data)) for x in param.opts["commands"]]) def _set_param_tree(self): - self.ch0_tree.setParameters(params[0], showTop=False) - self.ch1_tree.setParameters(params[1], showTop=False) - params[0].sigTreeStateChanged.connect(self.send_command) - params[1].sigTreeStateChanged.connect(self.send_command) + for i, tree in enumerate((self.ch0_tree, self.ch1_tree)): + tree.setParameters(params[i], showTop=False) + params[i].sigTreeStateChanged.connect(self.send_command) @pyqtSlot(list) def update_pid(self, pid_settings):