[GRASS-SVN] r30623 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Mar 18 16:04:19 EDT 2008


Author: martinl
Date: 2008-03-18 16:04:19 -0400 (Tue, 18 Mar 2008)
New Revision: 30623

Modified:
   grass/trunk/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI (preferences) MapsetAccess dialog MS Windows-related fix, no import pwd module available

Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py	2008-03-18 17:33:57 UTC (rev 30622)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py	2008-03-18 20:04:19 UTC (rev 30623)
@@ -23,7 +23,8 @@
 import sys
 import copy
 import stat
-import pwd
+if os.name in ('posix', 'mac'):
+    import pwd
 
 import wx
 import wx.lib.filebrowsebutton as filebrowse
@@ -1049,10 +1050,15 @@
             mapsetPath = os.path.join(locationPath,
                                       mapset)
             stat_info = os.stat(mapsetPath)
-            # FIXME: pwd is only Unix-related
-            self.SetStringItem(index, 1, "%s" % pwd.getpwuid(stat_info.st_uid)[0])
-            self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid) # FIXME
-
+	    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)
+                
         self.SetColumnWidth(col=0, width=wx.LIST_AUTOSIZE)
         self.SetColumnWidth(col=1, width=wx.LIST_AUTOSIZE)
         



More information about the grass-commit mailing list