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:
+5
-5
@@ -63,7 +63,7 @@ class Sud(AttributeChange):
|
||||
def _parse_data(data):
|
||||
"""Parses a sud.json document into the (name, description, schedule,
|
||||
pot_mass, pot_material) tuple Sud needs. Computed up front rather
|
||||
than assigned straight onto self, so a malformed upload() can't
|
||||
than assigned straight onto self, so a malformed load() can't
|
||||
leave a half-applied schedule in place."""
|
||||
name = data.get('Name', '')
|
||||
description = data.get('Description', '')
|
||||
@@ -78,7 +78,7 @@ class Sud(AttributeChange):
|
||||
|
||||
def _reset_run_state(self):
|
||||
"""Resets run-time progress back to a freshly-loaded, not-yet-started
|
||||
IDLE state. Shared by __init__, upload(), and stop()."""
|
||||
IDLE state. Shared by __init__, load(), and stop()."""
|
||||
self.index = -1
|
||||
self.hold_remaining = 0.0
|
||||
self.state = SudState.IDLE
|
||||
@@ -86,13 +86,13 @@ class Sud(AttributeChange):
|
||||
self.user_message = None
|
||||
self._paused_from = None
|
||||
|
||||
def download(self):
|
||||
def save(self):
|
||||
"""Returns the sud.json document currently on disk, for a client to
|
||||
edit and hand back to upload()."""
|
||||
edit and hand back to load()."""
|
||||
with open(self.path) as f:
|
||||
return json.load(f)
|
||||
|
||||
def upload(self, data):
|
||||
def load(self, data):
|
||||
"""Replaces the schedule with a new sud.json document and persists
|
||||
it to disk, resetting to IDLE as if freshly loaded from that file.
|
||||
Refused while a brew is in progress, or if data is malformed - in
|
||||
|
||||
Reference in New Issue
Block a user