[chirp_devel] [PATCH] BankEditor Displays All Memories

Kosta Arvanitis
Sun Jan 11 01:31:26 PST 2015


# HG changeset patch
# User K. Arvanitis <kosta at alumni.uvic.ca>
# Date 1420442145 28800
#      Sun Jan 04 23:15:45 2015 -0800
# Node ID 9e67e7ba60e0fd2accd89d899735b5040da8032b
# Parent  1d4743ef830641df0e67369d7ff2a3641595b4c3
[BUG] Fix Range Exclusion Issue with Bank Editor

Memory Bounds ranges are specified as inclusive of the first as well as the last; while python 'range' is inclusive of the first and exclusive of the last.

As a result the BankEditor was not including the final memory slot within the devices capable bounds, this fixes the issue and aligns with the behaviour of the MemoryEditor.

Bug #2175

diff -r 1d4743ef8306 -r 9e67e7ba60e0 chirpui/bankedit.py
--- a/chirpui/bankedit.py Wed Dec 17 23:01:11 2014 -0800
+++ b/chirpui/bankedit.py Sun Jan 04 23:15:45 2015 -0800
@@ -335,7 +335,8 @@
         sw.add(self._view)
         self._view.show()
 
-        for i in range(*self._rf.memory_bounds):
+        (min, max) = self._rf.memory_bounds
+        for i in range(min, max+1):
             iter = self._store.append()
             self._store.set(iter,
                             self.C_FILLED, False,
@@ -362,9 +363,6 @@
                 row.append(self.mappings[i][0] in mappings)
                 
             self._store.set(iter, *tuple(row))
-            if memory.number == self._rf.memory_bounds[1] - 1:
-                print "Got all %s info in %s" % (self._type,
-                                                 (time.time() - self._start))
 
         job = MemoryMappingsJob(self._model, got_mem, number)
         job.set_desc(_("Getting {type} information "
@@ -372,8 +370,12 @@
         self.rthread.submit(job)
 
     def refresh_all_memories(self):
-        for i in range(*self._rf.memory_bounds):
+        start = time.time()
+        (min, max) = self._rf.memory_bounds
+        for i in range(min, max+1):
             self.refresh_memory(i)
+        print "Got all %s info in %s" % (self._type, 
+                                        (time.time() - start))
 
     def refresh_mappings(self, and_memories=False):
         def got_mappings():
@@ -397,7 +399,6 @@
         if self._loaded:
             return
 
-        self._start = time.time()
         self.refresh_mappings(True)
 
         self._loaded = True 		 	   		  


More information about the chirp_devel mailing list