[GRASS-SVN] r49710 - grass/trunk/gui/wxpython/core
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Dec 13 07:58:29 EST 2011
Author: martinl
Date: 2011-12-13 04:58:29 -0800 (Tue, 13 Dec 2011)
New Revision: 49710
Modified:
grass/trunk/gui/wxpython/core/settings.py
Log:
wxGUI/settings: clean up Settings constructor
Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py 2011-12-13 12:30:58 UTC (rev 49709)
+++ grass/trunk/gui/wxpython/core/settings.py 2011-12-13 12:58:29 UTC (rev 49710)
@@ -38,11 +38,22 @@
# key/value separator
self.sep = ';'
+ # define default settings
+ self._defaultSettings() # -> self.defaultSettings
+
+ # read settings from the file
+ self.userSettings = copy.deepcopy(self.defaultSettings)
try:
- projFile = PathJoin(os.environ["GRASS_PROJSHARE"], 'epsg')
- except KeyError:
- projFile = ''
+ self.ReadSettingsFile()
+ except GException, e:
+ print >> sys.stderr, e.value
+ # define internal settings
+ self._internalSettings() # -> self.internalSettings
+
+ def _generateLocale(self):
+ """!Generate locales
+ """
loc = list(locale.getdefaultlocale())
if loc[1] == 'UTF8':
loc[1] = 'UTF-8'
@@ -51,12 +62,22 @@
self.locs.append('en_GB.UTF-8')
self.locs.sort()
try:
- id_loc = locs.index(code_loc)
+ return locs.index(code_loc)
except:
- id_loc = None
- #
- # default settings
- #
+ pass
+
+ return None
+
+ def _defaultSettings(self):
+ """!Define default settings
+ """
+ try:
+ projFile = PathJoin(os.environ["GRASS_PROJSHARE"], 'epsg')
+ except KeyError:
+ projFile = ''
+
+ id_loc = self._generateLocale()
+
self.defaultSettings = {
#
# general
@@ -719,19 +740,10 @@
# TODO
if sys.platform == 'darwin':
self.defaultSettings['general']['defWindowPos']['enabled'] = False
-
- #
- # user settings
- #
- self.userSettings = copy.deepcopy(self.defaultSettings)
- try:
- self.ReadSettingsFile()
- except GException, e:
- print >> sys.stderr, e.value
- #
- # internal settings (based on user settings)
- #
+ def _internalSettings(self):
+ """!Define internal settings (based on user settings)
+ """
self.internalSettings = {}
for group in self.userSettings.keys():
self.internalSettings[group] = {}
More information about the grass-commit
mailing list