forked from M-Labs/thermostat
Close client_watcher on closeEvent not aboutToQuit
Mirrors
This commit is contained in:
parent
d0d33f42da
commit
c476ad9f7d
@ -134,6 +134,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
else:
|
||||
await self.tec_client.set_param("fan", self.fan_power_slider.value())
|
||||
|
||||
@asyncClose
|
||||
async def closeEvent(self, event):
|
||||
if self.client_watcher is not None:
|
||||
self.client_watcher.stop_watching()
|
||||
|
||||
@asyncSlot()
|
||||
async def connect(self):
|
||||
ip, port = self.ip_set_line.text(), self.port_set_spin.value()
|
||||
@ -146,12 +151,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self._hw_rev(await self.tec_client.hw_rev())
|
||||
self.fan_update(await self.tec_client.fan())
|
||||
|
||||
self.client_watcher = ClientWatcher(self.main_widget, self.tec_client, self.report_refresh_spin.value())
|
||||
self.client_watcher = ClientWatcher(self, self.tec_client, self.report_refresh_spin.value())
|
||||
self.client_watcher.fan_update.connect(self.fan_update)
|
||||
self.report_apply_btn.clicked.connect(
|
||||
lambda: self.client_watcher.set_update_s(self.report_refresh_spin.value())
|
||||
)
|
||||
QtWidgets.QApplication.instance().aboutToQuit.connect(self.client_watcher.stop_watching)
|
||||
self.client_watcher.start_watching()
|
||||
else:
|
||||
self.client_watcher.stop_watching()
|
||||
|
Loading…
Reference in New Issue
Block a user