GUI: add a spinbox to pre-dial the simulated Pot's reset temperature
btn_pot_reset always reset the simulated Pot to the ambient temperature. Add doubleSpinBox_pot_temp next to it (shown/hidden together, same as the button) so the user can dial in a different starting temperature before committing it - it seeds from the same remembered ambient value on startup but is otherwise independent and not persisted. tasks/pot.py's PotTask.recv() now resets the plant to whatever temperature the 'Reset' message carries, falling back to ambient for the bare True a caller might still send.
This commit is contained in:
+14
-1
@@ -375,10 +375,19 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.doubleSpinBox_ambient.setValue(remembered_ambient)
|
||||
self.doubleSpinBox_ambient.blockSignals(False)
|
||||
self.doubleSpinBox_ambient.valueChanged.connect(self.on_ambient_entry_changed)
|
||||
# Pre-dial the Pot reset target at the same starting point btn_pot_
|
||||
# reset used to hardcode (ambient) - purely a one-off starting value
|
||||
# for the user to optionally dial away from before clicking the
|
||||
# button, so unlike the ambient spinbox it's never persisted/synced
|
||||
# again afterwards.
|
||||
if remembered_ambient is not None:
|
||||
self.doubleSpinBox_pot_temp.setValue(remembered_ambient)
|
||||
self.btn_pot_reset.clicked.connect(self.on_action_pot_reset)
|
||||
# Only meaningful (and only shown) once the server confirms its Pot
|
||||
# is simulated - see on_system_changed()'s "PlantSim" handling.
|
||||
self.btn_pot_reset.setVisible(False)
|
||||
self.label_pot_temp.setVisible(False)
|
||||
self.doubleSpinBox_pot_temp.setVisible(False)
|
||||
|
||||
self.send_data = Queue()
|
||||
self.slider_pwr_initial_update = True
|
||||
@@ -509,6 +518,8 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
# showing whatever the user last set rather than blanking it.
|
||||
self.ambient_temp = None
|
||||
self.btn_pot_reset.setVisible(False)
|
||||
self.label_pot_temp.setVisible(False)
|
||||
self.doubleSpinBox_pot_temp.setVisible(False)
|
||||
self.warp_factor = 1.0
|
||||
self.sud_elapsed_seconds = None
|
||||
self.sud_name = ''
|
||||
@@ -554,10 +565,12 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.warp_factor = msg['WarpFactor']
|
||||
elif "PlantSim" in key:
|
||||
self.btn_pot_reset.setVisible(msg['PlantSim'])
|
||||
self.label_pot_temp.setVisible(msg['PlantSim'])
|
||||
self.doubleSpinBox_pot_temp.setVisible(msg['PlantSim'])
|
||||
self.update_status_env_label()
|
||||
|
||||
def on_action_pot_reset(self):
|
||||
self.msg_pot.send({'Reset': True})
|
||||
self.msg_pot.send({'Reset': self.doubleSpinBox_pot_temp.value()})
|
||||
|
||||
def on_ambient_entry_changed(self, value):
|
||||
# Persisted on shutdown instead (see closeEvent()), not on every
|
||||
|
||||
Reference in New Issue
Block a user