[chirp_devel] [PATCH 1 of 2] [RFC] Declare a network source radio type and make editorset run do_fetch()
Dan Smith
Thu Apr 12 15:52:54 PDT 2012
# HG changeset patch
# User Dan Smith <dsmith at danplanet.com>
# Date 1334271107 25200
# Node ID 61f7edad8abd2c570a5f4d57a520183acd3ca93c
# Parent 0ee4af13c81f43101fddfa04119a6459560094bf
[RFC] Declare a network source radio type and make editorset run do_fetch()
before starting the import. This gives us time to show status for sources
that need it and give it to us (such as RadioReference).
Bug #00
diff -r 0ee4af13c81f -r 61f7edad8abd chirp/chirp_common.py
--- a/chirp/chirp_common.py Wed Apr 11 13:23:24 2012 +0200
+++ b/chirp/chirp_common.py Thu Apr 12 15:51:47 2012 -0700
@@ -1010,6 +1010,10 @@
class LiveRadio(Radio):
pass
+class NetworkSourceRadio(Radio):
+ def do_fetch(self):
+ pass
+
class IcomDstarSupport:
MYCALL_LIMIT = (1, 1)
URCALL_LIMIT = (1, 1)
diff -r 0ee4af13c81f -r 61f7edad8abd chirpui/editorset.py
--- a/chirpui/editorset.py Wed Apr 11 13:23:24 2012 +0200
+++ b/chirpui/editorset.py Thu Apr 12 15:51:47 2012 -0700
@@ -251,6 +251,25 @@
def do_import(self, filen):
try:
src_radio = directory.get_radio_by_image(filen)
+ except Exception, e:
+ common.show_error(e)
+ return
+
+ if isinstance(src_radio, chirp_common.NetworkSourceRadio):
+ ww = importdialog.WaitWindow("Querying...", self.parent_window)
+ ww.show()
+ def status(status):
+ ww.set(float(status.cur) / float(status.max), status.msg)
+ try:
+ src_radio.status_fn = status
+ src_radio.do_fetch()
+ except Exception, e:
+ common.show_error(e)
+ ww.hide()
+ return
+ ww.hide()
+
+ try:
if src_radio.get_features().has_sub_devices:
src_radio = self.choose_sub_device(src_radio)
except Exception, e:
More information about the chirp_devel
mailing list