<div dir="ltr">Resending patch for consideration.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Apr 17, 2021 at 12:11 AM Kosta A. <<a href="mailto:ve7kcy@gmail.com">ve7kcy@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"># HG changeset patch<br>
# User Kosta A. <<a href="mailto:ve7kcy@gmail.com" target="_blank">ve7kcy@gmail.com</a>><br>
# Date 1618643404 25200<br>
# Sat Apr 17 00:10:04 2021 -0700<br>
# Node ID cd3e2444040876b4a19b41c6cfecedb79ff4a8fe<br>
# Parent 42c5ae551170c33b04f997e3a07a9e1857bdb504<br>
[csv] Optimize generic csv files load times. Fixes #8991<br>
<br>
diff --git a/chirp/chirp_common.py b/chirp/chirp_common.py<br>
--- a/chirp/chirp_common.py<br>
+++ b/chirp/chirp_common.py<br>
@@ -268,11 +268,11 @@<br>
# or an empty list if none<br>
extra = []<br>
<br>
- def __init__(self):<br>
+ def __init__(self, number=0, empty=False, name=""):<br>
self.freq = 0<br>
- self.number = 0<br>
+ self.number = number<br>
self.extd_number = ""<br>
- <a href="http://self.name" rel="noreferrer" target="_blank">self.name</a> = ""<br>
+ <a href="http://self.name" rel="noreferrer" target="_blank">self.name</a> = name<br>
self.vfo = 0<br>
self.rtone = 88.5<br>
self.ctone = 88.5<br>
@@ -290,7 +290,7 @@<br>
<br>
self.comment = ""<br>
<br>
- self.empty = False<br>
+ self.empty = empty<br>
<br>
self.immutable = []<br>
<br>
diff --git a/chirp/drivers/generic_csv.py b/chirp/drivers/generic_csv.py<br>
--- a/chirp/drivers/generic_csv.py<br>
+++ b/chirp/drivers/generic_csv.py<br>
@@ -47,7 +47,7 @@<br>
<br>
<br>
@directory.register<br>
-class CSVRadio(chirp_common.FileBackedRadio, chirp_common.IcomDstarSupport):<br>
+class CSVRadio(chirp_common.FileBackedRadio):<br>
"""A driver for Generic CSV files"""<br>
VENDOR = "Generic"<br>
MODEL = "CSV"<br>
@@ -67,20 +67,15 @@<br>
"Mode": (str, "mode"),<br>
"TStep": (float, "tuning_step"),<br>
"Skip": (str, "skip"),<br>
- "URCALL": (str, "dv_urcall"),<br>
- "RPT1CALL": (str, "dv_rpt1call"),<br>
- "RPT2CALL": (str, "dv_rpt2call"),<br>
"Comment": (str, "comment"),<br>
}<br>
<br>
- def _blank(self):<br>
+ def _blank(self, defaults=False):<br>
self.errors = []<br>
- self.memories = []<br>
- for i in range(0, 1000):<br>
- mem = chirp_common.Memory()<br>
- mem.number = i<br>
- mem.empty = True<br>
- self.memories.append(mem)<br>
+ self.memories = [chirp_common.Memory(i, True) for i in range(0, 1000)]<br>
+ if (defaults):<br>
+ self.memories[0].empty = False<br>
+ self.memories[0].freq = 146010000<br>
<br>
def __init__(self, pipe):<br>
chirp_common.FileBackedRadio.__init__(self, None)<br>
@@ -92,14 +87,14 @@<br>
if self._filename and os.path.exists(self._filename):<br>
self.load()<br>
else:<br>
- self._blank()<br>
+ self._blank(True)<br>
<br>
def get_features(self):<br>
rf = chirp_common.RadioFeatures()<br>
rf.has_bank = False<br>
rf.requires_call_lists = False<br>
rf.has_implicit_calls = False<br>
- rf.memory_bounds = (0, len(self.memories))<br>
+ rf.memory_bounds = (0, len(self.memories)-1)<br>
rf.has_infinite_number = True<br>
rf.has_nostep_tuning = True<br>
rf.has_comment = True<br>
diff --git a/chirp/drivers/ic2200.py b/chirp/drivers/ic2200.py<br>
--- a/chirp/drivers/ic2200.py<br>
+++ b/chirp/drivers/ic2200.py<br>
@@ -217,7 +217,6 @@<br>
return mem<br>
<br>
def get_memories(self, lo=0, hi=199):<br>
-<br>
return [m for m in self._memories if m.number >= lo and m.number <= hi]<br>
<br>
def set_memory(self, mem):<br>
diff --git a/chirp/ui/bandplans.py b/chirp/ui/bandplans.py<br>
--- a/chirp/ui/bandplans.py<br>
+++ b/chirp/ui/bandplans.py<br>
@@ -47,7 +47,7 @@<br>
# Check for duplicates.<br>
duplicates = [x for x in plan.BANDS if x == band]<br>
if len(duplicates) > 1:<br>
- LOG.warn("Bandplan %s has duplicates %s" %<br>
+ LOG.info("Bandplan %s has duplicates %s" %<br>
(name, duplicates))<br>
# Add repeater inputs.<br>
rpt_input = band.inverse()<br>
diff --git a/chirp/ui/editorset.py b/chirp/ui/editorset.py<br>
--- a/chirp/ui/editorset.py<br>
+++ b/chirp/ui/editorset.py<br>
@@ -386,19 +386,6 @@<br>
"export: {error}").format(error=e),<br>
self)<br>
<br>
- def prime(self):<br>
- # NOTE: this is only called to prime new CSV files, so assume<br>
- # only one memory editor for now<br>
- mem = chirp_common.Memory()<br>
- mem.freq = 146010000<br>
-<br>
- def cb(*args):<br>
- gobject.idle_add(self.editors["memedit0"].prefill)<br>
-<br>
- job = common.RadioJob(cb, "set_memory", mem)<br>
- job.set_desc(_("Priming memory"))<br>
- self.rthread.submit(job)<br>
-<br>
def tab_selected(self, notebook, foo, pagenum):<br>
widget = notebook.get_nth_page(pagenum)<br>
for k, v in self.editors.items():<br>
diff --git a/chirp/ui/mainapp.py b/chirp/ui/mainapp.py<br>
--- a/chirp/ui/mainapp.py<br>
+++ b/chirp/ui/mainapp.py<br>
@@ -271,7 +271,6 @@<br>
def do_new(self):<br>
eset = editorset.EditorSet(_("Untitled") + ".csv", self)<br>
self._connect_editorset(eset)<br>
- eset.prime()<br>
eset.show()<br>
<br>
tab = self.tabs.append_page(eset, eset.get_tab_label())<br>
diff --git a/chirp/ui/memedit.py b/chirp/ui/memedit.py<br>
--- a/chirp/ui/memedit.py<br>
+++ b/chirp/ui/memedit.py<br>
@@ -1062,10 +1062,7 @@<br>
if not mem.empty or self.show_empty:<br>
gobject.idle_add(self.set_memory, mem)<br>
else:<br>
- mem = chirp_common.Memory()<br>
- mem.number = number<br>
- <a href="http://mem.name" rel="noreferrer" target="_blank">mem.name</a> = "ERROR"<br>
- mem.empty = True<br>
+ mem = chirp_common.Memory(number, True, "Error")<br>
gobject.idle_add(self.set_memory, mem)<br>
<br>
for i in range(lo, hi+1):<br>
</blockquote></div>