# HG changeset patch # User Dan Smith dsmith@danplanet.com # Date 1334271166 25200 # Node ID a90fe5ace23ad6a26d79063c471912e504354cb8 # Parent 61f7edad8abd2c570a5f4d57a520183acd3ca93c [RFC] Make RadioReference push status during the fetch
Since we're walking a bunch of data, this helps the user not wonder if things are actually happening behind the scenes.
Tom, this should give you something to start with and hopefully improve a little. Bug #00
diff -r 61f7edad8abd -r a90fe5ace23a chirp/radioreference.py --- a/chirp/radioreference.py Thu Apr 12 15:51:47 2012 -0700 +++ b/chirp/radioreference.py Thu Apr 12 15:52:46 2012 -0700 @@ -30,7 +30,7 @@ "P25" : "P25", }
-class RadioReferenceRadio(chirp_common.Radio): +class RadioReferenceRadio(chirp_common.NetworkSourceRadio): VENDOR = "Radio Reference LLC" MODEL = "RadioReference.com"
@@ -61,15 +61,27 @@
zipcode = self._client.service.getZipcodeInfo(self._zip, self._auth) county = self._client.service.getCountyInfo(zipcode.ctid, self._auth) + + status = chirp_common.Status() + status.max = len(county.cats) + len(county.agencyList) + for cat in county.cats: + status.msg = "Fetching category %s" % cat.cName + status.cur += 1 + self.status_fn(status) print "Fetching category:", cat.cName for subcat in cat.subcats: print "\t", subcat.scName result = self._client.service.getSubcatFreqs(subcat.scid, self._auth) self._freqs += result for agency in county.agencyList: + status.cur += 1 + agency = self._client.service.getAgencyInfo(agency.aid, self._auth) for cat in agency.cats: + status.msg = "Fetching agency %s" % cat.cName + self.status_fn(status) + print "Fetching category:", cat.cName for subcat in cat.subcats: print "\t", subcat.scName @@ -153,4 +165,4 @@ print rrr.get_memory(0)
if __name__ == "__main__": - main() \ No newline at end of file + main()