[GRASS-SVN] r73289 - grass/trunk/gui/wxpython/gui_core

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Sep 7 15:41:49 PDT 2018


Author: martinl
Date: 2018-09-07 15:41:49 -0700 (Fri, 07 Sep 2018)
New Revision: 73289

Modified:
   grass/trunk/gui/wxpython/gui_core/ghelp.py
Log:
wxGUI: fix About dialog for Python3

Modified: grass/trunk/gui/wxpython/gui_core/ghelp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/ghelp.py	2018-09-07 21:36:50 UTC (rev 73288)
+++ grass/trunk/gui/wxpython/gui_core/ghelp.py	2018-09-07 22:41:49 UTC (rev 73289)
@@ -25,6 +25,11 @@
 import sys
 import six
 
+if sys.version_info.major == 2:
+    _unichr = unichr
+else:
+    _unichr = chr
+
 import wx
 from wx.html import HtmlWindow
 try:
@@ -323,9 +328,8 @@
         # credits
         authfile = os.path.join(os.getenv("GISBASE"), "AUTHORS")
         if os.path.exists(authfile):
-            authorsFile = open(authfile, 'r')
-            authors = unicode(''.join(authorsFile.readlines()), "utf-8")
-            authorsFile.close()
+            with codecs.open(authfile, encoding='utf-8', mode='r') as authorsFile:
+                authors = ''.join(authorsFile.readlines())
         else:
             authors = _('%s file missing') % 'AUTHORS'
         authorwin = ScrolledPanel(self.aboutNotebook)
@@ -431,7 +435,7 @@
         """Translators info"""
         translatorsfile = os.path.join(os.getenv("GISBASE"), "translators.csv")
         if os.path.exists(translatorsfile):
-            translatorsFile = open(translatorsfile, 'r')
+            translatorsFile = codecs.open(translatorsfile, encoding='utf-8', mode='r')
             translators = dict()
             errLines = list()
             for line in translatorsFile.readlines()[1:]:
@@ -494,9 +498,7 @@
                         StaticText(
                             parent=translatorswin,
                             id=wx.ID_ANY,
-                            label=unicode(
-                                name,
-                                "utf-8")))
+                            label=name))
                     translatorsBox.Add(
                         StaticText(
                             parent=translatorswin,
@@ -926,7 +928,7 @@
         end = date.today().year
 
     return '%(c)s %(start)s-%(end)s by the GRASS Development Team' % {
-        'c': unichr(169), 'start': start, 'end': end}
+        'c': _unichr(169), 'start': start, 'end': end}
 
 
 def main():



More information about the grass-commit mailing list