[chirp_devel] [PATCH] [th9800] change name/freq display behavior to be automatic #1353
# HG changeset patch # User Jens Jensen af5mi@yahoo.com # Date 1422537841 21600 # Thu Jan 29 07:24:01 2015 -0600 # Node ID f1e77e243ab445a8d0e0b44f6d76fde39c2c180c # Parent ebeb7fdb70a7b00b5424394b0a7731b379ea997b [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 ebeb7fdb70a7 -r f1e77e243ab4 chirp/th9800.py --- a/chirp/th9800.py Sun Jan 25 08:38:55 2015 -0600 +++ b/chirp/th9800.py Thu Jan 29 07:24:01 2015 -0600 @@ -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):
- if mem.extra:
# mem.extra only seems to be populated when called from edit panel
display = mem.extra["display"]
Isn't mem.extra an array (not a dict)? I think it's not set on a normal edit from the main editor because of the way it reconstructs the memory objects.
--Dan
just checked that during set_memory(): 1. as previously mentioned, mem.extra is empty list when called from from main edit table view. type(mem.extra) = <type 'list'> and print mem.extra is "[]" 2. when it is called through edit panel: type(mem.extra) is <class 'chirp.settings.RadioSettingGroup'> type(mem.extra["display"]) is <class 'chirp.settings.RadioSetting'>print mem.extra["display"] yields display:Frequency. I assume RadioSetting and RadioSettingsGroup classes here are overriding various methods to get type coercion. When I tested it, it appears to be doing what is expected.mem.extra being empty list when called from main edit table is not expected behavior, but I think my logic is accommodating that. From: Dan Smith dsmith@danplanet.com To: chirp_devel@intrepid.danplanet.com Sent: Saturday, January 31, 2015 10:16 AM Subject: Re: [chirp_devel] [PATCH] [th9800] change name/freq display behavior to be automatic #1353
+ if mem.extra: + # mem.extra only seems to be populated when called from edit panel + display = mem.extra["display"]
Isn't mem.extra an array (not a dict)? I think it's not set on a normal edit from the main editor because of the way it reconstructs the memory objects.
--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
- as previously mentioned, mem.extra is empty list when called from
from main edit table view. type(mem.extra) = <type 'list'> and print mem.extra is "[]"
Right, right, sorry :)
but I think my logic is accommodating that.
It is, but I don't understand why it's needed. For example:
http://chirp.danplanet.com/projects/chirp/repository/entry/chirp/uv5r.py#L91...
Anyway, I've applied it.
--Dan
participants (2)
-
Dan Smith
-
Jens Jensen