[chirp_devel] [PATCH 3 of 4] merge

IZ3GME Marco
Sat Jan 21 03:52:35 PST 2012


# HG changeset patch
# User Marco Filippi <iz3gme.marco at gmail.com>
# Date 1327136565 -3600
# Node ID 60adc5361b16d92da084e775480549bb798c0505
# Parent  34c073c6188ca02caa543dd58271b84c899ec55e
# Parent  7b748c5c5f6584928431950726fe9a62be900fda
merge

diff -r 34c073c6188c -r 60adc5361b16 chirpui/mainapp.py
--- a/chirpui/mainapp.py	Sat Jan 21 10:00:34 2012 +0100
+++ b/chirpui/mainapp.py	Sat Jan 21 10:02:45 2012 +0100
@@ -867,6 +867,22 @@
         devaction = self.menu_ag.get_action("viewdeveloper")
         devaction.set_visible(action.get_active())
 
+    def do_change_language(self):
+        langs = ["Auto", "English", "Polish"]
+        d = inputdialog.ChoiceDialog(langs, parent=self,
+                                     title="Choose Language")
+        d.label.set_text(_("Choose a language or Auto to use the "
+                           "operating system default. You will need to "
+                           "restart the application before the change "
+                           "will take effect"))
+        d.label.set_line_wrap(True)
+        r = d.run()
+        if r == gtk.RESPONSE_OK:
+            print "Chose language %s" % d.choice.get_active_text()
+            conf = config.get()
+            conf.set("language", d.choice.get_active_text(), "state")
+        d.destroy()
+
     def mh(self, _action, *args):
         action = _action.get_name()
 
@@ -912,6 +928,8 @@
                         "move_up", "move_dn", "exchange",
                         "devshowraw", "devdiffraw"]:
             self.get_current_editorset().memedit.hotkey(_action)
+        elif action == "language":
+            self.do_change_language()
         else:
             return
 
@@ -951,6 +969,7 @@
         <menuitem action="devshowraw"/>
         <menuitem action="devdiffraw"/>
       </menu>
+      <menuitem action="language"/>
     </menu>
     <menu action="radio" name="radio">
       <menuitem action="download"/>
@@ -992,6 +1011,7 @@
             ('viewdeveloper', None, _("Developer"), None, None, self.mh),
             ('devshowraw', None, _('Show raw memory'), "<Control><Shift>r", None, self.mh),
             ('devdiffraw', None, _("Diff raw memories"), "<Control><Shift>d", None, self.mh),
+            ('language', None, _("Change language"), None, None, self.mh),
             ('radio', None, _("_Radio"), None, None, self.mh),
             ('download', None, _("Download From Radio"), "<Alt>d", None, self.mh),
             ('upload', None, _("Upload To Radio"), "<Alt>u", None, self.mh),
diff -r 34c073c6188c -r 60adc5361b16 chirpw
--- a/chirpw	Sat Jan 21 10:00:34 2012 +0100
+++ b/chirpw	Sat Jan 21 10:02:45 2012 +0100
@@ -17,6 +17,7 @@
 
 
 from chirp import platform, CHIRP_VERSION
+from chirpui import config
 
 # Hack to setup environment
 platform.get_platform()
@@ -45,6 +46,17 @@
 if not os.path.exists(localepath):
     localepath = "/usr/share/chirp/locale"
 
+conf = config.get()
+manual_language = conf.get("language", "state")
+if manual_language and manual_language != "Auto":
+    lang_codes = { "English" : "en_US",
+                   "Polish"  : "pl",
+                   }
+    try:
+        os.environ["LANG"] = lang_codes[manual_language]
+    except KeyError:
+        print "Unsupported language `%s'" % manual_language
+
 langs = []
 lc, encoding = locale.getdefaultlocale()
 if (lc):
diff -r 34c073c6188c -r 60adc5361b16 tests/run_tests
--- a/tests/run_tests	Sat Jan 21 10:00:34 2012 +0100
+++ b/tests/run_tests	Sat Jan 21 10:02:45 2012 +0100
@@ -261,8 +261,8 @@
             for tmode in rf.valid_tmodes:
                 if tmode not in chirp_common.TONE_MODES:
                     continue
-                elif tmode in ["DTCS", "DTCS-R"]:
-                    continue # We'll test DCS separately
+                elif tmode in ["DTCS", "DTCS-R", "Cross"]:
+                    continue # We'll test DCS and Cross tones separately
 
                 m.tmode = tmode
                 if tmode == "":
@@ -301,6 +301,15 @@
             m.dtcs_polarity = pol
             self.set_and_compare(m)
 
+    def do_cross(self, m, rf):
+        if not rf.has_cross:
+            return
+
+        m.tmode = "Cross"
+        for cross_mode in chirp_common.CROSS_MODES:
+            m.cross_mode = cross_mode
+            self.set_and_compare(m)
+
     def do_duplex(self, m, rf):
         for duplex in rf.valid_duplexes:
             if duplex not in ["", "-", "+", "split"]:
@@ -351,6 +360,7 @@
 
         self.do_tone(clean_mem(), rf)
         self.do_dtcs(clean_mem(), rf)
+        self.do_cross(clean_mem(), rf)
         self.do_duplex(clean_mem(), rf)
         self.do_skip(clean_mem(), rf)
         self.do_mode(clean_mem(), rf)



More information about the chirp_devel mailing list