<br><br><div class="gmail_quote">On Sat, Feb 23, 2013 at 7:03 PM, Dan Smith <span dir="ltr"><<a href="mailto:dsmith@danplanet.com" target="_blank">dsmith@danplanet.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">> I want to create a selection for the UV-5R that depending the the<br>
> users' selection (either tick like Boolean, or a two choice list),<br>
> one or the other of the following is written.<br>
><br>
> "\x0E\x0F\x10\x11\x15"<br>
> "\x00\x00\x00\x00\x00"<br>
<br>
</div>You mean a RadioSetting? Maybe something like this untested snipped:<br>
<br>
def apply_foobar(setting, obj):<br>
if setting.value == True:<br>
obj.foobar = "\x0E\x0F\x10\x11\x15"<br>
else:<br>
obj.foobar = "\x00\x00\x00\x00\x00"<br>
<br>
rs = RadioSetting("foobar", "Enable Foobar", RadioSettingBoolean(False))<br>
rs.set_apply_callback(apply_foobar, self._memobj)<br>
<br>
<br></blockquote></div>Thanks Dan. That is what I am looking for. I don't have it working yet, though.<br><br>Here is my structure...<br><br>#seekto 0x0F08;<br>struct {<br> u8 foobar[5];<br>} test;<br><br><br>Here is my RadioSetting() code...<br>
<br> def apply_txinhibit(setting, obj):<br> if setting.value == True:<br> obj.foobar = "\x00\x00\x00\x00\x00"<br> else:<br> obj.foobar = "\x0E\x0F\x10\x11\x15"<br>
<br> rs = RadioSetting("test.foobar", "TX Inhibit",<br> RadioSettingValueBoolean(False))<br> rs.set_apply_callback(apply_txinhibit, self._memobj.test)<br> other.append(rs)<br>
<br><br>Here is my error...<br><br>Setting enable = True<br>Using apply callback<br>test.foobar<br>Exception running RadioJob: invalid literal for int() with base 10: '\x0e'<br>-- Exception: --<br>Traceback (most recent call last):<br>
File "C:\Users\Root\chirp.hg\chirpui\common.py", line 97, in _execute<br> result = func(*self.args, **self.kwargs)<br> File "C:\Users\Root\chirp.hg\chirp\uv5r.py", line 1160, in set_settings<br> self.set_settings(element)<br>
File "C:\Users\Root\chirp.hg\chirp\uv5r.py", line 1181, in set_settings<br> element.run_apply_callback()<br> File "C:\Users\Root\chirp.hg\chirp\settings.py", line 288, in run_apply_callba<br>ck<br>
return self._apply_callback()<br> File "C:\Users\Root\chirp.hg\chirp\settings.py", line 282, in <lambda><br> self._apply_callback = lambda: callback(self, *args)<br> File "C:\Users\Root\chirp.hg\chirp\uv5r.py", line 916, in apply_txinhibit<br>
obj.foobar = "\x0E\x0F\x10\x11\x15"<br> File "C:\Users\Root\chirp.hg\chirp\bitwise.py", line 591, in __setattr__<br> self.__dict__["_generators"][name].set_value(value)<br> File "C:\Users\Root\chirp.hg\chirp\bitwise.py", line 238, in set_value<br>
self.__items[i].set_value(value[i])<br> File "C:\Users\Root\chirp.hg\chirp\bitwise.py", line 381, in set_value<br> self._data[self._offset] = (int(value) & 0xFF)<br>ValueError: invalid literal for int() with base 10: '\x0e'<br>
------<br>Job Args: (<chirp.settings.RadioSettingGroup object at 0x03B1A490>,)<br>Job KWArgs: {}<br>Job Called from:<br> File "chirpw", line 144, in <module><br> gtk.main()<br> File "C:\Users\Root\chirp.hg\chirpui\settingsedit.py", line 119, in _save_sett<br>
ing<br> self._do_save_setting(widget, value)<br> File "C:\Users\Root\chirp.hg\chirpui\settingsedit.py", line 115, in _do_save_s<br>etting<br> self._save_settings()<br> File "C:\Users\Root\chirp.hg\chirpui\settingsedit.py", line 71, in _save_setti<br>
ngs<br> self._top_setting_group)<br><br><br>I think I will sleep on it and study it some more in the morning.<br><br>Jim<br>