Steal fan group and port??? Somehow

This commit is contained in:
atse 2023-07-19 12:49:15 +08:00
parent 7749459701
commit 71076510a2

View File

@ -73,8 +73,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.setupUi(self)
menu = QtWidgets.QMenu(self)
self.thermostat_settings.setMenu(menu)
self._set_up_context_menu()
self.fan_power_slider.valueChanged.connect(self.fan_set)
self.fan_auto_box.stateChanged.connect(self.fan_auto_set)
@ -95,6 +94,22 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.port_set_spin.setValue(int(args.PORT))
self.connect_btn.click()
def _set_up_context_menu(self):
self.menu = QtWidgets.QMenu()
self.menu.setTitle('Thermostat settings')
fan = QtWidgets.QWidgetAction(self.menu)
fan.setDefaultWidget(self.fan_group)
self.menu.addAction(fan)
self.menu.fan = fan
port = QtWidgets.QWidgetAction(self.menu)
port.setDefaultWidget(self.port_set_spin)
self.menu.addAction(port)
self.menu.port = port
self.thermostat_settings.setMenu(self.menu)
async def _on_connection_changed(self, result):
self.graph_group.setEnabled(result)
self.fan_group.setEnabled(result)