Rename App > Get with File to Get with Files
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+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:
|
The zip follows the layout Ontrol's tools read back on a restore:
|
||||||
|
|
||||||
|
|||||||
@@ -632,7 +632,7 @@ _APP_ACTIONS = ["save", "hibernate", "quit", "restart", "reboot"]
|
|||||||
|
|
||||||
|
|
||||||
def do_get_with_file():
|
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
|
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
|
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
|
ds = app_state.device_session
|
||||||
if not app_state.live_mode or ds is None or not ds.is_connected:
|
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
|
return
|
||||||
if not app_state.SEDONA_HOME:
|
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
|
return
|
||||||
|
|
||||||
if app_state.is_dirty and not messagebox.askokcancel(
|
if app_state.is_dirty and not messagebox.askokcancel(
|
||||||
"Unsaved Changes",
|
"Unsaved Changes",
|
||||||
"The app has changes that are not saved on the device yet." + NL + NL +
|
"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
|
return
|
||||||
|
|
||||||
path = _ask_backup_path(ds)
|
path = _ask_backup_path(ds)
|
||||||
@@ -658,7 +658,7 @@ def do_get_with_file():
|
|||||||
|
|
||||||
window = app_state.window
|
window = app_state.window
|
||||||
dlg = tk.Toplevel(window)
|
dlg = tk.Toplevel(window)
|
||||||
dlg.title("Get with File")
|
dlg.title("Get with Files")
|
||||||
dlg.resizable(False, False)
|
dlg.resizable(False, False)
|
||||||
dlg.transient(window)
|
dlg.transient(window)
|
||||||
dlg.protocol("WM_DELETE_WINDOW", lambda: None) # a transfer cannot be stopped midway
|
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.grab_release()
|
||||||
dlg.destroy()
|
dlg.destroy()
|
||||||
if error is not None:
|
if error is not None:
|
||||||
app_state.set_status(f"Get with File failed: {error}", warn=True)
|
app_state.set_status(f"Get with Files failed: {error}", warn=True)
|
||||||
messagebox.showerror("Get with File", f"The backup failed:{NL}{NL}{error}")
|
messagebox.showerror("Get with Files", f"The backup failed:{NL}{NL}{error}")
|
||||||
return
|
return
|
||||||
app_state.mark_clean() # the app was saved on the device first
|
app_state.mark_clean() # the app was saved on the device first
|
||||||
_report_backup(result)
|
_report_backup(result)
|
||||||
@@ -724,7 +724,7 @@ def _ask_backup_path(ds):
|
|||||||
except OSError:
|
except OSError:
|
||||||
folder = app_state.SEDONA_HOME
|
folder = app_state.SEDONA_HOME
|
||||||
return filedialog.asksaveasfilename(
|
return filedialog.asksaveasfilename(
|
||||||
title="Get with File",
|
title="Get with Files",
|
||||||
initialdir=folder,
|
initialdir=folder,
|
||||||
initialfile=app_backup.backup_file_name(device_name, app_name),
|
initialfile=app_backup.backup_file_name(device_name, app_name),
|
||||||
defaultextension=".zip",
|
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 += ["", "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]
|
lines += [f" {name}" for name in result.missing_in_bank]
|
||||||
app_state.set_status(f"Got {os.path.basename(result.path)}", warn=warn)
|
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
|
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())
|
app_state.window.title(app_state.base_window_title_live())
|
||||||
menu_device.entryconfig("Disconnect", state="normal")
|
menu_device.entryconfig("Disconnect", state="normal")
|
||||||
menu_device.entryconfig("Download to SAX...", 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}")
|
app_state.set_status(f"Connected to {app_state.device_host}:{app_state.device_port}")
|
||||||
|
|
||||||
sax_root = ds.build_dom_tree(root_comp)
|
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("Discover...", state="normal")
|
||||||
menu_device.entryconfig("Disconnect", state="disabled")
|
menu_device.entryconfig("Disconnect", state="disabled")
|
||||||
menu_device.entryconfig("Download to SAX...", 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")
|
app_state.set_status("Disconnected")
|
||||||
|
|
||||||
sax_file.reset_to_startup_state()
|
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 = tk.Menu(menu_bar, tearoff=0)
|
||||||
menu_app_info.add_command(label="App Info", command=show_app_info)
|
menu_app_info.add_command(label="App Info", command=show_app_info)
|
||||||
menu_app_info.add_separator()
|
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_bar.add_cascade(label="App", menu=menu_app_info)
|
||||||
|
|
||||||
menu_prefs = tk.Menu(menu_bar, tearoff=0)
|
menu_prefs = tk.Menu(menu_bar, tearoff=0)
|
||||||
|
|||||||
Reference in New Issue
Block a user