[GRASS-SVN] r35835 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Feb 9 15:21:23 EST 2009


Author: martinl
Date: 2009-02-09 15:21:20 -0500 (Mon, 09 Feb 2009)
New Revision: 35835

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI: fix broken map access dialog


Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py	2009-02-09 20:20:11 UTC (rev 35834)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/preferences.py	2009-02-09 20:21:20 UTC (rev 35835)
@@ -23,8 +23,11 @@
 import sys
 import copy
 import stat
-if os.name in ('posix', 'mac'):
+try:
     import pwd
+    havePwd = True
+except ImportError:
+    havePwd = False
 
 import wx
 import wx.lib.filebrowsebutton as filebrowse
@@ -33,6 +36,7 @@
 from wx.lib.wordwrap import wordwrap
 
 import gcmd
+import grass
 import grassenv
 import utils
 import globalvar
@@ -1786,35 +1790,34 @@
         """Load data into list"""
         self.InsertColumn(0, _('Mapset'))
         self.InsertColumn(1, _('Owner'))
-        self.InsertColumn(2, _('Group'))
+        ### self.InsertColumn(2, _('Group'))
 
         locationPath = os.path.join(grassenv.GetGRASSVariable('GISDBASE'),
                                     grassenv.GetGRASSVariable('LOCATION_NAME'))
-
-        ret = grass.read_command('g.mapsets',
-                                 flags = 'l')
-        ret = ret.strip(' \n')
-
+        
+        ret = gcmd.RunCommand('g.mapsets',
+                              flags = 'l',
+                              read = True)
         mapsets = []
         if ret:
-            mapsets = ret.split()
+            mapsets = ret.rstrip(' \n').split(' ')
         
         for mapset in mapsets:
             index = self.InsertStringItem(sys.maxint, mapset)
             mapsetPath = os.path.join(locationPath,
                                       mapset)
             stat_info = os.stat(mapsetPath)
-        if os.name in ('posix', 'mac'):
-            self.SetStringItem(index, 1, "%s" % pwd.getpwuid(stat_info.st_uid)[0])
-            # FIXME: get group name
-            self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid) 
-        else:
-            # FIXME: no pwd under MS Windows (owner: 0, group: 0)
-            self.SetStringItem(index, 1, "%-8s" % stat_info.st_uid)
-            self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid)
+            if havePwd:
+                self.SetStringItem(index, 1, "%s" % pwd.getpwuid(stat_info.st_uid)[0])
+                # FIXME: get group name
+                ### self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid) 
+            else:
+                # FIXME: no pwd under MS Windows (owner: 0, group: 0)
+                self.SetStringItem(index, 1, "%-8s" % stat_info.st_uid)
+                ### self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid)
                 
         self.SetColumnWidth(col=0, width=wx.LIST_AUTOSIZE)
-        self.SetColumnWidth(col=1, width=wx.LIST_AUTOSIZE)
+        ### self.SetColumnWidth(col=1, width=wx.LIST_AUTOSIZE)
         
     def OnCheckItem(self, index, flag):
         """Mapset checked/unchecked"""



More information about the grass-commit mailing list