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

Marco Filippi IZ3GME
Wed May 23 11:30:28 PDT 2012


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

diff -r ec4361ad770f -r 5c7f25fd25b8 chirp/chirp_common.py
--- a/chirp/chirp_common.py	mar mag 22 18:23:51 2012 +0200
+++ b/chirp/chirp_common.py	mer mag 23 20:19:35 2012 +0200
@@ -56,6 +56,7 @@
     "DTCS->",
     "->Tone",
     "->DTCS",
+    "DTCS->DTCS",
 ]
 
 MODES = ["WFM", "FM", "NFM", "AM", "NAM", "DV", "USB", "LSB", "CW", "RTTY",
@@ -213,6 +214,7 @@
     rtone = 88.5
     ctone = 88.5
     dtcs = 23
+    rx_dtcs = 23
     tmode = ""
     cross_mode = "Tone->Tone"
     dtcs_polarity = "NN"
@@ -242,6 +244,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 +265,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 +448,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 +625,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 +714,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 5c7f25fd25b8 chirpui/memedit.py
--- a/chirpui/memedit.py	mar mag 22 18:23:51 2012 +0200
+++ b/chirpui/memedit.py	mer mag 23 20:19:35 2012 +0200
@@ -60,56 +60,59 @@
 
 class MemoryEditor(common.Editor):
     cols = [
-        (_("Loc")       , TYPE_INT,     gtk.CellRendererText,  ),
-        (_("Frequency") , TYPE_INT64,   gtk.CellRendererText,  ),
-        (_("Name")      , TYPE_STRING,  gtk.CellRendererText,  ), 
-        (_("Tone Mode") , TYPE_STRING,  gtk.CellRendererCombo, ),
-        (_("Tone")      , TYPE_FLOAT,   gtk.CellRendererCombo, ),
-        (_("ToneSql")   , TYPE_FLOAT,   gtk.CellRendererCombo, ),
-        (_("DTCS Code") , TYPE_INT,     gtk.CellRendererCombo, ),
-        (_("DTCS Pol")  , TYPE_STRING,  gtk.CellRendererCombo, ),
-        (_("Cross Mode"), TYPE_STRING,  gtk.CellRendererCombo, ),
-        (_("Duplex")    , TYPE_STRING,  gtk.CellRendererCombo, ),
-        (_("Offset")    , TYPE_INT64,   gtk.CellRendererText,  ),
-        (_("Mode")      , TYPE_STRING,  gtk.CellRendererCombo, ),
-        (_("Power")     , TYPE_STRING,  gtk.CellRendererCombo, ),
-        (_("Tune Step") , TYPE_FLOAT,   gtk.CellRendererCombo, ),
-        (_("Skip")      , TYPE_STRING,  gtk.CellRendererCombo, ),
-        (_("Comment")   , TYPE_STRING,  gtk.CellRendererText,  ),
-        ("_filled"      , TYPE_BOOLEAN, None,                  ),
-        ("_hide_cols"   , TYPE_PYOBJECT,None,                  ),
-        ("_extd"        , TYPE_STRING,  None,                  ),
+        (_("Loc")           , TYPE_INT,     gtk.CellRendererText,  ),
+        (_("Frequency")     , TYPE_INT64,   gtk.CellRendererText,  ),
+        (_("Name")          , TYPE_STRING,  gtk.CellRendererText,  ), 
+        (_("Tone Mode")     , TYPE_STRING,  gtk.CellRendererCombo, ),
+        (_("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, ),
+        (_("Offset")        , TYPE_INT64,   gtk.CellRendererText,  ),
+        (_("Mode")          , TYPE_STRING,  gtk.CellRendererCombo, ),
+        (_("Power")         , TYPE_STRING,  gtk.CellRendererCombo, ),
+        (_("Tune Step")     , TYPE_FLOAT,   gtk.CellRendererCombo, ),
+        (_("Skip")          , TYPE_STRING,  gtk.CellRendererCombo, ),
+        (_("Comment")       , TYPE_STRING,  gtk.CellRendererText,  ),
+        ("_filled"          , TYPE_BOOLEAN, None,                  ),
+        ("_hide_cols"       , TYPE_PYOBJECT,None,                  ),
+        ("_extd"            , TYPE_STRING,  None,                  ),
         ]
 
     defaults = {
-        _("Name")      : "",
-        _("Frequency") : 146010000,
-        _("Tone")      : 88.5,
-        _("ToneSql")   : 88.5,
-        _("DTCS Code") : 23,
-        _("DTCS Pol")  : "NN",
-        _("Cross Mode"): "Tone->Tone",
-        _("Duplex")    : "",
-        _("Offset")    : 0,
-        _("Mode")      : "FM",
-        _("Power")     : "",
-        _("Tune Step") : 5.0,
-        _("Tone Mode") : "",
-        _("Skip")      : "",
-        _("Comment")   : "",
+        _("Name")          : "",
+        _("Frequency")     : 146010000,
+        _("Tone")          : 88.5,
+        _("ToneSql")       : 88.5,
+        _("DTCS Code")     : 23,
+        _("DTCS Rx Code")  : 23,
+        _("DTCS Pol")      : "NN",
+        _("Cross Mode")    : "Tone->Tone",
+        _("Duplex")        : "",
+        _("Offset")        : 0,
+        _("Mode")          : "FM",
+        _("Power")         : "",
+        _("Tune Step")     : 5.0,
+        _("Tone Mode")     : "",
+        _("Skip")          : "",
+        _("Comment")       : "",
         }
 
     choices = {
-        _("Tone") : chirp_common.TONES,
-        _("ToneSql") : chirp_common.TONES,
-        _("DTCS Code") : chirp_common.DTCS_CODES,
-        _("DTCS Pol") : ["NN", "NR", "RN", "RR"],
-        _("Mode") : chirp_common.MODES,
-        _("Power") : [],
-        _("Duplex") : ["", "-", "+", "split"],
-        _("Tune Step") : chirp_common.TUNING_STEPS,
-        _("Tone Mode") : ["", "Tone", "TSQL", "DTCS"],
-        _("Cross Mode") : chirp_common.CROSS_MODES,
+        _("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")         : [],
+        _("Duplex")        : ["", "-", "+", "split"],
+        _("Tune Step")     : chirp_common.TUNING_STEPS,
+        _("Tone Mode")     : ["", "Tone", "TSQL", "DTCS"],
+        _("Cross Mode")    : chirp_common.CROSS_MODES,
         }
     
     def ed_name(self, _, __, new, ___):
@@ -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