On Tue, Sep 10, 2013 at 8:08 AM, Dan Smith dsmith@danplanet.com wrote:
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?
Actually, I woke up in the middle of the night last night thinking I could
have done this better.
Do you just reject what I submitted so I can just resubmit it after reworking it?
Jim