gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] [PATCH 08/12] Removes unnecessary Unicode literal from xgps.


From: Fred Wright
Subject: [gpsd-dev] [PATCH 08/12] Removes unnecessary Unicode literal from xgps.
Date: Fri, 8 Apr 2016 10:07:49 -0700

Since the radio-button labels in the add_ui_from_string() text are
just internal labels not visible to the user, there's no reason that
they need to rely on non-USASCII characters.  With that text confined
to 7-bit ASCII, there's no need to use Unicode for the literal, which
in turn eliminates the last incompatibility with Python 3.2.  Note
that this isn't the only case where the internal labels mismatch the
user-visible text (the other ones involve embedded blanks).

The fact that Gtk3 assumes 'ascii' for the encoding in this case may
actually be a bug.

TESTED:
Ran xgps with Python 2.7 and 3.2-3.5 (using appropriately built
extensions).
---
 xgps | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xgps b/xgps
index 62cdb3a..d43ff7d 100755
--- a/xgps
+++ b/xgps
@@ -510,12 +510,12 @@ class Base:
               'Metric Units', 2),
              ], 0, lambda a, _unused: self.set_units(['i', 'n', 
'm'][a.get_current_value()]))
         self.actiongroup.add_radio_actions(
-            [('30°', None, '30°', None, '30°', 30),
-             ('45°', None, '45°', None, '45°', 45),
+            [('30deg', None, '30°', None, '30°', 30),
+             ('45deg', None, '45°', None, '45°', 45),
              ('Off', None, 'Off', None, 'Off', 0),
              ], 45, lambda a, _unused: 
self.set_step_of_grid(a.get_current_value()))
         self.uimanager.insert_action_group(self.actiongroup, 0)
-        self.uimanager.add_ui_from_string(u'''
+        self.uimanager.add_ui_from_string('''
 <ui>
     <menubar name="MenuBar">
       <menu action="File">
@@ -535,8 +535,8 @@ class Base:
         <menuitem action="Metric"/>
       </menu>
       <menu action="Step of grid">
-        <menuitem action="30°"/>
-        <menuitem action="45°"/>
+        <menuitem action="30deg"/>
+        <menuitem action="45deg"/>
         <menuitem action="Off"/>
       </menu>
     </menubar>
-- 
2.8.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]