From 4f39ef14162fce9f9f05f3eff12aa43bf867af96 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Mon, 17 Jul 2023 15:31:09 -0700 Subject: [PATCH] Fix export to CSV from D-STAR radios 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 --- chirp/drivers/generic_csv.py | 7 +++++++ chirp/wxui/memedit.py | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/chirp/drivers/generic_csv.py b/chirp/drivers/generic_csv.py index 92eb071b1..7aa00ab64 100644 --- a/chirp/drivers/generic_csv.py +++ b/chirp/drivers/generic_csv.py @@ -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""" diff --git a/chirp/wxui/memedit.py b/chirp/wxui/memedit.py index 02a7b6430..3fa29091e 100644 --- a/chirp/wxui/memedit.py +++ b/chirp/wxui/memedit.py @@ -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)