gui: append the Sud's description to the window caption
Caption becomes "BrewPi - <name> - <description>" once a schedule with both is loaded, degrading gracefully to just the name, or plain "BrewPi", when either is empty.
This commit is contained in:
+10
-1
@@ -391,6 +391,15 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
ambient = "{:.1f}°C".format(self.ambient_temp) if self.ambient_temp is not None else "-"
|
ambient = "{:.1f}°C".format(self.ambient_temp) if self.ambient_temp is not None else "-"
|
||||||
self.status_label_env.setText("Ambient: {} Warp: {:.1f}x".format(ambient, self.warp_factor))
|
self.status_label_env.setText("Ambient: {} Warp: {:.1f}x".format(ambient, self.warp_factor))
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _make_window_title(name, description):
|
||||||
|
title = "BrewPi"
|
||||||
|
if name:
|
||||||
|
title += " - {}".format(name)
|
||||||
|
if description:
|
||||||
|
title += " - {}".format(description)
|
||||||
|
return title
|
||||||
|
|
||||||
def set_sud_cooling(self, cooling):
|
def set_sud_cooling(self, cooling):
|
||||||
if cooling == self.sud_cooling:
|
if cooling == self.sud_cooling:
|
||||||
return
|
return
|
||||||
@@ -589,7 +598,7 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||||||
self.update_sud_forecast(msg['Json'])
|
self.update_sud_forecast(msg['Json'])
|
||||||
elif "Name" in key:
|
elif "Name" in key:
|
||||||
self.statusBar().showMessage("Sud schedule updated: {}".format(msg['Name']), 5000)
|
self.statusBar().showMessage("Sud schedule updated: {}".format(msg['Name']), 5000)
|
||||||
self.setWindowTitle("BrewPi - {}".format(msg['Name']) if msg['Name'] else "BrewPi")
|
self.setWindowTitle(self._make_window_title(msg.get('Name', ''), msg.get('Description', '')))
|
||||||
elif "State" in key:
|
elif "State" in key:
|
||||||
prev_state = self.sud_state
|
prev_state = self.sud_state
|
||||||
self.sud_state = msg['State']
|
self.sud_state = msg['State']
|
||||||
|
|||||||
Reference in New Issue
Block a user