Browse Source

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 years ago
parent
commit
4bb3c068b9
2 changed files with 17 additions and 4 deletions
  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 sys
 import locale
+import platform
 
 import wx
 import wx.lib.mixins.listctrl as listmix
@@ -261,6 +262,7 @@ class CoordinateSystemPage(TitledPage):
                                              "coordinate system (XY)"))
         # layout
         self.sizer.AddGrowableCol(1)
+        self.sizer.SetVGap(10)
         self.sizer.Add(item=self.radio1,
                        flag=wx.ALIGN_LEFT, pos=(1, 1))
         self.sizer.Add(item=self.radio2,
@@ -1238,7 +1240,7 @@ class EPSGPage(TitledPage):
                                        style=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
 
         # 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.tcode = self.MakeTextCtrl(size=(200,-1))
 
@@ -1397,9 +1399,10 @@ class EPSGPage(TitledPage):
             i = 0
             code = None
             for line in f.readlines():
-
                 line = line.strip()
-
+                if len(line) < 1:
+                    continue
+                
                 if line[0] == '#':
                     descr = line[1:].strip()
                 elif line[0] == '<':

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

@@ -16,6 +16,7 @@ for details.
 
 import os
 import sys
+import platform
 
 import globalvar
 grassPath = os.path.join(globalvar.ETCDIR, "python")
@@ -50,7 +51,7 @@ def GetTempfile(pref=None):
 
     # FIXME
     # ugly hack for MSYS (MS Windows)
-    if subprocess.mswindows:
+    if platform.system() == 'Windows':
 	tempfile = tempfile.replace("/", "\\")
     try:
         path, file = os.path.split(tempfile)
@@ -356,6 +357,15 @@ def CmdToTuple(cmd):
     return (cmd[0],
             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():
     """Re-execute Python on Mac OS"""
     if sys.platform == 'darwin' and \