Skip to content

Commit

Permalink
Mass convert self.LIST settings indexes
Browse files Browse the repository at this point in the history
  • Loading branch information
kk7ds committed Sep 9, 2024
1 parent c574130 commit 5221692
Show file tree
Hide file tree
Showing 18 changed files with 238 additions and 247 deletions.
4 changes: 2 additions & 2 deletions chirp/drivers/baofeng_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,12 +660,12 @@ def get_memory(self, number):

rs = RadioSetting("pttid", "PTT ID",
RadioSettingValueList(self.PTTID_LIST,
self.PTTID_LIST[_mem.pttid]))
current_index=_mem.pttid))
mem.extra.append(rs)

rs = RadioSetting("scode", "S-CODE",
RadioSettingValueList(self.SCODE_LIST,
self.SCODE_LIST[_mem.scode]))
current_index=_mem.scode))
mem.extra.append(rs)

immutable = []
Expand Down
27 changes: 12 additions & 15 deletions chirp/drivers/baofeng_uv17Pro.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def get_settings_common_basic(self, basic, _mem):
val = _mem.settings.squelch
rs = RadioSetting("settings.squelch", "Squelch",
RadioSettingValueList(
self.SQUELCH_LIST, self.SQUELCH_LIST[val]))
self.SQUELCH_LIST, current_index=val))
basic.append(rs)

if _mem.settings.tot >= len(self.LIST_TIMEOUT):
Expand All @@ -536,7 +536,7 @@ def get_settings_common_basic(self, basic, _mem):
val = _mem.settings.tot
rs = RadioSetting("settings.tot", "Timeout Timer",
RadioSettingValueList(
self.LIST_TIMEOUT, self.LIST_TIMEOUT[val]))
self.LIST_TIMEOUT, current_index=val))
basic.append(rs)

rs = RadioSetting("settings.dualstandby", "Dual Watch",
Expand All @@ -550,8 +550,7 @@ def get_settings_common_basic(self, basic, _mem):
"Power On Display Type",
RadioSettingValueList(
self.LIST_POWERON_DISPLAY_TYPE,
self.LIST_POWERON_DISPLAY_TYPE[
_mem.settings.powerondistype]))
current_index=_mem.settings.powerondistype))
basic.append(rs)

if _mem.settings.voice >= len(self.LIST_VOICE):
Expand All @@ -560,7 +559,7 @@ def get_settings_common_basic(self, basic, _mem):
val = _mem.settings.voice
rs = RadioSetting("settings.voice", "Voice Prompt",
RadioSettingValueList(
self.LIST_VOICE, self.LIST_VOICE[val]))
self.LIST_VOICE, current_index=val))
basic.append(rs)

rs = RadioSetting("settings.voicesw", "Enable Voice",
Expand All @@ -574,7 +573,7 @@ def get_settings_common_basic(self, basic, _mem):
rs = RadioSetting("settings.backlight", "Backlight Timer",
RadioSettingValueList(
self.LIST_BACKLIGHT_TIMER,
self.LIST_BACKLIGHT_TIMER[val]))
current_index=val))
basic.append(rs)

rs = RadioSetting("settings.autolock", "Key Auto Lock",
Expand All @@ -593,13 +592,13 @@ def get_settings_common_basic(self, basic, _mem):
rs = RadioSetting("settings.chadistype", "Channel A display type",
RadioSettingValueList(
self.LIST_MODE,
self.LIST_MODE[_mem.settings.chadistype]))
current_index=_mem.settings.chadistype))
basic.append(rs)

rs = RadioSetting("settings.chbdistype", "Channel B display type",
RadioSettingValueList(
self.LIST_MODE,
self.LIST_MODE[_mem.settings.chbdistype]))
current_index=_mem.settings.chbdistype))
basic.append(rs)

def get_settings_pro_basic(self, basic, _mem):
Expand All @@ -610,7 +609,7 @@ def get_settings_pro_basic(self, basic, _mem):
val = _mem.settings.savemode
rs = RadioSetting("settings.savemode", "Save Mode",
RadioSettingValueList(self.LIST_PW_SAVEMODE,
self.LIST_PW_SAVEMODE[val]))
current_index=val))
basic.append(rs)

rs = RadioSetting("settings.totalarm", "Timeout Timer Alarm",
Expand Down Expand Up @@ -892,7 +891,7 @@ def apply_offset(setting, obj):
val = _mem.vfo.a.scode
rs = RadioSetting("vfo.a.scode", "Signal Code",
RadioSettingValueList(self.SCODE_LIST,
self.SCODE_LIST[val]))
current_index=val))
vfoA.append(rs)

