GUI: show estimated pot/water/grain mass on the step status line
Appends a "Pot: X kg, Water: Y kg, Grain Z kg, total W kg" breakdown to the status bar's step line, using the pot_mass already in the loaded doc (captured from Sud._parse_data(), previously discarded) and the current step's already-resolved grain_mass/water_mass from self.sud_schedule. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DkkuG48uHFCGKe6dPSERFk
This commit is contained in:
+16
-1
@@ -284,6 +284,7 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.sud_elapsed_seconds = None
|
||||
self.sud_name = ''
|
||||
self.sud_schedule = []
|
||||
self.sud_pot_mass = 0
|
||||
self.sud_step_index = None
|
||||
self.sud_step_descr = None
|
||||
self.sud_step_type = None
|
||||
@@ -486,6 +487,7 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
self.sud_elapsed_seconds = None
|
||||
self.sud_name = ''
|
||||
self.sud_schedule = []
|
||||
self.sud_pot_mass = 0
|
||||
self.sud_step_index = None
|
||||
self.sud_step_descr = None
|
||||
self.sud_step_type = None
|
||||
@@ -852,15 +854,28 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
||||
if self.sud_step_type == 'hold':
|
||||
remaining = max(self.sud_hold_remaining, 0.0)
|
||||
text += " ({:.0f}:{:02.0f} remaining)".format(remaining // 60, remaining % 60)
|
||||
# sud_step_index is the same 0-based index Sud.index uses into its
|
||||
# own schedule list (see components/sud.py) - self.sud_schedule is
|
||||
# built from the very same doc, so it lines up directly; grain_mass/
|
||||
# water_mass are already resolved against default.step there (see
|
||||
# components/sud.py's _build_step()).
|
||||
if self.sud_step_index is not None and 0 <= self.sud_step_index < len(self.sud_schedule):
|
||||
step = self.sud_schedule[self.sud_step_index]
|
||||
pot = self.sud_pot_mass
|
||||
water = step.get('water_mass', 0)
|
||||
grain = step.get('grain_mass', 0)
|
||||
text += " Pot: {:.2f} kg, Water: {:.2f} kg, Grain {:.2f} kg, total {:.2f} kg".format(
|
||||
pot, water, grain, pot + water + grain)
|
||||
self.statusBar().showMessage(text)
|
||||
|
||||
def update_sud_forecast(self, doc):
|
||||
try:
|
||||
name, _, schedule, _, _, _, _ = Sud._parse_data(doc)
|
||||
name, _, schedule, pot_mass, _, _, _ = Sud._parse_data(doc)
|
||||
except (KeyError, TypeError):
|
||||
return
|
||||
self.sud_name = name
|
||||
self.sud_schedule = schedule
|
||||
self.sud_pot_mass = pot_mass
|
||||
self.sud_empty = len(schedule) == 0
|
||||
self.update_sud_actions()
|
||||
if self.sud_empty:
|
||||
|
||||
Reference in New Issue
Block a user