[chirp_devel] [PATCH] [th9800] change name/freq display behavior to be automatic #1353
# HG changeset patch # User Jens Jensen af5mi@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):
Ok, resubmitted patch. From: Dan Smith dsmith@danplanet.com To: chirp_devel@intrepid.danplanet.com Sent: Wednesday, January 28, 2015 7:43 PM Subject: Re: [chirp_devel] [PATCH] [th9800] change name/freq display behavior to be automatic #1353
- mem.name = mem.name.replace("\xFF", " ").rstrip() + mem.name = mem.name.rstrip("\xFF")
Won't this fail to do the right thing now if I put trailing spaces on my name? If we put a space in the list with \xFF then we'd be safe I think, right?
--Dan
_______________________________________________ chirp_devel mailing list chirp_devel@intrepid.danplanet.com http://intrepid.danplanet.com/mailman/listinfo/chirp_devel Developer docs: http://chirp.danplanet.com/projects/chirp/wiki/Developers
participants (2)
-
Dan Smith
-
Jens Jensen