if _mem.vfo.b.scode >= len(self.SCODE_LIST):
Expand All @@ -901,7 +900,7 @@ def apply_offset(setting, obj):
val = _mem.vfo.b.scode
rs = RadioSetting("vfo.b.scode", "Signal Code",
RadioSettingValueList(self.SCODE_LIST,
self.SCODE_LIST[val]))
current_index=val))
vfoB.append(rs)

if _mem.vfo.a.step >= len(STEPS):
Expand Down Expand Up @@ -1176,15 +1175,13 @@ def get_memory_common(self, _mem, name, mem):

rs = RadioSetting("pttid", "PTT ID",
RadioSettingValueList(self.PTTID_LIST,
self.PTTID_LIST[
_mem.pttid]))
current_index=_mem.pttid))
mem.extra.append(rs)

scode = (_mem.scode - self._scode_offset) % len(self.SCODE_LIST)
rs = RadioSetting("scode", "S-CODE",
RadioSettingValueList(self.SCODE_LIST,
self.SCODE_LIST[
scode]))
current_index=scode))
mem.extra.append(rs)

mem.name = str(name).replace('\xFF', ' ').replace('\x00', ' ').rstrip()
Expand Down
16 changes: 8 additions & 8 deletions chirp/drivers/bjuv55.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def _get_settings(self):
rs = RadioSetting("tdrab", "Dual Watch TX Priority",
RadioSettingValueList(
uv5r.TDRAB_LIST,
uv5r.TDRAB_LIST[_settings.tdrab]))
current_index=_settings.tdrab))
advanced.append(rs)

rs = RadioSetting("alarm", "Alarm",
Expand All @@ -300,23 +300,23 @@ def _get_settings(self):
rs = RadioSetting("timeout", "Timeout Timer",
RadioSettingValueList(
uv5r.TIMEOUT_LIST,
uv5r.TIMEOUT_LIST[_settings.timeout]))
current_index=_settings.timeout))
basic.append(rs)

rs = RadioSetting("screv", "Scan Resume",
RadioSettingValueList(
uv5r.RESUME_LIST,
uv5r.RESUME_LIST[_settings.screv]))
current_index=_settings.screv))
advanced.append(rs)

rs = RadioSetting("mdfa", "Display Mode (A)",
RadioSettingValueList(
uv5r.MODE_LIST, uv5r.MODE_LIST[_settings.mdfa]))
uv5r.MODE_LIST, current_index=_settings.mdfa))
basic.append(rs)

rs = RadioSetting("mdfb", "Display Mode (B)",
RadioSettingValueList(
uv5r.MODE_LIST, uv5r.MODE_LIST[_settings.mdfb]))
uv5r.MODE_LIST, current_index=_settings.mdfb))
basic.append(rs)

rs = RadioSetting("bcl", "Busy Channel Lockout",
Expand Down Expand Up @@ -620,19 +620,19 @@ def apply_code(setting, obj):
rs = RadioSetting("dtmfst", "DTMF Sidetone",
RadioSettingValueList(
uv5r.DTMFST_LIST,
uv5r.DTMFST_LIST[_settings.dtmfst]))
current_index=_settings.dtmfst))
dtmf.append(rs)

rs = RadioSetting("ani.dtmfon", "DTMF Speed (on)",
RadioSettingValueList(
uv5r.DTMFSPEED_LIST,
uv5r.DTMFSPEED_LIST[self._memobj.ani.dtmfon]))
current_index=self._memobj.ani.dtmfon))
dtmf.append(rs)

rs = RadioSetting("ani.dtmfoff", "DTMF Speed (off)",
RadioSettingValueList(
uv5r.DTMFSPEED_LIST,
uv5r.DTMFSPEED_LIST[self._memobj.ani.dtmfoff]))
current_index=self._memobj.ani.dtmfoff))
dtmf.append(rs)

return group
Expand Down
2 changes: 1 addition & 1 deletion chirp/drivers/btech.py
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ def get_settings(self):
# Basic
if self.COLOR_LCD:
val = min(_mem.settings.tmr, len(self.LIST_TMR) - 1)
rs = RadioSettingValueList(self.LIST_TMR, self.LIST_TMR[val])
rs = RadioSettingValueList(self.LIST_TMR, current_index=val)
tmr = RadioSetting("settings.tmr", "Transceiver multi-receive", rs)
basic.append(tmr)
else:
Expand Down
Loading

0 comments on commit 5221692

Please sign in to comment.