10 Sep
2013
10 Sep
'13
5:08 a.m.
rs = RadioSetting("test.vhfsquelch0", "VHF Squelch 0",
RadioSettingValueInteger(0,255,
self._memobj.test.vhfsquelch0))
testmode.append(rs)
Hmm, this introduces a lot of redundant code. What would you think about trying to make it a little more automatic?
for band in ["vhf", "uhf"]: for index in range(0, 10): key = "test.%ssquelch%i" % (band, index) name = "%s Squelch %i" % (band.upper(), index) rs = RadioSetting(key, name, RadioSettingInteger(0, 255, getattr(self._memobj.test, "%ssquelch%i" % (band, index))
(Note that this is untested, just off the top of my head)
You could do this for squelch and power and save a bunch of lines of copied code in this patch.
What do you think?
--
Dan Smith
www.danplanet.com
KK7DS