Hi Ray!
Thanks for the patch. It's awesome to get a huge chunk of work like this
out of the blue :)
> + def apply_ff_padded_yaesu(cls, setting, obj):
> + # FF pad yaesus custom string format.
> + rawval = setting.value.get_value()
> + max_len = getattr(obj, "padded_yaesu").size() / 8
> + rawval = str(rawval).rstrip()
> + val = [CHARSET.index(x) for x in rawval]
> + for x in range(len(val), max_len):
> + val.append(0xFF)
> + setattr(obj, "padded_yaesu", val)
It looks like this is only used in one place, right? If so, instead of
the getattr/setattr, I think you should just do this:
obj.padded_yaesu = val
> + def apply_lcd_contrast(cls, setting, obj):
> + rawval = setting.value.get_value()
> + val = 0x10 | cls._LCD_CONTRAST.index(rawval) + 1
> + setattr(obj, "lcd_contrast", val)
Ditto for this and most of the others below. The only reason you should
need to use getattr/setattr is if you need to calculate the name of the
attribute, which is done in set_settings() for a couple of situations.
I'm going to go ahead and apply this, but could you follow up with a
patch to convert those to direct attribute syntax like above?
Again, thanks a bunch for this substantial first contribution :)
--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