[chirp_devel] [PATCH 1 of 2] Add rx_dtcs and additional tone/dtcs modes support in UI

Marco Filippi IZ3GME
Tue May 22 12:10:30 PDT 2012


# HG changeset patch
# User Marco Filippi <iz3gme.marco at gmail.com>
# Date 1337713098 -7200
# Node ID 9bdc33a4911e933402243f6fa61e607b80228f9b
# Parent  ec4361ad770faedf0e25f697e9f74a3a80beb475
Add rx_dtcs and additional tone/dtcs modes support in UI
needed for Feature #100

diff -r ec4361ad770f -r 9bdc33a4911e chirp/chirp_common.py
--- a/chirp/chirp_common.py	mar mag 22 18:23:51 2012 +0200
+++ b/chirp/chirp_common.py	mar mag 22 20:58:18 2012 +0200
@@ -56,6 +56,8 @@
     "DTCS->",
     "->Tone",
     "->DTCS",
+    "Tone->",
+    "DTCS->DTCS",
 ]
 
 MODES = ["WFM", "FM", "NFM", "AM", "NAM", "DV", "USB", "LSB", "CW", "RTTY",
@@ -121,6 +123,7 @@
     "DTCS-R",
     "TSQL-R",
     "Cross",
+    "DTCS Enc",
 ]
 
 TUNING_STEPS = [
@@ -213,6 +216,7 @@
     rtone = 88.5
     ctone = 88.5
     dtcs = 23
+    rx_dtcs = 23
     tmode = ""
     cross_mode = "Tone->Tone"
     dtcs_polarity = "NN"
@@ -242,6 +246,7 @@
         self.rtone = 88.5                 
         self.ctone = 88.5                 
         self.dtcs = 23                    
+        self.rx_dtcs = 23                    
         self.tmode = ""                   
         self.cross_mode = "Tone->Tone"      
         self.dtcs_polarity = "NN"         
@@ -262,6 +267,7 @@
         "rtone"         : TONES,
         "ctone"         : TONES,
         "dtcs"          : DTCS_CODES + DTCS_EXTRA_CODES,
+        "rx_dtcs"          : DTCS_CODES + DTCS_EXTRA_CODES,
         "tmode"         : TONE_MODES,
         "dtcs_polarity" : ["NN", "NR", "RN", "RR"],
         "cross_mode"    : CROSS_MODES,
@@ -444,6 +450,13 @@
         if self.dtcs not in DTCS_CODES:
             raise errors.InvalidDataError("DTCS code is not valid")
 
+        try:
+            self.rx_dtcs = int(vals[8], 10)
+        except:
+            raise errors.InvalidDataError("DTCS Rx code is not a valid number")
+        if self.rx_dtcs not in DTCS_CODES:
+            raise errors.InvalidDataError("DTCS Rx code is not valid")
+
         if vals[9] in ["NN", "NR", "RN", "RR"]:
             self.dtcs_polarity = vals[9]
         else:
@@ -614,6 +627,7 @@
         # General
         "has_bank_index"      : BOOLEAN,
         "has_dtcs"            : BOOLEAN,
+        "has_rx_dtcs"         : BOOLEAN,
         "has_dtcs_polarity"   : BOOLEAN,
         "has_mode"            : BOOLEAN,
         "has_offset"          : BOOLEAN,
@@ -702,6 +716,8 @@
                   "an order other than in main memory")
         self.init("has_dtcs", True,
                   "Indicates that DTCS tone mode is available")
