Don't use dynamic properties

This commit is contained in:
atse 2023-08-16 14:33:16 +08:00
parent 68503d19e5
commit c876c1ec0a
3 changed files with 18 additions and 37 deletions

View File

@ -643,6 +643,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def _set_param_tree(self): def _set_param_tree(self):
for i, tree in enumerate((self.ch0_tree, self.ch1_tree)): for i, tree in enumerate((self.ch0_tree, self.ch1_tree)):
tree.setHeaderHidden(True)
tree.setParameters(self.params[i], showTop=False) tree.setParameters(self.params[i], showTop=False)
self.params[i].sigTreeStateChanged.connect(self.send_command) self.params[i].sigTreeStateChanged.connect(self.send_command)
@ -692,6 +693,16 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
with QSignalBlocker(self.params[channel]): with QSignalBlocker(self.params[channel]):
self.params[channel].child("Postfilter Config", "Rate").setValue(postfilter_params["rate"]) self.params[channel].child("Postfilter Config", "Rate").setValue(postfilter_params["rate"])
def retranslateUi(self, MainWindow):
super().retranslateUi(MainWindow)
_translate = QtCore.QCoreApplication.translate
self.ch0_t_graph.setTitle(_translate("MainWindow", "Channel 0 Temperature"))
self.ch0_i_graph.setTitle(_translate("MainWindow", "Channel 0 Current"))
self.ch1_t_graph.setTitle(_translate("MainWindow", "Channel 1 Temperature"))
self.ch1_i_graph.setTitle(_translate("MainWindow", "Channel 1 Current"))
async def coro_main(): async def coro_main():
args = get_argparser().parse_args() args = get_argparser().parse_args()

View File

@ -90,46 +90,22 @@
<number>2</number> <number>2</number>
</property> </property>
<item row="1" column="0"> <item row="1" column="0">
<widget class="ParameterTree" name="ch1_tree" native="true"> <widget class="ParameterTree" name="ch1_tree" native="true"/>
<property name="HeaderHidden">
<bool>true</bool>
</property>
</widget>
</item> </item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="ParameterTree" name="ch0_tree" native="true"> <widget class="ParameterTree" name="ch0_tree" native="true"/>
<property name="HeaderHidden">
<bool>true</bool>
</property>
</widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="LivePlotWidget" name="ch1_t_graph" native="true"> <widget class="LivePlotWidget" name="ch1_t_graph" native="true"/>
<property name="title">
<string>Channel 1 Temperature</string>
</property>
</widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="LivePlotWidget" name="ch0_t_graph" native="true"> <widget class="LivePlotWidget" name="ch0_t_graph" native="true"/>
<property name="title">
<string>Channel 0 Temperature</string>
</property>
</widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="LivePlotWidget" name="ch0_i_graph" native="true"> <widget class="LivePlotWidget" name="ch0_i_graph" native="true"/>
<property name="title">
<string>Channel 0 Current</string>
</property>
</widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="LivePlotWidget" name="ch1_i_graph" native="true"> <widget class="LivePlotWidget" name="ch1_i_graph" native="true"/>
<property name="title">
<string>Channel 1 Current</string>
</property>
</widget>
</item> </item>
</layout> </layout>
</widget> </widget>

View File

@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'tec_qt.ui' # Form implementation generated from reading ui file 'tec_qt.ui'
# #
# Created by: PyQt6 UI code generator 6.5.0 # Created by: PyQt6 UI code generator 6.5.2
# #
# WARNING: Any manual changes made to this file will be lost when pyuic6 is # WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing. # run again. Do not edit this file unless you know what you are doing.
@ -45,11 +45,9 @@ class Ui_MainWindow(object):
self.graphs_layout.setSpacing(2) self.graphs_layout.setSpacing(2)
self.graphs_layout.setObjectName("graphs_layout") self.graphs_layout.setObjectName("graphs_layout")
self.ch1_tree = ParameterTree(parent=self.graph_group) self.ch1_tree = ParameterTree(parent=self.graph_group)
self.ch1_tree.setHeaderHidden(True)
self.ch1_tree.setObjectName("ch1_tree") self.ch1_tree.setObjectName("ch1_tree")
self.graphs_layout.addWidget(self.ch1_tree, 1, 0, 1, 1) self.graphs_layout.addWidget(self.ch1_tree, 1, 0, 1, 1)
self.ch0_tree = ParameterTree(parent=self.graph_group) self.ch0_tree = ParameterTree(parent=self.graph_group)
self.ch0_tree.setHeaderHidden(True)
self.ch0_tree.setObjectName("ch0_tree") self.ch0_tree.setObjectName("ch0_tree")
self.graphs_layout.addWidget(self.ch0_tree, 0, 0, 1, 1) self.graphs_layout.addWidget(self.ch0_tree, 0, 0, 1, 1)
self.ch1_t_graph = LivePlotWidget(parent=self.graph_group) self.ch1_t_graph = LivePlotWidget(parent=self.graph_group)
@ -221,10 +219,6 @@ class Ui_MainWindow(object):
def retranslateUi(self, MainWindow): def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "Thermostat Control Panel")) MainWindow.setWindowTitle(_translate("MainWindow", "Thermostat Control Panel"))
self.ch1_t_graph.setTitle(_translate("MainWindow", "Channel 1 Temperature"))
self.ch0_t_graph.setTitle(_translate("MainWindow", "Channel 0 Temperature"))
self.ch0_i_graph.setTitle(_translate("MainWindow", "Channel 0 Current"))
self.ch1_i_graph.setTitle(_translate("MainWindow", "Channel 1 Current"))
self.bottom_settings_group.setToolTip(_translate("MainWindow", "Thermostat Settings")) self.bottom_settings_group.setToolTip(_translate("MainWindow", "Thermostat Settings"))
self.connect_btn.setText(_translate("MainWindow", "Connect")) self.connect_btn.setText(_translate("MainWindow", "Connect"))
self.status_lbl.setText(_translate("MainWindow", "Disconnected")) self.status_lbl.setText(_translate("MainWindow", "Disconnected"))