[chirp_devel] [PATCH 1 of 2] Add bool cast and improve charset options in settings. For #2095
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1417908731 28800 # Sat Dec 06 15:32:11 2014 -0800 # Node ID 9d504f2619b345da0735dbbb34cf9f8d02c3c17b # Parent d10199843d9fcd169738dffbe028cc56feef40e7 Add bool cast and improve charset options in settings. For #2095
Previously, tests could not be done on RadioSettingValueBoolean values. This patch adds bool casting / test support so that checked boxes test True and unchecked boxes test False.
RadioSettingValueString supported setting the charset, but only after initializing the value. This fails if the value contains characters not in the default charset. With this patch, the charset can be set during initialization, so when the value is set, it is tested against the appropriate charset.
diff -r d10199843d9f -r 9d504f2619b3 chirp/settings.py --- a/chirp/settings.py Sat Dec 06 15:31:47 2014 -0800 +++ b/chirp/settings.py Sat Dec 06 15:32:11 2014 -0800 @@ -143,6 +143,10 @@ def set_value(self, value): RadioSettingValue.set_value(self, bool(value))
+ def __bool__(self): + return bool(self.get_value()) + __nonzero__ = __bool__ + def __str__(self): return str(bool(self.get_value()))
@@ -168,11 +172,11 @@ class RadioSettingValueString(RadioSettingValue): """A string setting""" def __init__(self, minlength, maxlength, current, - autopad=True): + autopad=True, charset=chirp_common.CHARSET_ASCII): RadioSettingValue.__init__(self) self._minlength = minlength self._maxlength = maxlength - self._charset = chirp_common.CHARSET_ASCII + self._charset = charset self._autopad = autopad self.set_value(current)
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1417908900 28800 # Sat Dec 06 15:35:00 2014 -0800 # Node ID bef27f3c38d73f4784f004f78a460b837b3afddc # Parent 9d504f2619b345da0735dbbb34cf9f8d02c3c17b Add support for Sainsonic AP510 APRS tracker. #2095
The Sainsonic AP510 is an integrated single-channel VHF radio and APRS tracker. This patch adds support for configuring all of the parameters of the AP510 (one channel and lots of settings).
participants (1)
-
Tom Hayward