浏览代码

wxGUI: fix MS Windows-related bugs in Location Wizard (osgeo4w https://trac.osgeo.org/grass/ticket/37)
(merge from relbr64, https://trac.osgeo.org/grass/changeset/35981)


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@35983 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 16 年之前
父节点
当前提交
4bb3c068b9
共有 2 个文件被更改,包括 17 次插入4 次删除
  1. 6 3
      gui/wxpython/gui_modules/location_wizard.py
  2. 11 1
      gui/wxpython/gui_modules/utils.py

+ 6 - 3
gui/wxpython/gui_modules/location_wizard.py

@@ -37,6 +37,7 @@ import re
 import string
 import string
 import sys
 import sys
 import locale
 import locale
+import platform
 
 
 import wx
 import wx
 import wx.lib.mixins.listctrl as listmix
 import wx.lib.mixins.listctrl as listmix
@@ -261,6 +262,7 @@ class CoordinateSystemPage(TitledPage):
                                              "coordinate system (XY)"))
                                              "coordinate system (XY)"))
         # layout
         # layout
         self.sizer.AddGrowableCol(1)
         self.sizer.AddGrowableCol(1)
+        self.sizer.SetVGap(10)
         self.sizer.Add(item=self.radio1,
         self.sizer.Add(item=self.radio1,
                        flag=wx.ALIGN_LEFT, pos=(1, 1))
                        flag=wx.ALIGN_LEFT, pos=(1, 1))
         self.sizer.Add(item=self.radio2,
         self.sizer.Add(item=self.radio2,
@@ -1238,7 +1240,7 @@ class EPSGPage(TitledPage):
                                        style=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
                                        style=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
 
 
         # text input
         # text input
-        epsgdir = os.path.join(os.environ["GRASS_PROJSHARE"], 'epsg')
+        epsgdir = utils.PathJoin(os.environ["GRASS_PROJSHARE"], 'epsg')
         self.tfile = self.MakeTextCtrl(text=epsgdir, size=(200,-1))
         self.tfile = self.MakeTextCtrl(text=epsgdir, size=(200,-1))
         self.tcode = self.MakeTextCtrl(size=(200,-1))
         self.tcode = self.MakeTextCtrl(size=(200,-1))
 
 
@@ -1397,9 +1399,10 @@ class EPSGPage(TitledPage):
             i = 0
             i = 0
             code = None
             code = None
             for line in f.readlines():
             for line in f.readlines():
-
                 line = line.strip()
                 line = line.strip()
-
+                if len(line) < 1:
+                    continue
+                
                 if line[0] == '#':
                 if line[0] == '#':
                     descr = line[1:].strip()
                     descr = line[1:].strip()
                 elif line[0] == '<':
                 elif line[0] == '<':

+ 11 - 1
gui/wxpython/gui_modules/utils.py

@@ -16,6 +16,7 @@ for details.
 
 
 import os
 import os
 import sys
 import sys
+import platform
 
 
 import globalvar
 import globalvar
 grassPath = os.path.join(globalvar.ETCDIR, "python")
 grassPath = os.path.join(globalvar.ETCDIR, "python")
@@ -50,7 +51,7 @@ def GetTempfile(pref=None):
 
 
     # FIXME
     # FIXME
     # ugly hack for MSYS (MS Windows)
     # ugly hack for MSYS (MS Windows)
-    if subprocess.mswindows:
+    if platform.system() == 'Windows':
 	tempfile = tempfile.replace("/", "\\")
 	tempfile = tempfile.replace("/", "\\")
     try:
     try:
         path, file = os.path.split(tempfile)
         path, file = os.path.split(tempfile)
@@ -356,6 +357,15 @@ def CmdToTuple(cmd):
     return (cmd[0],
     return (cmd[0],
             dcmd)
             dcmd)
 
 
+def PathJoin(*args):
+    """Check path created by os.path.join"""
+    path = os.path.join(*args)
+    if platform.system() == 'Windows' and \
+            '/' in path:
+        return path[1].upper() + ':\\' + path[3:].replace('/', '\\')
+    
+    return path
+    
 def reexec_with_pythonw():
 def reexec_with_pythonw():
     """Re-execute Python on Mac OS"""
     """Re-execute Python on Mac OS"""
     if sys.platform == 'darwin' and \
     if sys.platform == 'darwin' and \