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