<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'># HG changeset patch<br># User K. Arvanitis <<a href="mailto:kosta@alumni.uvic.ca">kosta@alumni.uvic.ca</a>><br># Date 1422941391 28800<br># Mon Feb 02 21:29:51 2015 -0800<br># Node ID e8378ba8777941cff2f0b4717355d476e224b43c<br># Parent 5a17f1c24b38875fe8ef83b6a3fe6b61f11c07af<br>[PATCH] Radio settings flattened view<BR>Due to the nested nature of the settings editor tree view, labels in the<br>tree generally become obscured because the pane is too small.<BR>This change addresses the issue by a) adding a horizontal paned window<br>which allows the tree view to be manually resized while b) flattening<br>the radio featrure radio settings group to return a single list of<br>all top level radio settings groups.<BR><br>Bug #2285<BR>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/alinco.py<br>--- a/chirp/alinco.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/alinco.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -14,8 +14,7 @@<br> # along with this program. If not, see <<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>>.<br> <br> from chirp import chirp_common, bitwise, memmap, errors, directory, util<br>-from chirp.settings import RadioSettingGroup, RadioSetting<br>-from chirp.settings import RadioSettingValueBoolean<br>+from chirp.settings import *<br> <br> import time<br> <br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/anytone.py<br>--- a/chirp/anytone.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/anytone.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -23,8 +23,7 @@<br> from chirp import errors<br> from chirp import memmap<br> from chirp import util<br>-from chirp.settings import RadioSettingGroup, RadioSetting, \<br>- RadioSettingValueList, RadioSettingValueString, RadioSettingValueBoolean<br>+from chirp.settings import *<br> <br> _mem_format = """<br> #seekto 0x0100;<br>@@ -475,19 +474,20 @@<br> <br> def get_settings(self):<br> _settings = self._memobj.settings<br>- settings = RadioSettingGroup('all', 'All Settings')<br>+ basic = RadioSettingGroup("basic", "Basic")<br>+ settings = RadioSettings(basic)<br> <br> display = ["Frequency", "Channel", "Name"]<br> rs = RadioSetting("display", "Display",<br> RadioSettingValueList(display,<br> display[_settings.display]))<br>- settings.append(rs)<br>+ basic.append(rs)<br> <br> apo = ["Off"] + ['%.1f hour(s)' % (0.5 * x) for x in range(1, 25)]<br> rs = RadioSetting("apo", "Automatic Power Off",<br> RadioSettingValueList(apo,<br> apo[_settings.apo]))<br>- settings.append(rs)<br>+ basic.append(rs)<br> <br> def filter(s):<br> s_ = ""<br>@@ -499,23 +499,26 @@<br> rs = RadioSetting("welcome", "Welcome Message",<br> RadioSettingValueString(0, 8,<br> filter(_settings.welcome)))<br>- settings.append(rs)<br>+ basic.append(rs)<br> <br> rs = RadioSetting("beep", "Beep Enabled",<br> RadioSettingValueBoolean(_settings.beep))<br>- settings.append(rs)<br>+ basic.append(rs)<br> <br> mute = ["Off", "TX", "RX", "TX/RX"]<br> rs = RadioSetting("mute", "Sub Band Mute",<br> RadioSettingValueList(mute,<br> mute[_settings.mute]))<br>- settings.append(rs)<br>+ basic.append(rs)<br> <br> return settings<br> <br> def set_settings(self, settings):<br> _settings = self._memobj.settings<br> for element in settings:<br>+ if not isinstance(element, RadioSetting):<br>+ self.set_settings(element)<br>+ continue<br> name = element.get_name()<br> setattr(_settings, name, element.value)<br> <br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/ap510.py<br>--- a/chirp/ap510.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/ap510.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -15,10 +15,7 @@<br> <br> import struct<br> from chirp import chirp_common, directory, errors, util<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString, \<br>- RadioSettingValueFloat, RadioSettingValue, InvalidValueError<br>+from chirp.settings import *<br> <br> <br> def encode_base100(v):<br>@@ -313,7 +310,7 @@<br> aprs = RadioSettingGroup("aprs", "APRS", china, smartbeacon)<br> digipeat = RadioSettingGroup("digipeat", "Digipeat")<br> system = RadioSettingGroup("system", "System")<br>- settings = RadioSettingGroup("all", "Settings", aprs, digipeat, system)<br>+ settings = RadioSettings(aprs, digipeat, system)<br> <br> # The RadioSetting syntax is really verbose, iterate it.<br> fields = [<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/baofeng_uv3r.py<br>--- a/chirp/baofeng_uv3r.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/baofeng_uv3r.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -19,10 +19,7 @@<br> import os<br> from chirp import util, chirp_common, bitwise, errors, directory<br> from chirp.wouxun_common import do_download, do_upload<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueBoolean, RadioSettingValueList, \<br>- RadioSettingValueInteger, RadioSettingValueString, \<br>- RadioSettingValueFloat<br>+from chirp.settings import *<br> <br> if os.getenv("CHIRP_DEBUG"):<br> DEBUG = True<br>@@ -357,7 +354,7 @@<br> _settings = self._memobj.settings<br> _vfo = self._memobj.vfo<br> basic = RadioSettingGroup("basic", "Basic Settings")<br>- group = RadioSettingGroup("top", "All Settings", basic)<br>+ group = RadioSettings(basic)<br> <br> rs = RadioSetting("squelch", "Squelch Level",<br> RadioSettingValueInteger(0, 9, _settings.squelch))<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/bjuv55.py<br>--- a/chirp/bjuv55.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/bjuv55.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -21,10 +21,7 @@<br> <br> from chirp import chirp_common, errors, util, directory, memmap<br> from chirp import bitwise<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString, \<br>- RadioSettingValueFloat, InvalidValueError<br>+from chirp.settings import *<br> from textwrap import dedent<br> from chirp import uv5r<br> <br>@@ -270,7 +267,7 @@<br> _settings = self._memobj.settings<br> basic = RadioSettingGroup("basic", "Basic Settings")<br> advanced = RadioSettingGroup("advanced", "Advanced Settings")<br>- group = RadioSettingGroup("top", "All Settings", basic, advanced)<br>+ group = RadioSettings(basic, advanced)<br> <br> rs = RadioSetting("squelch", "Carrier Squelch Level",<br> RadioSettingValueInteger(0, 9, _settings.squelch))<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/chirp_common.py<br>--- a/chirp/chirp_common.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/chirp_common.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -248,7 +248,7 @@<br> <br> immutable = []<br> <br>- # A RadioSettingsGroup of additional settings supported by the radio,<br>+ # A RadioSettingGroup of additional settings supported by the radio,<br> # or an empty list if none<br> extra = []<br> <br>@@ -1027,7 +1027,7 @@<br> return rf.validate_memory(mem)<br> <br> def get_settings(self):<br>- """Returns a RadioSettingGroup containing one or more<br>+ """Returns a RadioSettings list containing one or more<br> RadioSettingGroup or RadioSetting objects. These represent general<br> setting knobs and dials that can be adjusted on the radio. If this<br> function is implemented, the has_settings RadioFeatures flag should<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/ft1802.py<br>--- a/chirp/ft1802.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/ft1802.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -24,8 +24,7 @@<br> # 5. In Chirp, choose Upload to Radio.<br> <br> from chirp import chirp_common, bitwise, directory, yaesu_clone<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueBoolean<br>+from chirp.settings import *<br> from textwrap import dedent<br> <br> MEM_FORMAT = """<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/ft1d.py<br>--- a/chirp/ft1d.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/ft1d.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -20,9 +20,7 @@<br> <br> from chirp import chirp_common, yaesu_clone, directory<br> from chirp import bitwise<br>-from chirp.settings import RadioSettingGroup, RadioSetting<br>-from chirp.settings import RadioSettingValueInteger, RadioSettingValueString<br>-from chirp.settings import RadioSettingValueList, RadioSettingValueBoolean<br>+from chirp.settings import *<br> from textwrap import dedent<br> <br> MEM_FORMAT = """<br>@@ -1458,16 +1456,15 @@<br> return menu<br> <br> def _get_settings(self):<br>- top = RadioSettingGroup("all", "All Settings",<br>- self._get_aprs_general_settings(),<br>- self._get_aprs_rx_settings(),<br>- self._get_aprs_tx_settings(),<br>- self._get_aprs_smartbeacon(),<br>- self._get_aprs_msgs(),<br>- self._get_aprs_beacons(),<br>- self._get_dtmf_settings(),<br>- self._get_misc_settings(),<br>- self._get_scan_settings())<br>+ top = RadioSettings(self._get_aprs_general_settings(),<br>+ self._get_aprs_rx_settings(),<br>+ self._get_aprs_tx_settings(),<br>+ self._get_aprs_smartbeacon(),<br>+ self._get_aprs_msgs(),<br>+ self._get_aprs_beacons(),<br>+ self._get_dtmf_settings(),<br>+ self._get_misc_settings(),<br>+ self._get_scan_settings())<br> return top<br> <br> def get_settings(self):<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/ft60.py<br>--- a/chirp/ft60.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/ft60.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -16,10 +16,7 @@<br> import time, os<br> from chirp import chirp_common, yaesu_clone, memmap, bitwise, directory<br> from chirp import errors<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString, \<br>- RadioSettingValueFloat<br>+from chirp.settings import *<br> from textwrap import dedent<br> <br> ACK = "\x06"<br>@@ -400,8 +397,7 @@<br> misc = RadioSettingGroup("misc", "Miscellaneous Settings")<br> mbls = RadioSettingGroup("banks", "Memory Bank Link Scan")<br> <br>- setmode = RadioSettingGroup("top", "Set Mode",<br>- repeater, ctcss, arts, scan, power, wires, eai, switch, misc, mbls)<br>+ setmode = RadioSettings(repeater, ctcss, arts, scan, power, wires, eai, switch, misc, mbls)<br> <br> # APO<br> opts = [ "OFF" ] + [ "%0.1f" % (x * 0.5) for x in range(1, 24+1) ]<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/ft7800.py<br>--- a/chirp/ft7800.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/ft7800.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -17,9 +17,7 @@<br> from chirp import chirp_common, yaesu_clone, memmap, directory<br> from chirp import bitwise, errors<br> from textwrap import dedent<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString<br>+from chirp.settings import *<br> import os, re<br> <br> from collections import defaultdict<br>@@ -568,8 +566,8 @@<br> dtmf = RadioSettingGroup("dtmf", "DTMF")<br> arts = RadioSettingGroup("arts", "ARTS")<br> prog = RadioSettingGroup("prog", "Programmable Buttons")<br>- top = RadioSettingGroup("top", "All Settings",<br>- basic, dtmf, arts, prog)<br>+<br>+ top = RadioSettings(basic, dtmf, arts, prog)<br> <br> basic.append( RadioSetting("priority_revert", "Priority Revert",<br> RadioSettingValueBoolean(_settings.priority_revert)))<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/ft817.py<br>--- a/chirp/ft817.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/ft817.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -18,9 +18,7 @@<br> <br> from chirp import chirp_common, yaesu_clone, util, memmap, errors, directory<br> from chirp import bitwise<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString<br>+from chirp.settings import *<br> import time, os<br> from textwrap import dedent<br> <br>@@ -763,7 +761,8 @@<br> extended = RadioSettingGroup("extended", "Extended")<br> antenna = RadioSettingGroup("antenna", "Antenna selection")<br> panelcontr = RadioSettingGroup("panelcontr", "Panel controls")<br>- top = RadioSettingGroup("top", "All Settings", basic, cw, packet,<br>+<br>+ top = RadioSettings(basic, cw, packet,<br> panelcontr, panel, extended, antenna)<br> <br> rs = RadioSetting("ars_144", "144 ARS",<br>@@ -1136,7 +1135,7 @@<br> <br> def get_settings(self):<br> top = FT817Radio.get_settings(self)<br>- basic = top["basic"]<br>+ basic = top[0]<br> rs = RadioSetting("emergency", "Emergency",<br> RadioSettingValueBoolean(self._memobj.settings.emergency))<br> basic.append(rs)<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/ft857.py<br>--- a/chirp/ft857.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/ft857.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -17,9 +17,7 @@<br> """FT857 - FT857/US management module"""<br> <br> from chirp import ft817, chirp_common, errors, directory<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString<br>+from chirp.settings import *<br> import os<br> from textwrap import dedent<br> <br>@@ -525,7 +523,8 @@<br> panel = RadioSettingGroup("panel", "Panel settings")<br> extended = RadioSettingGroup("extended", "Extended")<br> panelcontr = RadioSettingGroup("panelcontr", "Panel controls")<br>- top = RadioSettingGroup("top", "All Settings", basic, cw, packet,<br>+<br>+ top = RadioSettings(basic, cw, packet,<br> panelcontr, panel, extended)<br> <br> rs = RadioSetting("extended_menu", "Extended menu",<br>@@ -1073,7 +1072,7 @@<br> <br> def get_settings(self):<br> top = FT857Radio.get_settings(self)<br>- basic = top["basic"]<br>+ basic = top[0]<br> rs = RadioSetting("emergency", "Emergency",<br> RadioSettingValueBoolean(self._memobj.settings.emergency))<br> basic.append(rs)<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/ft90.py<br>--- a/chirp/ft90.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/ft90.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -15,9 +15,7 @@<br> # along with this program. If not, see <<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>>.<br> <br> from chirp import chirp_common, bitwise, memmap, directory, errors, util, yaesu_clone<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString<br>+from chirp.settings import *<br> import time, os, traceback, string, re<br> from textwrap import dedent<br> <br>@@ -509,7 +507,8 @@<br> basic = RadioSettingGroup("basic", "Basic")<br> autodial = RadioSettingGroup("autodial", "AutoDial")<br> keymaps = RadioSettingGroup("keymaps", "KeyMaps")<br>- top = RadioSettingGroup("top", "All Settings", basic, keymaps, autodial)<br>+ <br>+ top = RadioSettings(basic, keymaps, autodial)<br> <br> rs = RadioSetting("beep", "Beep",<br> RadioSettingValueBoolean(_settings.beep))<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/ftm350.py<br>--- a/chirp/ftm350.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/ftm350.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -19,8 +19,7 @@<br> <br> from chirp import chirp_common, yaesu_clone, directory, errors, util<br> from chirp import bitwise, memmap<br>-from chirp.settings import RadioSettingGroup, RadioSetting<br>-from chirp.settings import RadioSettingValueInteger, RadioSettingValueString<br>+from chirp.settings import *<br> <br> mem_format = """<br> struct mem {<br>@@ -380,7 +379,7 @@<br> return filedata.startswith("AH033$")<br> <br> def get_settings(self):<br>- top = RadioSettingGroup("all", "All Settings")<br>+ top = RadioSettings()<br> <br> aprs = RadioSettingGroup("aprs", "APRS")<br> top.append(aprs)<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/h777.py<br>--- a/chirp/h777.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/h777.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -21,9 +21,7 @@<br> <br> from chirp import chirp_common, directory, memmap<br> from chirp import bitwise, errors, util<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean<br>+from chirp.settings import *<br> <br> DEBUG = os.getenv("CHIRP_DEBUG") and True or False<br> <br>@@ -392,6 +390,7 @@<br> def get_settings(self):<br> _settings = self._memobj.settings<br> basic = RadioSettingGroup("basic", "Basic Settings")<br>+ top = RadioSettings(basic)<br> <br> # TODO: Check that all these settings actually do what they<br> # say they do.<br>@@ -472,7 +471,7 @@<br> self._memobj.settings2.timeouttimer]))<br> basic.append(rs)<br> <br>- return basic<br>+ return top<br> <br> def set_settings(self, settings):<br> for element in settings:<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/ic2100.py<br>--- a/chirp/ic2100.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/ic2100.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -15,10 +15,7 @@<br> <br> from chirp import chirp_common, icf, util, directory<br> from chirp import bitwise, memmap<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString, \<br>- RadioSettingValueFloat, InvalidValueError<br>+from chirp.settings import *<br> <br> MEM_FORMAT = """<br> struct {<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/icf.py<br>--- a/chirp/icf.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/icf.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -18,8 +18,7 @@<br> import time<br> <br> from chirp import chirp_common, errors, util, memmap<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueBoolean<br>+from chirp.settings import *<br> <br> CMD_CLONE_OUT = 0xE2<br> CMD_CLONE_IN = 0xE3<br>@@ -640,17 +639,18 @@<br> <br> def make_speed_switch_setting(radio):<br> if not radio.__class__._can_hispeed:<br>- return []<br>+ return {}<br> drvopts = RadioSettingGroup("drvopts", "Driver Options")<br>+ top = RadioSettings(drvopts)<br> rs = RadioSetting("drv_clone_speed", "Use Hi-Speed Clone",<br> RadioSettingValueBoolean(radio._can_hispeed))<br> drvopts.append(rs)<br>- return drvopts<br>+ return top<br> <br> def honor_speed_switch_setting(radio, settings):<br> for element in settings:<br> if element.get_name() == "drvopts":<br>- return honor_speed_switch_setting(radio, settings)<br>+ return honor_speed_switch_setting(radio, element)<br> if element.get_name() == "drv_clone_speed":<br> radio.__class__._can_hispeed = element.value.get_value()<br> return<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/icq7.py<br>--- a/chirp/icq7.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/icq7.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -17,10 +17,7 @@<br> from chirp import chirp_common, icf, directory<br> from chirp import bitwise<br> from chirp.chirp_common import to_GHz, from_GHz<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueBoolean, RadioSettingValueList, \<br>- RadioSettingValueInteger, RadioSettingValueString, \<br>- RadioSettingValueFloat<br>+from chirp.settings import *<br> <br> MEM_FORMAT = """<br> struct {<br>@@ -198,7 +195,7 @@<br> def get_settings(self):<br> _settings = self._memobj.settings<br> basic = RadioSettingGroup("basic", "Basic Settings")<br>- group = RadioSettingGroup("top", "All Settings", basic)<br>+ group = RadioSettings(basic)<br> <br> rs = RadioSetting("ch", "Channel Indication Mode",<br> RadioSettingValueBoolean(_settings.ch))<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/kenwood_live.py<br>--- a/chirp/kenwood_live.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/kenwood_live.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -25,9 +25,7 @@<br> sys.path.insert(0, "..")<br> <br> from chirp import chirp_common, errors, directory, util<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueBoolean, \<br>- RadioSettingValueString, RadioSettingValueList<br>+from chirp.settings import *<br> <br> DEBUG = True<br> <br>@@ -392,7 +390,8 @@<br> aux, tnc, save, display, dtmf)<br> sky = RadioSettingGroup("sky", "SkyCommand")<br> aprs = RadioSettingGroup("aprs", "APRS")<br>- top = RadioSettingGroup("top", "All Settings", radio, aprs, sky)<br>+ <br>+ top = RadioSettings(radio, aprs, sky)<br> <br> bools = [("AMR", aprs, "APRS Message Auto-Reply"),<br> ("AIP", aux, "Advanced Intercept Point"),<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/kguv8d.py<br>--- a/chirp/kguv8d.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/kguv8d.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -18,9 +18,7 @@<br> import time<br> import os<br> from chirp import util, chirp_common, bitwise, memmap, errors, directory<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueBoolean, RadioSettingValueList, \<br>- RadioSettingValueInteger, RadioSettingValueString<br>+from chirp.settings import *<br> <br> if os.getenv("CHIRP_DEBUG"):<br> CHIRP_DEBUG = True<br>@@ -677,7 +675,8 @@<br> cal_grp = RadioSettingGroup("cal_grp", "Call Group")<br> lmt_grp = RadioSettingGroup("lmt_grp", "Frequency Limits")<br> oem_grp = RadioSettingGroup("oem_grp", "OEM Info")<br>- group = RadioSettingGroup("top", "All Settings", cfg_grp, vfoa_grp,<br>+ <br>+ group = RadioSettings(cfg_grp, vfoa_grp,<br> vfob_grp, key_grp, scn_grp, cal_grp, lmt_grp, oem_grp)<br> <br> #<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/kyd.py<br>--- a/chirp/kyd.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/kyd.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -20,9 +20,7 @@<br> <br> from chirp import chirp_common, directory, memmap<br> from chirp import bitwise, errors, util<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean<br>+from chirp.settings import *<br> <br> DEBUG = os.getenv("CHIRP_DEBUG") and True or False<br> <br>@@ -436,6 +434,7 @@<br> def get_settings(self):<br> _settings = self._memobj.settings<br> basic = RadioSettingGroup("basic", "Basic Settings")<br>+ top = RadioSettings(basic)<br> <br> rs = RadioSetting("tot", "Time-out timer",<br> RadioSettingValueList(TIMEOUTTIMER_LIST,<br>@@ -474,7 +473,7 @@<br> RadioSettingValueBoolean(_settings.save))<br> basic.append(rs)<br> <br>- return basic<br>+ return top<br> <br> def set_settings(self, settings):<br> for element in settings:<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/leixen.py<br>--- a/chirp/leixen.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/leixen.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -18,10 +18,7 @@<br> <br> from chirp import chirp_common, directory, memmap, errors, util<br> from chirp import bitwise<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString, \<br>- RadioSettingValueFloat, InvalidValueError<br>+from chirp.settings import *<br> from textwrap import dedent<br> <br> if os.getenv("CHIRP_DEBUG"):<br>@@ -531,8 +528,7 @@<br> cfg_grp = RadioSettingGroup("cfg_grp", "Basic Settings")<br> adv_grp = RadioSettingGroup("adv_grp", "Advanced Settings")<br> key_grp = RadioSettingGroup("key_grp", "Key Assignment")<br>- group = RadioSettingGroup("top", "All Settings", cfg_grp,<br>- adv_grp, key_grp)<br>+ group = RadioSettings(cfg_grp, adv_grp, key_grp)<br> <br> #<br> # Basic Settings<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/settings.py<br>--- a/chirp/settings.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/settings.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -199,6 +199,11 @@<br> def __str__(self):<br> return self._current<br> <br>+<br>+class RadioSettings(list):<br>+ def __init__(self, *groups):<br>+ list.__init__(self, groups)<br>+<br> class RadioSettingGroup(object):<br> """A group of settings"""<br> def _validate(self, element):<br>@@ -244,7 +249,7 @@<br> <br> def __iter__(self):<br> class RSGIterator:<br>- """Iterator for a RadioSettingsGroup"""<br>+ """Iterator for a RadioSettingGroup"""<br> def __init__(self, rsg):<br> self.__rsg = rsg<br> self.__i = 0<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/th9800.py<br>--- a/chirp/th9800.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/th9800.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -17,10 +17,7 @@<br> <br> from chirp import bitwise, chirp_common, directory, errors, util, memmap<br> import struct<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString, \<br>- RadioSettingValueFloat, InvalidValueError<br>+from chirp.settings import *<br> from chirp_common import format_freq<br> import os<br> import time<br>@@ -400,8 +397,7 @@<br> _bandlimits = self._memobj.bandlimits<br> basic = RadioSettingGroup("basic", "Basic")<br> info = RadioSettingGroup("info", "Model Info")<br>- top = RadioSettingGroup("top", "All Settings",<br>- basic, info)<br>+ top = RadioSettings(basic, info)<br> basic.append( RadioSetting("beep", "Beep",<br> RadioSettingValueBoolean(_settings.beep)))<br> basic.append( RadioSetting("beep_vol", "Beep Volume",<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/th_uvf8d.py<br>--- a/chirp/th_uvf8d.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/th_uvf8d.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -25,9 +25,7 @@<br> import struct<br> <br> from chirp import chirp_common, bitwise, errors, directory, memmap, util<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString<br>+from chirp.settings import *<br> <br> <br> def uvf8d_identify(radio):<br>@@ -464,7 +462,8 @@<br> def get_settings(self):<br> _settings = self._memobj.settings<br> <br>- group = RadioSettingGroup("top", "All Settings")<br>+ group = RadioSettingGroup("basic", "Basic")<br>+ top = RadioSettings(basic)<br> <br> group.append(<br> RadioSetting("mode", "Mode",<br>@@ -595,7 +594,7 @@<br> RadioSettingValueList(AB_LIST,<br> AB_LIST[_settings.b_work_area])))<br> <br>- return group<br>+ return top<br> <br> group.append(<br> RadioSetting("disnm", "Display Name",<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/thuv1f.py<br>--- a/chirp/thuv1f.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/thuv1f.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -17,11 +17,7 @@<br> <br> from chirp import chirp_common, errors, util, directory, memmap<br> from chirp import bitwise<br>-<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueList, RadioSettingValueBoolean, \<br>- RadioSettingValueString<br>+from chirp.settings import *<br> <br> def uvf1_identify(radio):<br> """Do identify handshake with TYT TH-UVF1"""<br>@@ -383,7 +379,8 @@<br> def get_settings(self):<br> _settings = self._memobj.settings<br> <br>- group = RadioSettingGroup("top", "All Settings")<br>+ group = RadioSettingGroup("basic", "Basic");<br>+ top = RadioSettings(group)<br> <br> group.append(<br> RadioSetting("led", "LED Mode",<br>@@ -463,7 +460,7 @@<br> RadioSettingValueString(0, 6,<br> _filter(_settings.ponmsg))))<br> <br>- return group<br>+ return top<br> <br> def set_settings(self, settings):<br> _settings = self._memobj.settings<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/tk8102.py<br>--- a/chirp/tk8102.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/tk8102.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -18,9 +18,7 @@<br> <br> from chirp import chirp_common, directory, memmap, errors, util<br> from chirp import bitwise<br>-from chirp.settings import RadioSettingGroup, RadioSetting<br>-from chirp.settings import RadioSettingValueBoolean, RadioSettingValueList<br>-from chirp.settings import RadioSettingValueString<br>+from chirp.settings import *<br> <br> MEM_FORMAT = """<br> #seekto 0x0030;<br>@@ -355,7 +353,8 @@<br> <br> def get_settings(self):<br> _mem = self._memobj<br>- top = RadioSettingGroup("all", "All Settings")<br>+ basic = RadioSettingGroup("basic", "Basic")<br>+ top = RadioSettings(basic)<br> <br> def _f(val):<br> string = ""<br>@@ -369,18 +368,21 @@<br> RadioSettingValueString(0, 32,<br> _f(_mem.messages.line1),<br> autopad=False))<br>- top.append(line1)<br>+ basic.append(line1)<br> <br> line2 = RadioSetting("messages.line2", "Message Line 2",<br> RadioSettingValueString(0, 32,<br> _f(_mem.messages.line2),<br> autopad=False))<br>- top.append(line2)<br>+ basic.append(line2)<br> <br> return top<br> <br> def set_settings(self, settings):<br> for element in settings:<br>+ if not isinstance(element, RadioSetting):<br>+ self.set_settings(element)<br>+ continue<br> if "." in element.get_name():<br> bits = element.get_name().split(".")<br> obj = self._memobj<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/uv5r.py<br>--- a/chirp/uv5r.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/uv5r.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -19,10 +19,7 @@<br> <br> from chirp import chirp_common, errors, util, directory, memmap<br> from chirp import bitwise<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString, \<br>- RadioSettingValueFloat, InvalidValueError<br>+from chirp.settings import *<br> from textwrap import dedent<br> <br> if os.getenv("CHIRP_DEBUG"):<br>@@ -986,7 +983,8 @@<br> _wmchannel = self._memobj.wmchannel<br> basic = RadioSettingGroup("basic", "Basic Settings")<br> advanced = RadioSettingGroup("advanced", "Advanced Settings")<br>- group = RadioSettingGroup("top", "All Settings", basic, advanced)<br>+<br>+ group = RadioSettings(basic, advanced)<br> <br> rs = RadioSetting("squelch", "Carrier Squelch Level",<br> RadioSettingValueInteger(0, 9, _settings.squelch))<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/uvb5.py<br>--- a/chirp/uvb5.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/uvb5.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -15,10 +15,7 @@<br> <br> import struct<br> from chirp import chirp_common, directory, bitwise, memmap, errors, util<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueBoolean, RadioSettingValueList, \<br>- RadioSettingValueInteger, RadioSettingValueString, \<br>- RadioSettingValueFloat<br>+from chirp.settings import *<br> from textwrap import dedent<br> <br> mem_format = """<br>@@ -480,7 +477,8 @@<br> def get_settings(self):<br> _settings = self._memobj.settings<br> basic = RadioSettingGroup("basic", "Basic Settings")<br>- group = RadioSettingGroup("top", "All Settings", basic)<br>+ <br>+ group = RadioSettings(basic)<br> <br> options = ["Time", "Carrier", "Search"]<br> rs = RadioSetting("scantype", "Scan Type",<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/vx2.py<br>--- a/chirp/vx2.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/vx2.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -15,9 +15,7 @@<br> # along with this program. If not, see <<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>>.<br> <br> from chirp import chirp_common, yaesu_clone, directory, bitwise<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString<br>+from chirp.settings import *<br> import os, traceback, re<br> <br> if os.getenv("CHIRP_DEBUG"):<br>@@ -437,7 +435,7 @@<br> basic = RadioSettingGroup("basic", "Basic")<br> dtmf = RadioSettingGroup("dtmf", "DTMF")<br> arts = RadioSettingGroup("arts", "ARTS")<br>- top = RadioSettingGroup("top", "All Settings", basic, arts, dtmf)<br>+ top = RadioSettings(basic, arts, dtmf)<br> <br> options = [ "off", "30m", "1h", "3h", "5h", "8h" ]<br> rs = RadioSetting("apo", "APO time (hrs)",<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/vx3.py<br>--- a/chirp/vx3.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/vx3.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -16,9 +16,7 @@<br> <br> from chirp import chirp_common, yaesu_clone, directory<br> from chirp import bitwise<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueInteger, RadioSettingValueList, \<br>- RadioSettingValueBoolean, RadioSettingValueString<br>+from chirp.settings import *<br> from textwrap import dedent<br> import os, re<br> <br>@@ -529,8 +527,8 @@<br> arts = RadioSettingGroup("arts", "ARTS")<br> eai = RadioSettingGroup("eai", "Emergency")<br> msg = RadioSettingGroup("msg", "Messages")<br>- top = RadioSettingGroup("top", "All Settings",<br>- basic, sound, arts, dtmf, eai, msg)<br>+<br>+ top = RadioSettings(basic, sound, arts, dtmf, eai, msg)<br> <br> basic.append( RadioSetting("att_wx", "Attenuation WX",<br> RadioSettingValueBoolean(_settings.att_wx)))<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/vx8.py<br>--- a/chirp/vx8.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/vx8.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -18,9 +18,7 @@<br> <br> from chirp import chirp_common, yaesu_clone, directory<br> from chirp import bitwise<br>-from chirp.settings import RadioSettingGroup, RadioSetting<br>-from chirp.settings import RadioSettingValueInteger, RadioSettingValueString<br>-from chirp.settings import RadioSettingValueList, RadioSettingValueBoolean<br>+from chirp.settings import *<br> from textwrap import dedent<br> <br> MEM_FORMAT = """<br>@@ -1372,14 +1370,13 @@<br> return menu<br> <br> def _get_settings(self):<br>- top = RadioSettingGroup("all", "All Settings",<br>- self._get_aprs_general_settings(),<br>- self._get_aprs_rx_settings(),<br>- self._get_aprs_tx_settings(),<br>- self._get_aprs_smartbeacon(),<br>- self._get_dtmf_settings(),<br>- self._get_misc_settings(),<br>- self._get_scan_settings())<br>+ top = RadioSettings(self._get_aprs_general_settings(),<br>+ self._get_aprs_rx_settings(),<br>+ self._get_aprs_tx_settings(),<br>+ self._get_aprs_smartbeacon(),<br>+ self._get_dtmf_settings(),<br>+ self._get_misc_settings(),<br>+ self._get_scan_settings())<br> return top<br> <br> def get_settings(self):<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirp/wouxun.py<br>--- a/chirp/wouxun.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirp/wouxun.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -18,10 +18,7 @@<br> import time<br> import os<br> from chirp import util, chirp_common, bitwise, memmap, errors, directory<br>-from chirp.settings import RadioSetting, RadioSettingGroup, \<br>- RadioSettingValueBoolean, RadioSettingValueList, \<br>- RadioSettingValueInteger, RadioSettingValueString, \<br>- RadioSettingValueFloat<br>+from chirp.settings import *<br> from chirp.wouxun_common import wipe_memory, do_download, do_upload<br> from textwrap import dedent<br> <br>@@ -334,7 +331,7 @@<br> def get_settings(self):<br> freqranges = RadioSettingGroup("freqranges", "Freq ranges")<br> fm_preset = RadioSettingGroup("fm_preset", "FM Presets")<br>- top = RadioSettingGroup("top", "All Settings", freqranges, fm_preset)<br>+ top = RadioSettings(freqranges, fm_preset)<br> <br> rs = RadioSetting("menu_available", "Menu Available",<br> RadioSettingValueBoolean(<br>@@ -1045,7 +1042,7 @@<br> def get_settings(self):<br> freqranges = RadioSettingGroup("freqranges", "Freq ranges")<br> fm_preset = RadioSettingGroup("fm_preset", "FM Presets")<br>- top = RadioSettingGroup("top", "All Settings", freqranges, fm_preset)<br>+ top = RadioSettings(freqranges, fm_preset)<br> <br> rs = RadioSetting("menu_available", "Menu Available",<br> RadioSettingValueBoolean(<br>@@ -1425,7 +1422,7 @@<br> <br> def get_settings(self):<br> freqranges = RadioSettingGroup("freqranges", "Freq ranges (read only)")<br>- top = RadioSettingGroup("top", "All Settings", freqranges)<br>+ group = RadioSettings(freqranges)<br> <br> rs = RadioSetting("vhf_rx_start", "vhf rx start",<br> RadioSettingValueInteger(66, 520,<br>@@ -1473,7 +1470,7 @@<br> ( decode_freq(self._memobj.freq_ranges.vhf_rx_start) * 1000000, <br> (decode_freq(self._memobj.freq_ranges.vhf_rx_stop)+1) * 1000000)]<br> <br>- return top<br>+ return group<br> <br> @classmethod<br> def match_model(cls, filedata, filename):<br>diff -r 5a17f1c24b38 -r e8378ba87779 chirpui/settingsedit.py<br>--- a/chirpui/settingsedit.py Sun Feb 01 17:51:08 2015 -0500<br>+++ b/chirpui/settingsedit.py Mon Feb 02 21:29:51 2015 -0800<br>@@ -16,10 +16,11 @@<br> import gtk<br> import gobject<br> <br>-from chirp import chirp_common, settings<br>+from chirp import chirp_common<br>+from chirp.settings import *<br> from chirpui import common, miscwidgets<br> <br>-class RadioSettingProxy(settings.RadioSetting):<br>+class RadioSettingProxy(RadioSetting):<br> def __init__(self, setting, editor):<br> self._setting = setting<br> self._editor = editor<br>@@ -27,40 +28,40 @@<br> class SettingsEditor(common.Editor):<br> def __init__(self, rthread):<br> super(SettingsEditor, self).__init__(rthread)<br>- self._changed = False<br>+<br>+ # The main box<br> self.root = gtk.HBox(False, 0)<br>- self._store = gtk.TreeStore(gobject.TYPE_STRING,<br>- gobject.TYPE_PYOBJECT)<br>+<br>+ # The pane<br>+ paned = gtk.HPaned()<br>+ paned.show()<br>+ self.root.pack_start(paned, 1, 1, 0)<br>+ <br>+ # The selection tree<br>+ self._store = gtk.TreeStore(gobject.TYPE_STRING, gobject.TYPE_INT)<br> self._view = gtk.TreeView(self._store)<br> self._view.set_size_request(150, -1)<br> self._view.get_selection().connect("changed", self._view_changed_cb)<br>+ self._view.append_column(gtk.TreeViewColumn("", gtk.CellRendererText(), text=0))<br> self._view.show()<br>- self.root.pack_start(self._view, 0, 0, 0)<br>+ paned.pack1(self._view)<br> <br>- col = gtk.TreeViewColumn("", gtk.CellRendererText(), text=0)<br>- self._view.append_column(col)<br>+ # The settings notebook<br>+ self._notebook = gtk.Notebook()<br>+ self._notebook.set_show_tabs(False)<br>+ self._notebook.set_show_border(False)<br>+ self._notebook.show()<br>+ paned.pack2(self._notebook)<br> <br>- self._table = gtk.Table(20, 3)<br>- self._table.set_col_spacings(10)<br>- self._table.show()<br>+ self._changed = False<br>+ self._settings = None<br> <br>- sw = gtk.ScrolledWindow()<br>- sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)<br>- sw.add_with_viewport(self._table)<br>- sw.show()<br>-<br>- self.root.pack_start(sw, 1, 1, 1)<br>-<br>- self._index = 0<br>-<br>- self._top_setting_group = None<br>-<br>- job = common.RadioJob(self._build_ui, "get_settings")<br>+ job = common.RadioJob(self._get_settings_cb, "get_settings")<br> job.set_desc("Getting radio settings")<br> self.rthread.submit(job)<br> <br> def _save_settings(self):<br>- if self._top_setting_group is None:<br>+ if self._settings is None:<br> return<br> <br> def setting_cb(result):<br>@@ -71,21 +72,21 @@<br> self._changed = False<br> <br> job = common.RadioJob(setting_cb, "set_settings",<br>- self._top_setting_group)<br>+ self._settings)<br> job.set_desc("Setting radio settings")<br> self.rthread.submit(job)<br> <br> def _load_setting(self, value, widget):<br>- if isinstance(value, settings.RadioSettingValueInteger):<br>+ if isinstance(value, RadioSettingValueInteger):<br> adj = widget.get_adjustment()<br> adj.configure(value.get_value(),<br> value.get_min(), value.get_max(),<br> value.get_step(), 1, 0)<br>- elif isinstance(value, settings.RadioSettingValueFloat):<br>+ elif isinstance(value, RadioSettingValueFloat):<br> widget.set_text(value.format())<br>- elif isinstance(value, settings.RadioSettingValueBoolean):<br>+ elif isinstance(value, RadioSettingValueBoolean):<br> widget.set_active(value.get_value())<br>- elif isinstance(value, settings.RadioSettingValueList):<br>+ elif isinstance(value, RadioSettingValueList):<br> model = widget.get_model()<br> model.clear()<br> for option in value.get_options():<br>@@ -93,22 +94,22 @@<br> current = value.get_value()<br> index = value.get_options().index(current)<br> widget.set_active(index)<br>- elif isinstance(value, settings.RadioSettingValueString):<br>+ elif isinstance(value, RadioSettingValueString):<br> widget.set_text(str(value).rstrip())<br> else:<br> print "Unsupported widget type %s for %s" % (value.__class__,<br> element.get_name())<br> <br> def _do_save_setting(self, widget, value):<br>- if isinstance(value, settings.RadioSettingValueInteger):<br>+ if isinstance(value, RadioSettingValueInteger):<br> value.set_value(widget.get_adjustment().get_value())<br>- elif isinstance(value, settings.RadioSettingValueFloat):<br>+ elif isinstance(value, RadioSettingValueFloat):<br> value.set_value(widget.get_text())<br>- elif isinstance(value, settings.RadioSettingValueBoolean):<br>+ elif isinstance(value, RadioSettingValueBoolean):<br> value.set_value(widget.get_active())<br>- elif isinstance(value, settings.RadioSettingValueList):<br>+ elif isinstance(value, RadioSettingValueList):<br> value.set_value(widget.get_active_text())<br>- elif isinstance(value, settings.RadioSettingValueString):<br>+ elif isinstance(value, RadioSettingValueString):<br> value.set_value(widget.get_text())<br> else:<br> print "Unsupported widget type %s for %s" % (\<br>@@ -121,53 +122,62 @@<br> def _save_setting(self, widget, value):<br> try:<br> self._do_save_setting(widget, value)<br>- except settings.InvalidValueError, e:<br>+ except InvalidValueError, e:<br> common.show_error(_("Invalid setting value: %s") % e)<br> <br>- def _build_ui_group(self, group):<br>+ def _build_ui_tab(self, group):<br>+<br>+ # The scrolled window<br>+ sw = gtk.ScrolledWindow()<br>+ sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)<br>+ sw.show()<br>+<br>+ # Notebook tab<br>+ tab = self._notebook.append_page(sw, gtk.Label(_(group.get_name())))<br>+<br>+ # Settings table<br>+ table = gtk.Table(len(group), 2, True)<br>+ table.show()<br>+ sw.add_with_viewport(table)<br>+<br>+ row = 0<br> def pack(widget, pos):<br>- self._table.attach(widget, pos, pos+1, self._index, self._index+1,<br>- xoptions=gtk.FILL, yoptions=0)<br>+ table.attach(widget, pos, pos+1, row, row+1,<br>+ xoptions=gtk.FILL, yoptions=0, xpadding=6, ypadding=0)<br> <br>- def abandon(child):<br>- self._table.remove(child)<br>- self._table.foreach(abandon)<br>-<br>- self._index = 0<br> for element in group:<br>- if not isinstance(element, settings.RadioSetting):<br>+ if not isinstance(element, RadioSetting):<br> continue<br> label = gtk.Label(element.get_shortname())<br>- label.set_alignment(1.0, 0.5)<br>+ label.set_alignment(-1.0, 0.5)<br> label.show()<br> pack(label, 0)<br> <br> if isinstance(element.value, list) and \<br> isinstance(element.value[0],<br>- settings.RadioSettingValueInteger):<br>- arraybox = gtk.HBox(True, 3)<br>+ RadioSettingValueInteger):<br>+ arraybox = gtk.HBox(True)<br> else:<br>- arraybox = gtk.VBox(True, 3)<br>+ arraybox = gtk.VBox(True)<br> pack(arraybox, 1)<br> arraybox.show()<br> <br> widgets = []<br> for index in element.keys():<br> value = element[index]<br>- if isinstance(value, settings.RadioSettingValueInteger):<br>+ if isinstance(value, RadioSettingValueInteger):<br> widget = gtk.SpinButton()<br>- print "Digits: %i" % widget.get_digits()<br> signal = "value-changed"<br>- elif isinstance(value, settings.RadioSettingValueFloat):<br>+ elif isinstance(value, RadioSettingValueFloat):<br> widget = gtk.Entry()<br> signal = "focus-out-event"<br>- elif isinstance(value, settings.RadioSettingValueBoolean):<br>+ elif isinstance(value, RadioSettingValueBoolean):<br> widget = gtk.CheckButton(_("Enabled"))<br> signal = "toggled"<br>- elif isinstance(value, settings.RadioSettingValueList):<br>+ elif isinstance(value, RadioSettingValueList):<br> widget = miscwidgets.make_choice([], editable=False)<br> signal = "changed"<br>- elif isinstance(value, settings.RadioSettingValueString):<br>+ elif isinstance(value, RadioSettingValueString):<br> widget = gtk.Entry()<br> signal = "changed"<br> else:<br>@@ -190,42 +200,35 @@<br> else:<br> widget.connect(signal, self._save_setting, value)<br> <br>- self._index += 1<br>+ row += 1<br> <br>- def _build_tree(self, group, parent):<br>+ return tab<br>+<br>+ def _build_ui_group(self, group, parent):<br>+ <br>+ tab = self._build_ui_tab(group)<br>+ <br> iter = self._store.append(parent)<br>- self._store.set(iter, 0, group.get_shortname(), 1, group)<br>+ self._store.set(iter, 0, group.get_shortname(), 1, tab)<br> <br>- if self._set_default is None:<br>- # If we haven't found the first page with actual settings on it<br>- # yet, then look for one here<br>- for element in group:<br>- if isinstance(element, settings.RadioSetting):<br>- self._set_default = self._store.get_path(iter), group<br>- break<br>+ for element in group:<br>+ if not isinstance(element, RadioSetting):<br>+ self._build_ui_group(element, iter)<br> <br>- for element in group:<br>- if not isinstance(element, settings.RadioSetting):<br>- self._build_tree(element, iter)<br>+ def _build_ui(self, settings):<br>+ if not isinstance(settings, list):<br>+ raise Exception("Invalid Radio Settings")<br>+ return<br>+<br>+ self._settings = settings<br>+ for group in settings:<br>+ self._build_ui_group(group, None)<br> self._view.expand_all()<br> <br>- def _build_ui_real(self, group):<br>- if not isinstance(group, settings.RadioSettingGroup):<br>- print "Toplevel is not a group"<br>- return<br>-<br>- self._set_default = None<br>- self._top_setting_group = group<br>- self._build_tree(group, None)<br>- self._view.set_cursor(self._set_default[0])<br>- self._build_ui_group(self._set_default[1])<br>-<br>- def _build_ui(self, group):<br>- gobject.idle_add(self._build_ui_real, group)<br>+ def _get_settings_cb(self, settings):<br>+ gobject.idle_add(self._build_ui, settings)<br> <br> def _view_changed_cb(self, selection):<br> (lst, iter) = selection.get_selected()<br>- group, = self._store.get(iter, 1)<br>-<br>- if group:<br>- self._build_ui_group(group)<br>+ tab, = self._store.get(iter, 1)<br>+ self._notebook.set_current_page(tab)<br>\ No newline at end of file<br>diff -r 5a17f1c24b38 -r e8378ba87779 tests/run_tests<br>--- a/tests/run_tests Sun Feb 01 17:51:08 2015 -0500<br>+++ b/tests/run_tests Mon Feb 02 21:29:51 2015 -0800<br>@@ -24,7 +24,7 @@<br> <br> from chirp import CHIRP_VERSION<br> from chirp import *<br>-from chirp import chirp_common, directory, generic_csv, import_logic, memmap<br>+from chirp import chirp_common, directory, generic_csv, import_logic, memmap, settings<br> from chirp import errors<br> <br> TESTS = {}<br>@@ -523,13 +523,15 @@<br> <br> TESTS["Edges"] = TestCaseEdges<br> <br>-<br> class TestCaseSettings(TestCase):<br> def __str__(self):<br> return "Settings"<br> <br> def do_get_settings(self, rf):<br>- self._wrapper.do("get_settings")<br>+ lst = self._wrapper.do("get_settings")<br>+ if not isinstance(lst, list):<br>+ raise TestFailedError("Invalid Radio Settings")<br>+ self._wrapper.do("set_settings", lst)<br> <br> def run(self):<br> rf = self._wrapper.do("get_features")<br>@@ -537,7 +539,7 @@<br> if not rf.has_settings:<br> raise TestSkippedError("Settings not supported")<br> <br>- self.do_get_settings(rf)<br>+ self.do_get_settings(rf)<br> <br> return []<br> <br> <BR>                                            </div></body>
</html>