[chirp_devel] [PATCH 2 of 2] Report failure to add a memory to a bank to the user

Dan Smith
Tue Mar 13 17:35:41 PDT 2012


# HG changeset patch
# User Dan Smith <dsmith at danplanet.com>
# Date 1331685304 25200
# Node ID 4df6f2246d71dac29ff00e7f92a080002e0d9394
# Parent  5309412de3ac8705008bd3ea0ed01dc426382c37
Report failure to add a memory to a bank to the user

Rev 2: Make the error dialog transient for the owning window so that
it's modal

diff -r 5309412de3ac -r 4df6f2246d71 chirpui/bankedit.py
--- a/chirpui/bankedit.py	Tue Mar 13 17:35:03 2012 -0700
+++ b/chirpui/bankedit.py	Tue Mar 13 17:35:04 2012 -0700
@@ -177,7 +177,13 @@
             # Step 2: Update our notion of the memory's bank information
             self.refresh_memory(loc)
 
-        def do_bank_index(_null, memory):
+        def do_bank_index(result, memory):
+            if isinstance(result, Exception):
+                common.show_error("Failed to add {mem} to bank: {err}"
+                                  .format(mem=memory.number,
+                                          err=str(result)),
+                                  parent=self.editorset.parent_window)
+                return
             # Step 3: Set the memory's bank index (maybe)
             if not self._rf.has_bank_index or index is None:
                 return do_refresh_memory()
@@ -232,9 +238,10 @@
         job.set_desc(_("Getting memory {num}").format(num=loc))
         self.rthread.submit(job)
             
-    def __init__(self, rthread):
+    def __init__(self, rthread, editorset):
         common.Editor.__init__(self)
         self.rthread = rthread
+        self.editorset = editorset
         self._rf = rthread.radio.get_features()
 
         self._view_cols = [
diff -r 5309412de3ac -r 4df6f2246d71 chirpui/editorset.py
--- a/chirpui/editorset.py	Tue Mar 13 17:35:03 2012 -0700
+++ b/chirpui/editorset.py	Tue Mar 13 17:35:04 2012 -0700
@@ -79,7 +79,7 @@
 
         if rf.has_bank:
             self.editors["bank_members"] = \
-                bankedit.BankMembershipEditor(self.rthread)
+                bankedit.BankMembershipEditor(self.rthread, self)
         
         if rf.has_bank_names:
             self.editors["bank_names"] = bankedit.BankNameEditor(self.rthread)



More information about the chirp_devel mailing list