# HG changeset patch # User Dan Drogichen # Date 1398452336 25200 # Fri Apr 25 11:58:56 2014 -0700 # Node ID 18eabe2d27ab7089f462de6d88a63cd9d49c1fdd # Parent e51624d6ad4b7cb72a3554356d71f26cfe503adb [csv] Friendlier defaults for missing cToneFreq/rToneFreq columns in csv import - Fixes #1577 Add a _clean_tmode() function to the generic CSVRadio class in generic_csv.py. Check for the existence of csv headings "rToneFreq" and "cToneFreq" in the header line. If exactly one is present, use the value in that column for both rTone and cTone for each channel imported. #1577 diff -r e51624d6ad4b -r 18eabe2d27ab chirp/generic_csv.py --- a/chirp/generic_csv.py Sat Apr 12 10:45:09 2014 -0700 +++ b/chirp/generic_csv.py Fri Apr 25 11:58:56 2014 -0700 @@ -119,6 +119,22 @@ return mem + def _clean_tmode(self, headers, line, mem): + """ If there is exactly one of [rToneFreq, cToneFreq] columns in the + csv file, use it for both rtone & ctone. Makes TSQL use friendlier.""" + + if not hasattr(self, "_file_has_rTone"): + self._file_has_rTone = "rToneFreq" in headers + if not hasattr(self, "_file_has_cTone"): + self._file_has_cTone = "cToneFreq" in headers + + if self._file_has_rTone and not self._file_has_cTone: + mem.ctone = mem.rtone + elif self._file_has_cTone and not self._file_has_rTone: + mem.rtone = mem.ctone + + return mem + def _parse_csv_data_line(self, headers, line): mem = chirp_common.Memory() try: