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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 3 12:26:49 EDT 2008


Author: martinl
Date: 2008-07-03 12:26:49 -0400 (Thu, 03 Jul 2008)
New Revision: 31986

Modified:
   grass/trunk/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI: settings stored in .grasswx7 (HOME by default)


Modified: grass/trunk/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/preferences.py	2008-07-03 16:05:41 UTC (rev 31985)
+++ grass/trunk/gui/wxpython/gui_modules/preferences.py	2008-07-03 16:26:49 UTC (rev 31986)
@@ -44,7 +44,7 @@
         #
         # settings filename
         #
-        self.fileName = ".grasswx"
+        self.fileName = ".grasswx7"
         self.filePath = None
 
         #
@@ -80,7 +80,7 @@
             # advanced
             #
             'advanced' : {
-                'settingsFile'   : { 'type' : 'gisdbase' }, # gisdbase, location, mapset
+                'settingsFile'   : { 'type' : 'home' }, # home, gisdbase, location, mapset
                 'digitInterface' : { 'type' : 'vdigit' }, # vedit, vdigit
                 'iconTheme'      : { 'type' : 'silk' }, # grass, silk
                 },
@@ -275,7 +275,8 @@
                                                                      _('All available mapsets')]
         self.internalSettings['atm']['leftDbClick']['choices'] = [_('Edit selected record'),
                                                                   _('Display selected')]
-        self.internalSettings['advanced']['settingsFile']['choices'] = ['gisdbase',
+        self.internalSettings['advanced']['settingsFile']['choices'] = ['home',
+                                                                        'gisdbase',
                                                                         'location',
                                                                         'mapset']
         self.internalSettings['advanced']['iconTheme']['choices'] = ['grass',
@@ -313,13 +314,16 @@
         mapset_file = os.path.join(gisdbase, location_name, mapset_name, self.fileName)
         location_file = os.path.join(gisdbase, location_name, self.fileName)
         gisdbase_file = os.path.join(gisdbase, self.fileName)
-
+        home_file = os.path.join(os.path.expanduser("~"), self.fileName) # MS Windows fix ?
+        
         if os.path.isfile(mapset_file):
             self.filePath = mapset_file
         elif os.path.isfile(location_file):
             self.filePath = location_file
         elif os.path.isfile(gisdbase_file):
             self.filePath = gisdbase_file
+        elif os.path.isfile(home_file):
+            self.filePath = home_file
         
         if self.filePath:
             self.__ReadFile(self.filePath, settings)
@@ -382,11 +386,14 @@
             settings = self.userSettings
         
         loc = self.Get(group='advanced', key='settingsFile', subkey='type')
+        home = os.path.expanduser("~") # MS Windows fix ?
         gisdbase = grassenv.GetGRASSVariable("GISDBASE")
         location_name = grassenv.GetGRASSVariable("LOCATION_NAME")
         mapset_name = grassenv.GetGRASSVariable("MAPSET")
         filePath = None
-        if loc == 'gisdbase':
+        if loc == 'home':
+            filePath = os.path.join(home, self.fileName)
+        elif loc == 'gisdbase':
             filePath = os.path.join(gisdbase, self.fileName)
         elif loc == 'location':
             filePath = os.path.join(gisdbase, location_name, self.fileName)



More information about the grass-commit mailing list