Skip to content

Commit

Permalink
Fix export to CSV from D-STAR radios
Browse files Browse the repository at this point in the history
We need to support receiving DVMemory into the exporting CSV radio.
This isn't complete support, but makes us use a subclass of CSVRadio
with IcomDstarSupport so that import_logic will agree to import the
memories.

Fixes: #10724
  • Loading branch information
kk7ds committed Jul 17, 2023
1 parent 3953172 commit 4f39ef1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions chirp/drivers/generic_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,13 @@ def match_model(cls, filedata, filename):
(filedata.startswith("Location,") or filedata == "")


# This is not enough to actually behave like a D-STAR radio because we need
# to use this class when opening files. However, it's enough for export to
# CSV
class DSTARCSVRadio(CSVRadio, chirp_common.IcomDstarSupport):
pass


@directory.register
class CommanderCSVRadio(CSVRadio):
"""A driver for reading CSV files generated by KG-UV Commander software"""
Expand Down
5 changes: 4 additions & 1 deletion chirp/wxui/memedit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2014,7 +2014,10 @@ def export_to_file(self, filename):
selected = self._grid.GetSelectedRows()
if len(selected) <= 1:
selected = range(0, self._grid.GetNumberRows())
r = generic_csv.CSVRadio(None)
if isinstance(self.radio, chirp_common.IcomDstarSupport):
r = generic_csv.DSTARCSVRadio(None)
else:
r = generic_csv.CSVRadio(None)
# The CSV driver defaults to a single non-empty memory at location
# zero, so delete it before we go to export.
r.erase_memory(0)
Expand Down

0 comments on commit 4f39ef1

Please sign in to comment.