Fix GUI client references to nested pot params
Update set_step(), status bar mass display, and on_action_sud_new() to read grain_mass/water_mass from step['pot'] and use the new pot key structure when sending an empty Load document. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01T52JH848ojhXXHn1bAzdC3
This commit is contained in:
@@ -330,8 +330,9 @@ class StepPlate(QtWidgets.QFrame):
|
||||
def set_step(self, step, resolved_temp):
|
||||
"""Applies this step's static, schedule-config fields - called once,
|
||||
right after construction (see __init__)."""
|
||||
grain = step.get('grain_mass', 0)
|
||||
water = step.get('water_mass', 0)
|
||||
step_pot = step.get('pot', {})
|
||||
grain = step_pot.get('grain_mass', 0)
|
||||
water = step_pot.get('water_mass', 0)
|
||||
self.label_masses.setText("Grain {:.2f} kg / Water {:.2f} kg".format(grain, water))
|
||||
ramp = step.get('ramp') or {}
|
||||
self.label_rate.setText("Rate {:.2f} °/min".format(ramp.get('rate', 0)))
|
||||
@@ -901,7 +902,7 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
# itself refuses this (like any Load) while a run is in progress,
|
||||
# surfacing an error (see on_sud_changed()'s 'Error' handling)
|
||||
# rather than the GUI trying to guess that here.
|
||||
self.msg_sud.send({'Load': {'Name': '', 'Description': '', 'pot_mass': 0, 'pot_material': None, 'steps': []}})
|
||||
self.msg_sud.send({'Load': {'Name': '', 'Description': '', 'pot': {'mass': 0, 'material': None}, 'steps': []}})
|
||||
|
||||
def on_action_sud_save(self):
|
||||
# Pick the destination up front, on the GUI thread - the actual
|
||||
@@ -1209,7 +1210,8 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
# default.step there (see components/sud.py's _build_step()).
|
||||
if 0 <= self.sud_step_index < len(self.sud_schedule):
|
||||
step = self.sud_schedule[self.sud_step_index]
|
||||
grain, water = step.get('grain_mass', 0), step.get('water_mass', 0)
|
||||
step_pot = step.get('pot', {})
|
||||
grain, water = step_pot.get('grain_mass', 0), step_pot.get('water_mass', 0)
|
||||
else:
|
||||
grain, water = self.sud_grain_mass, self.sud_water_mass
|
||||
elif self.sud_schedule:
|
||||
|
||||
Reference in New Issue
Block a user