forked from M-Labs/thermostat
Reorder MainWindow
This commit is contained in:
parent
3c9b6a40d9
commit
02aab70e82
@ -130,6 +130,13 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
lambda: self.thermostat.set_update_s(self.report_refresh_spin.value())
|
lambda: self.thermostat.set_update_s(self.report_refresh_spin.value())
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@asyncClose
|
||||||
|
async def closeEvent(self, _event):
|
||||||
|
try:
|
||||||
|
await self.thermostat.end_session()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
@asyncSlot(ThermostatConnectionState)
|
@asyncSlot(ThermostatConnectionState)
|
||||||
async def _on_connection_changed(self, state):
|
async def _on_connection_changed(self, state):
|
||||||
self.graph_group.setEnabled(state == ThermostatConnectionState.CONNECTED)
|
self.graph_group.setEnabled(state == ThermostatConnectionState.CONNECTED)
|
||||||
@ -156,16 +163,27 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self.status_lbl.setText("Disconnected")
|
self.status_lbl.setText("Disconnected")
|
||||||
self.report_box.setChecked(False)
|
self.report_box.setChecked(False)
|
||||||
|
|
||||||
@asyncSlot(int)
|
@asyncSlot(int, PIDAutotuneState)
|
||||||
async def on_report_box_stateChanged(self, enabled):
|
async def pid_autotune_handler(self, _ch, _state):
|
||||||
await self.thermostat.set_report_mode(enabled)
|
ch_tuning = []
|
||||||
|
for ch in range(self.NUM_CHANNELS):
|
||||||
|
if self.autotuners.get_state(ch) in {
|
||||||
|
PIDAutotuneState.STATE_READY,
|
||||||
|
PIDAutotuneState.STATE_RELAY_STEP_UP,
|
||||||
|
PIDAutotuneState.STATE_RELAY_STEP_DOWN,
|
||||||
|
}:
|
||||||
|
ch_tuning.append(ch)
|
||||||
|
|
||||||
@asyncClose
|
if len(ch_tuning) == 0:
|
||||||
async def closeEvent(self, _event):
|
self.background_task_lbl.setText("Ready.")
|
||||||
try:
|
self.loading_spinner.hide()
|
||||||
await self.thermostat.end_session()
|
self.loading_spinner.stop()
|
||||||
except:
|
else:
|
||||||
pass
|
self.background_task_lbl.setText(
|
||||||
|
"Autotuning channel {ch}...".format(ch=ch_tuning)
|
||||||
|
)
|
||||||
|
self.loading_spinner.start()
|
||||||
|
self.loading_spinner.show()
|
||||||
|
|
||||||
@asyncSlot()
|
@asyncSlot()
|
||||||
async def on_connect_btn_clicked(self):
|
async def on_connect_btn_clicked(self):
|
||||||
@ -191,27 +209,9 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
else:
|
else:
|
||||||
await self.thermostat.end_session()
|
await self.thermostat.end_session()
|
||||||
|
|
||||||
@asyncSlot(int, PIDAutotuneState)
|
@asyncSlot(int)
|
||||||
async def pid_autotune_handler(self, _ch, _state):
|
async def on_report_box_stateChanged(self, enabled):
|
||||||
ch_tuning = []
|
await self.thermostat.set_report_mode(enabled)
|
||||||
for ch in range(self.NUM_CHANNELS):
|
|
||||||
if self.autotuners.get_state(ch) in {
|
|
||||||
PIDAutotuneState.STATE_READY,
|
|
||||||
PIDAutotuneState.STATE_RELAY_STEP_UP,
|
|
||||||
PIDAutotuneState.STATE_RELAY_STEP_DOWN,
|
|
||||||
}:
|
|
||||||
ch_tuning.append(ch)
|
|
||||||
|
|
||||||
if len(ch_tuning) == 0:
|
|
||||||
self.background_task_lbl.setText("Ready.")
|
|
||||||
self.loading_spinner.hide()
|
|
||||||
self.loading_spinner.stop()
|
|
||||||
else:
|
|
||||||
self.background_task_lbl.setText(
|
|
||||||
"Autotuning channel {ch}...".format(ch=ch_tuning)
|
|
||||||
)
|
|
||||||
self.loading_spinner.start()
|
|
||||||
self.loading_spinner.show()
|
|
||||||
|
|
||||||
|
|
||||||
async def coro_main():
|
async def coro_main():
|
||||||
|
Loading…
Reference in New Issue
Block a user