diff --git a/pytec/pytec/gui/view/thermostat_ctrl_menu.py b/pytec/pytec/gui/view/thermostat_ctrl_menu.py index ce5f3f1..50455ef 100644 --- a/pytec/pytec/gui/view/thermostat_ctrl_menu.py +++ b/pytec/pytec/gui/view/thermostat_ctrl_menu.py @@ -6,8 +6,6 @@ from pytec.gui.view.net_settings_input_diag import NetSettingsInputDiag class ThermostatCtrlMenu(QtWidgets.QMenu): - reset_act = pyqtSignal(bool) - def __init__(self, thermostat, style): super().__init__() self._thermostat = thermostat @@ -56,7 +54,7 @@ class ThermostatCtrlMenu(QtWidgets.QMenu): self.fan = fan self.actionReset = QtGui.QAction("Reset Thermostat", self) - self.actionReset.triggered.connect(self.reset_act) + self.actionReset.triggered.connect(self.reset_request) self.addAction(self.actionReset) self.actionEnter_DFU_Mode = QtGui.QAction("Enter DFU Mode", self) @@ -177,6 +175,13 @@ class ThermostatCtrlMenu(QtWidgets.QMenu): self.fan_power_slider.value() ) + @asyncSlot(bool) + async def reset_request(self, _): + assert self._thermostat.connected() + + await self._thermostat.reset() + await self._thermostat.end_session() + @asyncSlot(bool) async def dfu_request(self, _): assert self._thermostat.connected() diff --git a/pytec/tec_qt.py b/pytec/tec_qt.py index e7609b6..d0d0ac1 100755 --- a/pytec/tec_qt.py +++ b/pytec/tec_qt.py @@ -117,8 +117,6 @@ class MainWindow(QtWidgets.QMainWindow): self.connect_btn.setMenu(self.conn_menu) self.thermostat_ctrl_menu = ThermostatCtrlMenu(self.thermostat, self.style()) - self.thermostat_ctrl_menu.reset_act.connect(self.reset_request) - self.thermostat_settings.setMenu(self.thermostat_ctrl_menu) self.loading_spinner.hide() @@ -250,16 +248,6 @@ class MainWindow(QtWidgets.QMainWindow): self.loading_spinner.start() self.loading_spinner.show() - @asyncSlot(bool) - async def reset_request(self, _): - assert self.thermostat.connected() - - await self.thermostat.reset() - await self.thermostat.end_session() - await asyncio.sleep(0.1) # Wait for the reset to start - - self.connect_btn.click() # Reconnect - async def coro_main(): args = get_argparser().parse_args()