adonthell-commits
[Top][All Lists]
Advanced

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

[adonthell-wastesedge-commits] master 6fe08b7 06/21: FIXED label size no


From: Kai Sterker
Subject: [adonthell-wastesedge-commits] master 6fe08b7 06/21: FIXED label size not adjusted properly after changing option value
Date: Mon, 25 Jul 2016 18:16:38 +0000 (UTC)

branch: master
commit 6fe08b749e5d2123108b1f5b0cc424274041922e
Author: Kai Sterker <address@hidden>
Commit: Kai Sterker <address@hidden>

    FIXED label size not adjusted properly after changing option value
    FIXED display of language names containing non-ASCII characters
---
 scripts/modules/option_screen.py |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/scripts/modules/option_screen.py b/scripts/modules/option_screen.py
index 1b2c885..c96e3d1 100644
--- a/scripts/modules/option_screen.py
+++ b/scripts/modules/option_screen.py
@@ -13,6 +13,10 @@
 #
 
 import adonthell
+import codecs
+
+# -- properly encode unicode strings across python versions
+def u(x): return codecs.unicode_escape_decode(x)[0]
 
 # -- pygettext support
 def _(message): return adonthell.nls_translate (message)
@@ -28,14 +32,17 @@ class option_screen (adonthell.win_container):
         #    Default will try to use the system language
         #    English is the builtin language, so uses the C locale
         #    Others are the actual translations that are included
+        
+        #    note that for the language we always try to display
+        #    the native form, which requires escaping any unicode
+        #    characters and also fooling xgettext by splitting the
+        #    actual unicode literals in 2 halves
         self.languages = [ \
             ("", _("Default")), \
             ("C", "English"), \
             ("da_DA", "Dansk"), \
-        #    ("es_ES", "Espa\xf1ol"), \
-        #    ("fr_FR", "Fran\xe7ais"), \
-            ("es_ES", "Espanol"), \
-            ("fr_FR", "Francais"), \
+            ("es_ES", u("Espa\\"+"xf1ol")), \
+            ("fr_FR", u("Fran\\"+"xe7ais")), \
             ("it_IT", "Italiano"), \
             ("nl_NL", "Nederlands")]
         
@@ -231,4 +238,5 @@ class option_screen (adonthell.win_container):
 
         if label != None:
             label.move (100 + (80 - label.length())//2, 0)
-        
\ No newline at end of file
+            label.pack()
+            
\ No newline at end of file



reply via email to

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