[GRASS-SVN] r70936 - grass/trunk/gui/wxpython/core

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Apr 22 14:00:05 PDT 2017


Author: martinl
Date: 2017-04-22 14:00:04 -0700 (Sat, 22 Apr 2017)
New Revision: 70936

Modified:
   grass/trunk/gui/wxpython/core/gcmd.py
   grass/trunk/gui/wxpython/core/settings.py
Log:
wxGUI: some steps to support Python 3

Modified: grass/trunk/gui/wxpython/core/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/core/gcmd.py	2017-04-22 20:59:15 UTC (rev 70935)
+++ grass/trunk/gui/wxpython/core/gcmd.py	2017-04-22 21:00:04 UTC (rev 70936)
@@ -33,7 +33,7 @@
 import traceback
 import locale
 import subprocess
-if subprocess.mswindows:
+if sys.platform == 'win32':
     from win32file import ReadFile, WriteFile
     from win32pipe import PeekNamedPipe
     import msvcrt
@@ -238,7 +238,7 @@
             except OSError:
                 pass
 
-    if subprocess.mswindows:
+    if sys.platform == 'win32':
         def send(self, input):
             if not self.stdin:
                 return None

Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py	2017-04-22 20:59:15 UTC (rev 70935)
+++ grass/trunk/gui/wxpython/core/settings.py	2017-04-22 21:00:04 UTC (rev 70936)
@@ -22,7 +22,6 @@
 import os
 import sys
 import copy
-import types
 
 from core import globalvar
 from core.gcmd import GException, GError
@@ -1028,7 +1027,7 @@
                     file.write('%s%s%s%s' % (group, self.sep, key, self.sep))
                     for idx in range(len(subkeys)):
                         value = settings[group][key][subkeys[idx]]
-                        if isinstance(value, types.DictType):
+                        if isinstance(value, dict):
                             if idx > 0:
                                 file.write(
                                     '%s%s%s%s%s' %
@@ -1047,9 +1046,8 @@
                                     file.write('%s' % self.sep)
                         else:
                             if idx > 0 and isinstance(
-                                    settings[group][key]
-                                    [subkeys[idx - 1]],
-                                    types.DictType):
+                                    settings[group][key][subkeys[idx - 1]],
+                                    dict):
                                 file.write(
                                     '%s%s%s%s%s' %
                                     (os.linesep, group, self.sep, key, self.sep))
@@ -1060,7 +1058,7 @@
                                 (subkeys[idx], self.sep, value))
                             if idx < len(subkeys) - 1 and not isinstance(
                                     settings[group][key][subkeys[idx + 1]],
-                                    types.DictType):
+                                    dict):
                                 file.write('%s' % self.sep)
                     file.write(os.linesep)
         except IOError as e:
@@ -1196,7 +1194,7 @@
             dict[group][key] = {}
             hasValue = False
 
-        if isinstance(subkey, types.ListType):
+        if isinstance(subkey, list):
             # TODO: len(subkey) > 2
             if subkey[0] not in dict[group][key]:
                 dict[group][key][subkey[0]] = {}



More information about the grass-commit mailing list