[chirp_devel] [PATCH] [vx8] Various additional settings - #1807

Dan Smith
Sun Aug 3 19:12:17 PDT 2014


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 538 bytes
Desc: OpenPGP digital signature
Url : http://intrepid.danplanet.com/pipermail/chirp_devel/attachments/20140803/5a1d30c3/attachment-0001.bin 


More information about the chirp_devel mailing list