Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1deb31f3b3 | ||
|
|
1f3b841dc0 |
+1
-1
@@ -1,4 +1,4 @@
|
||||
"""App > Get with File: a full backup of the connected device's app as one zip.
|
||||
"""App > Get with Files: a full backup of the connected device's app as one zip.
|
||||
|
||||
The zip follows the layout Ontrol's tools read back on a restore:
|
||||
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ so later rebinding would only ever be seen by the module that did it.
|
||||
import configparser
|
||||
import os
|
||||
|
||||
VERSION = "0.0.0.163"
|
||||
VERSION = "0.0.0.164"
|
||||
PROPERTIES_FILE = os.path.join(os.path.dirname(os.path.abspath(__file__)), "editor.properties")
|
||||
DEFAULT_GRID_SIZE = 10
|
||||
DEFAULT_ADD_TIMESTAMP = True
|
||||
|
||||
@@ -632,7 +632,7 @@ _APP_ACTIONS = ["save", "hibernate", "quit", "restart", "reboot"]
|
||||
|
||||
|
||||
def do_get_with_file():
|
||||
"""App > Get with File: backs the device's app up to a zip in <Sedona home>/store/apps.
|
||||
"""App > Get with Files: backs the device's app up to a zip in <Sedona home>/store/apps.
|
||||
|
||||
The app is saved on the device before its app.sab is read, as Ontrol's Niagara
|
||||
driver does, so unsaved changes are announced first and the backup can be called
|
||||
@@ -640,16 +640,16 @@ def do_get_with_file():
|
||||
"""
|
||||
ds = app_state.device_session
|
||||
if not app_state.live_mode or ds is None or not ds.is_connected:
|
||||
messagebox.showinfo("Get with File", "Connect to a device first.")
|
||||
messagebox.showinfo("Get with Files", "Connect to a device first.")
|
||||
return
|
||||
if not app_state.SEDONA_HOME:
|
||||
messagebox.showerror("Get with File", "The Sedona home folder is not set (Preferences).")
|
||||
messagebox.showerror("Get with Files", "The Sedona home folder is not set (Preferences).")
|
||||
return
|
||||
|
||||
if app_state.is_dirty and not messagebox.askokcancel(
|
||||
"Unsaved Changes",
|
||||
"The app has changes that are not saved on the device yet." + NL + NL +
|
||||
"Get with File saves the app on the device first, so they will be saved."):
|
||||
"Get with Files saves the app on the device first, so they will be saved."):
|
||||
return
|
||||
|
||||
path = _ask_backup_path(ds)
|
||||
@@ -658,7 +658,7 @@ def do_get_with_file():
|
||||
|
||||
window = app_state.window
|
||||
dlg = tk.Toplevel(window)
|
||||
dlg.title("Get with File")
|
||||
dlg.title("Get with Files")
|
||||
dlg.resizable(False, False)
|
||||
dlg.transient(window)
|
||||
dlg.protocol("WM_DELETE_WINDOW", lambda: None) # a transfer cannot be stopped midway
|
||||
@@ -685,8 +685,8 @@ def do_get_with_file():
|
||||
dlg.grab_release()
|
||||
dlg.destroy()
|
||||
if error is not None:
|
||||
app_state.set_status(f"Get with File failed: {error}", warn=True)
|
||||
messagebox.showerror("Get with File", f"The backup failed:{NL}{NL}{error}")
|
||||
app_state.set_status(f"Get with Files failed: {error}", warn=True)
|
||||
messagebox.showerror("Get with Files", f"The backup failed:{NL}{NL}{error}")
|
||||
return
|
||||
app_state.mark_clean() # the app was saved on the device first
|
||||
_report_backup(result)
|
||||
@@ -724,7 +724,7 @@ def _ask_backup_path(ds):
|
||||
except OSError:
|
||||
folder = app_state.SEDONA_HOME
|
||||
return filedialog.asksaveasfilename(
|
||||
title="Get with File",
|
||||
title="Get with Files",
|
||||
initialdir=folder,
|
||||
initialfile=app_backup.backup_file_name(device_name, app_name),
|
||||
defaultextension=".zip",
|
||||
@@ -748,7 +748,7 @@ def _report_backup(result):
|
||||
lines += ["", "No source for these in Sedona home's banks; only the device copy is in the zip:"]
|
||||
lines += [f" {name}" for name in result.missing_in_bank]
|
||||
app_state.set_status(f"Got {os.path.basename(result.path)}", warn=warn)
|
||||
(messagebox.showwarning if warn else messagebox.showinfo)("Get with File", NL.join(lines))
|
||||
(messagebox.showwarning if warn else messagebox.showinfo)("Get with Files", NL.join(lines))
|
||||
|
||||
|
||||
NL = chr(10) # newline, for the multi-line message boxes
|
||||
@@ -2652,7 +2652,7 @@ def _on_connected(ds, root_comp):
|
||||
app_state.window.title(app_state.base_window_title_live())
|
||||
menu_device.entryconfig("Disconnect", state="normal")
|
||||
menu_device.entryconfig("Download to SAX...", state="normal")
|
||||
menu_app_info.entryconfig("Get with File...", state="normal")
|
||||
menu_app_info.entryconfig("Get with Files...", state="normal")
|
||||
app_state.set_status(f"Connected to {app_state.device_host}:{app_state.device_port}")
|
||||
|
||||
sax_root = ds.build_dom_tree(root_comp)
|
||||
@@ -2719,7 +2719,7 @@ def do_device_disconnect():
|
||||
menu_device.entryconfig("Discover...", state="normal")
|
||||
menu_device.entryconfig("Disconnect", state="disabled")
|
||||
menu_device.entryconfig("Download to SAX...", state="disabled")
|
||||
menu_app_info.entryconfig("Get with File...", state="disabled")
|
||||
menu_app_info.entryconfig("Get with Files...", state="disabled")
|
||||
app_state.set_status("Disconnected")
|
||||
|
||||
sax_file.reset_to_startup_state()
|
||||
@@ -3007,7 +3007,7 @@ menu_bar.add_cascade(label="Kits", menu=menu_kits)
|
||||
menu_app_info = tk.Menu(menu_bar, tearoff=0)
|
||||
menu_app_info.add_command(label="App Info", command=show_app_info)
|
||||
menu_app_info.add_separator()
|
||||
menu_app_info.add_command(label="Get with File...", command=do_get_with_file, state="disabled")
|
||||
menu_app_info.add_command(label="Get with Files...", command=do_get_with_file, state="disabled")
|
||||
menu_bar.add_cascade(label="App", menu=menu_app_info)
|
||||
|
||||
menu_prefs = tk.Menu(menu_bar, tearoff=0)
|
||||
|
||||
Reference in New Issue
Block a user