[GRASS-SVN] r31989 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Jul 3 16:32:09 EDT 2008


Author: martinl
Date: 2008-07-03 16:32:09 -0400 (Thu, 03 Jul 2008)
New Revision: 31989

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI: settings stored in .grasswx6 (HOME by default) [merge from trunk, r31986]

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2008-07-03 20:11:00 UTC (rev 31988)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py	2008-07-03 20:32:09 UTC (rev 31989)
@@ -44,7 +44,7 @@
         #
         # settings filename
         #
-        self.fileName = ".grasswx"
+        self.fileName = ".grasswx6"
         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
                 },
@@ -223,7 +223,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',
@@ -261,13 +262,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)
@@ -320,11 +324,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