[chirp_devel] [PATCH] [th9800] change name/freq display behavior to be automatic #1353

Jens Jensen
Sat Jan 24 10:28:59 PST 2015


# HG changeset patch
# User Jens Jensen <af5mi at yahoo.com>
# Date 1422124105 21600
#      Sat Jan 24 12:28:25 2015 -0600
# Node ID b533ae13e0a964d48851e1148d88ad8564e4538f
# Parent  053d19db989d641e5e0e774652078b91fbbe3fd4
[th9800] change name/freq display behavior to be automatic #1353

Add automatic behavior so that channel name is displayed if it is set, and
freq is show if name is blank. Still allows manual override by user.

diff -r 053d19db989d -r b533ae13e0a9 chirp/th9800.py
--- a/chirp/th9800.py	Sat Jan 24 09:08:10 2015 -0600
+++ b/chirp/th9800.py	Sat Jan 24 12:28:25 2015 -0600
@@ -272,7 +272,7 @@
     mem.dtcs = int(_mem.dtcs)
 
     mem.name = str(_mem.name)
-    mem.name = mem.name.replace("\xFF", " ").rstrip()
+    mem.name = mem.name.rstrip("\xFF")
 
     mem.skip = SCAN_MODES[int(_mem.scan)]
     mem.mode = _mem.am and "AM" or MODES[int(_mem.fmdev)]
@@ -359,6 +359,21 @@
 
     _mem.name = mem.name.ljust(6, "\xFF")
 
+    # autoset display to name if filled, else show frequency
+    if mem.extra:
+        # mem.extra only seems to be populated when called from edit panel
+        display = mem.extra["display"]
+    else:
+        display = None
+    if mem.name:
+        _mem.display = True
+        if display and not display.changed():
+            display.value = "Name"
+    else:
+        _mem.display = False
+        if display and not display.changed():
+            display.value = "Frequency"
+
     _mem.scan = SCAN_MODES.index(mem.skip)
 
     if mem.mode == "AM":
@@ -372,6 +387,8 @@
     _mem.step = STEPS.index(mem.tuning_step)
 
     for setting in mem.extra:
+      if CHIRP_DEBUG:
+          print "@set_mem:", setting.get_name(), setting.value
       setattr(_mem, setting.get_name(), setting.value)
 
   def get_settings(self):



More information about the chirp_devel mailing list