+        self.init("has_rx_dtcs", False,
+                  "Indicates that radio can use two different DTCS codes for rx and tx")
         self.init("has_dtcs_polarity", True,
                   "Indicates that the DTCS polarity can be changed")
         self.init("has_mode", True,
diff -r ec4361ad770f -r 9bdc33a4911e chirpui/memedit.py
--- a/chirpui/memedit.py	mar mag 22 18:23:51 2012 +0200
+++ b/chirpui/memedit.py	mar mag 22 20:58:18 2012 +0200
@@ -67,6 +67,7 @@
         (_("Tone")      , TYPE_FLOAT,   gtk.CellRendererCombo, ),
         (_("ToneSql")   , TYPE_FLOAT,   gtk.CellRendererCombo, ),
         (_("DTCS Code") , TYPE_INT,     gtk.CellRendererCombo, ),
+        (_("DTCS Rx Code") , TYPE_INT,     gtk.CellRendererCombo, ),
         (_("DTCS Pol")  , TYPE_STRING,  gtk.CellRendererCombo, ),
         (_("Cross Mode"), TYPE_STRING,  gtk.CellRendererCombo, ),
         (_("Duplex")    , TYPE_STRING,  gtk.CellRendererCombo, ),
@@ -87,6 +88,7 @@
         _("Tone")      : 88.5,
         _("ToneSql")   : 88.5,
         _("DTCS Code") : 23,
+        _("DTCS Rx Code") : 23,
         _("DTCS Pol")  : "NN",
         _("Cross Mode"): "Tone->Tone",
         _("Duplex")    : "",
@@ -103,6 +105,7 @@
         _("Tone") : chirp_common.TONES,
         _("ToneSql") : chirp_common.TONES,
         _("DTCS Code") : chirp_common.DTCS_CODES,
+        _("DTCS Rx Code") : chirp_common.DTCS_CODES,
         _("DTCS Pol") : ["NN", "NR", "RN", "RR"],
         _("Mode") : chirp_common.MODES,
         _("Power") : [],
@@ -206,19 +209,24 @@
         if tmode == "Tone":
             hide += [self.col(_("ToneSql")),
                      self.col(_("DTCS Code")),
+                     self.col(_("DTCS Rx Code")),
                      self.col(_("DTCS Pol"))]
         elif tmode == "TSQL":
             if self._features.has_ctone:
                 hide += [self.col(_("Tone"))]
 
             hide += [self.col(_("DTCS Code")),
+                     self.col(_("DTCS Rx Code")),
                      self.col(_("DTCS Pol"))]
         elif tmode == "DTCS":
-            hide += [self.col(_("Tone")), self.col(_("ToneSql"))]
+            hide += [self.col(_("Tone")),
+                     self.col(_("DTCS Rx Code")),
+                     self.col(_("ToneSql"))]
         elif tmode == "" or tmode == "(None)":
             hide += [self.col(_("Tone")),
                      self.col(_("ToneSql")),
                      self.col(_("DTCS Code")),
+                     self.col(_("DTCS Rx Code")),
                      self.col(_("DTCS Pol"))]
 
         if duplex == "" or duplex == "(None)":
@@ -303,7 +311,7 @@
 
         if colnum == self.col(_("Frequency")):
             val = chirp_common.format_freq(val)
-        elif colnum == self.col(_("DTCS Code")):
+        elif colnum in [self.col(_("DTCS Code")), self.col(_("DTCS Rx Code"))]:
             val = "%03i" % int(val)
         elif colnum == self.col(_("Offset")):
             val = chirp_common.format_freq(val)
@@ -890,6 +898,7 @@
                        self.col(_("Tone")), memory.rtone,
                        self.col(_("ToneSql")), memory.ctone,
                        self.col(_("DTCS Code")), memory.dtcs,
+                       self.col(_("DTCS Rx Code")), memory.rx_dtcs,
                        self.col(_("DTCS Pol")), memory.dtcs_polarity,
                        self.col(_("Cross Mode")), memory.cross_mode,
                        self.col(_("Duplex")), memory.duplex,
@@ -944,6 +953,7 @@
         mem.rtone = vals[self.col(_("Tone"))]
         mem.ctone = vals[self.col(_("ToneSql"))]
         mem.dtcs = vals[self.col(_("DTCS Code"))]
+        mem.rx_dtcs = vals[self.col(_("DTCS Rx Code"))]
         mem.tmode = vals[self.col(_("Tone Mode"))]
         mem.cross_mode = vals[self.col(_("Cross Mode"))]
         mem.dtcs_polarity = vals[self.col(_("DTCS Pol"))]
@@ -1076,6 +1086,7 @@
     def get_unsupported_columns(self):
         maybe_hide = [
             ("has_dtcs", _("DTCS Code")),
+            ("has_rx_dtcs", _("DTCS Rx Code")),
             ("has_dtcs_polarity", _("DTCS Pol")),
             ("has_mode", _("Mode")),
             ("has_offset", _("Offset")),



More information about the chirp_devel mailing list