Rename Sud's Download/Upload to Save/Load throughout

Renames everywhere the concept appears: Sud.download()/upload() ->
save()/load(), the 'Download'/'Upload' websocket messages ->
'Save'/'Load', the brewpi_gui menu actions, handlers and
sud_download_path -> sud_save_path, and the demo script. Behavior is
unchanged - this is naming only, from the client's perspective (save
to / load from a local file) rather than the server's.
This commit is contained in:
2026-06-20 23:58:21 +02:00
parent 5d884ca3da
commit 13e507e2b5
6 changed files with 51 additions and 51 deletions
+15 -15
View File
@@ -209,8 +209,8 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
self.actionStart.triggered.connect(self.on_action_sud_start)
self.actionPause.triggered.connect(self.on_action_sud_pause)
self.actionStop.triggered.connect(self.on_action_sud_stop)
self.actionSudDownload.triggered.connect(self.on_action_sud_download)
self.actionSudUpload.triggered.connect(self.on_action_sud_upload)
self.actionSudSave.triggered.connect(self.on_action_sud_save)
self.actionSudLoad.triggered.connect(self.on_action_sud_load)
self.Slider_pwr_soll.valueChanged.connect(self.on_slider_pwr_soll_changed)
self.Slider_temp_soll.valueChanged.connect(self.on_slider_temp_soll_changed)
self.Slider_speed_soll.valueChanged.connect(self.on_slider_stirrer_speed_soll_changed)
@@ -227,7 +227,7 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
self.checkbox_heater_activate_initial_update = True
self.checkbox_stirrer_activate_initial_update = True
self.heatrate_soll_initial_update = True
self.sud_download_path = None
self.sud_save_path = None
# Latest values sampled by the plot timer - written from the
# websocket recv thread, read from the GUI thread; plain floats so
@@ -263,10 +263,10 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
self.plot.reset()
self.ws_client.connect(uri=self.plainTextUri.toPlainText())
# Fetch the schedule for the Automatic tab's forecast preview - not
# a user-initiated download, so sud_download_path stays None and
# a user-initiated save, so sud_save_path stays None and
# on_sud_changed() routes the reply to update_sud_forecast() instead
# of a save dialog.
self.msg_sud.send({'Download': True})
self.msg_sud.send({'Save': True})
def on_plot_timer(self):
self.plot.sample(
@@ -352,23 +352,23 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
def on_action_sud_stop(self):
self.msg_sud.send({'Stop': True})
def on_action_sud_download(self):
def on_action_sud_save(self):
# Pick the destination up front, on the GUI thread - the actual
# write happens in on_sud_changed(), which runs off a worker thread
# and must not touch Qt (e.g. open a file dialog) itself.
path, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Download Sud", filter="JSON files (*.json)")
path, _ = QtWidgets.QFileDialog.getSaveFileName(self, "Save Sud", filter="JSON files (*.json)")
if not path:
return
self.sud_download_path = path
self.msg_sud.send({'Download': True})
self.sud_save_path = path
self.msg_sud.send({'Save': True})
def on_action_sud_upload(self):
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Upload Sud", filter="JSON files (*.json)")
def on_action_sud_load(self):
path, _ = QtWidgets.QFileDialog.getOpenFileName(self, "Load Sud", filter="JSON files (*.json)")
if not path:
return
with open(path) as f:
data = json.load(f)
self.msg_sud.send({'Upload': data})
self.msg_sud.send({'Load': data})
def on_pot_changed(self, msg):
print("on_pot_changed {}".format(msg))
@@ -458,10 +458,10 @@ class Window(QtWidgets.QMainWindow, Ui_MainWindow):
self.sud_loaded = True
for key in msg:
if "Json" in key:
if self.sud_download_path:
with open(self.sud_download_path, 'w') as f:
if self.sud_save_path:
with open(self.sud_save_path, 'w') as f:
json.dump(msg['Json'], f, indent='\t')
self.sud_download_path = None
self.sud_save_path = None
else:
self.update_sud_forecast(msg['Json'])
elif "Name" in key: