[GRASS-SVN] r42896 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 25 17:25:09 EDT 2010
Author: martinl
Date: 2010-07-25 21:25:09 +0000 (Sun, 25 Jul 2010)
New Revision: 42896
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_preferences.py
grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
Log:
wxGUI/nviz: preference fixes
(merge r42893 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py 2010-07-25 21:00:23 UTC (rev 42895)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_mapdisp.py 2010-07-25 21:25:09 UTC (rev 42896)
@@ -213,7 +213,7 @@
if hasattr(self.lmgr, "nviz"):
self.lmgr.nviz.UpdateSettings()
- self._display.SetView(self.view['pos']['x'], self.view['pos']['y'],
+ self._display.SetView(self.view['position']['x'], self.view['position']['y'],
self.iview['height']['value'],
self.view['persp']['value'],
self.view['twist']['value'])
@@ -283,7 +283,7 @@
def UpdateView(self, event):
"""!Change view settings"""
data = self.view
- self._display.SetView(data['pos']['x'], data['pos']['y'],
+ self._display.SetView(data['position']['x'], data['position']['y'],
self.iview['height']['value'],
data['persp']['value'],
data['twist']['value'])
@@ -297,8 +297,8 @@
def UpdateLight(self, event):
"""!Change light settings"""
data = self.light
- self._display.SetLight(x = data['pos']['x'], y = data['pos']['y'],
- z = data['pos']['z'], color = data['color'],
+ self._display.SetLight(x = data['position']['x'], y = data['position']['y'],
+ z = data['position']['z'], color = data['color'],
bright = data['bright'] / 100.,
ambient = data['ambient'] / 100.)
self._display.DrawLightingModel()
@@ -800,10 +800,10 @@
self.view['z-exag']['min'] = 0
self.view['z-exag']['max'] = self.view['z-exag']['value'] * 10
- self.view['pos']['x'] = UserSettings.Get(group = 'nviz', key = 'view',
- subkey = ('pos', 'x'))
- self.view['pos']['y'] = UserSettings.Get(group = 'nviz', key = 'view',
- subkey = ('pos', 'y'))
+ self.view['position']['x'] = UserSettings.Get(group = 'nviz', key = 'view',
+ subkey = ('position', 'x'))
+ self.view['position']['y'] = UserSettings.Get(group = 'nviz', key = 'view',
+ subkey = ('position', 'y'))
self.view['persp']['value'] = UserSettings.Get(group = 'nviz', key = 'view',
subkey = ('persp', 'value'))
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_preferences.py 2010-07-25 21:00:23 UTC (rev 42895)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/nviz_preferences.py 2010-07-25 21:25:09 UTC (rev 42896)
@@ -89,7 +89,7 @@
# position
self.win['view']['pos'] = {}
- posvals = UserSettings.Get(group = 'nviz', key = 'view', subkey = 'pos')
+ posvals = UserSettings.Get(group = 'nviz', key = 'view', subkey = 'position')
gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
label = _("Position:")),
pos = (1, 0), flag = wx.ALIGN_CENTER_VERTICAL)
@@ -357,7 +357,7 @@
for subvalue in value.keys():
win = self.FindWindowById(self.win[subgroup][subkey][subvalue])
val = settings[subgroup][subkey][subvalue]
- if subkey == 'pos':
+ if subkey == 'position':
val = int(val * 100)
win.SetValue(val)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py 2010-07-25 21:00:23 UTC (rev 42895)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/preferences.py 2010-07-25 21:25:09 UTC (rev 42896)
@@ -43,6 +43,7 @@
import wx.lib.mixins.listctrl as listmix
from grass.script import core as grass
+
import gcmd
import utils
import globalvar
@@ -445,7 +446,7 @@
'value' : 20,
'step' : 5,
},
- 'pos' : {
+ 'position' : {
'x' : 0.84,
'y' : 0.16,
},
@@ -509,23 +510,23 @@
'value' : (0, 0, 0, 255), # constant: black
},
'draw' : {
- 'mode' : 0, # isosurfaces
- 'shading' : 1, # gouraud
+ 'mode' : 0, # isosurfaces
+ 'shading' : 1, # gouraud
'resolution' : 3, # polygon resolution
},
'shine': {
'map' : False,
- 'value' : 60.0,
+ 'value' : 60,
},
},
'light' : {
- 'pos' : {
+ 'position' : {
'x' : 0.68,
'y' : 0.68,
'z' : 80,
},
+ 'bright' : 80,
'color' : (255, 255, 255, 255), # white
- 'bright' : 80,
'ambient' : 20,
},
'fringe' : {
@@ -538,7 +539,7 @@
'color' : {
'valid' : (180, 234, 154, 255), # light green
'invalid' : (255, 255, 255, 255), # white
- 'running' : (255, 0, 0), # red
+ 'running' : (255, 0, 0, 255), # red
'disabled' : (211, 211, 211, 255), # light grey
},
'size' : {
@@ -552,9 +553,9 @@
},
'data' : {
'color': {
- 'raster' : (215, 215, 248), # light blue
- 'raster3d' : (215, 248, 215), # light green
- 'vector' : (248, 215, 215), # light red
+ 'raster' : (215, 215, 248, 255), # light blue
+ 'raster3d' : (215, 248, 215, 255), # light green
+ 'vector' : (248, 215, 215, 255), # light red
},
'size' : {
'width' : 175,
@@ -646,14 +647,11 @@
settings = self.userSettings
# look for settings file
- # -> mapser
- # -> location
- # -> gisdbase
gisenv = grass.gisenv()
gisdbase = gisenv['GISDBASE']
location_name = gisenv['LOCATION_NAME']
mapset_name = gisenv['MAPSET']
-
+
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)
@@ -746,7 +744,7 @@
subkeys = settings[group][key].keys()
for idx in range(len(subkeys)):
value = settings[group][key][subkeys[idx]]
- if type(value) == type({}):
+ if type(value) == types.DictType:
if idx > 0:
file.write('%s%s%s%s%s' % (os.linesep, group, self.sep, key, self.sep))
file.write('%s%s' % (subkeys[idx], self.sep))
@@ -758,12 +756,15 @@
svalue))
if sidx < len(kvalues) - 1:
file.write('%s' % self.sep)
+ if idx < len(subkeys) - 1:
+ file.write('%s%s%s%s%s' % (os.linesep, group, self.sep, key, self.sep))
else:
value = self.__parseValue(settings[group][key][subkeys[idx]])
file.write('%s%s%s' % (subkeys[idx], self.sep, value))
- if idx < len(subkeys) - 1:
+ if idx < len(subkeys) - 1 and \
+ type(settings[group][key][subkeys[idx + 1]]) != types.DictType:
file.write('%s' % self.sep)
- file.write('%s' % os.linesep)
+ file.write(os.linesep)
except IOError, e:
raise gcmd.SettingsError(message=e)
except StandardError, e:
@@ -841,9 +842,9 @@
print >> sys.stderr, "Settings: unable to get value '%s:%s:%s'\n" % \
(group, key, subkey)
- def Set(self, group, value, key=None, subkey=None, internal=False):
+ def Set(self, group, value, key = None, subkey = None, internal = False):
"""!Set value of key/subkey
-
+
Raise KeyError if group/key is not found
@param group settings group
@@ -856,7 +857,7 @@
settings = self.internalSettings
else:
settings = self.userSettings
-
+
try:
if subkey is None:
if key is None:
@@ -871,7 +872,7 @@
settings[group][key][subkey] = value
except KeyError:
raise gcmd.SettingsError("%s '%s:%s:%s'" % (_("Unable to set "), group, key, subkey))
-
+
def Append(self, dict, group, key, subkey, value):
"""!Set value of key/subkey
@@ -893,10 +894,18 @@
# TODO: len(subkey) > 2
if not dict[group][key].has_key(subkey[0]):
dict[group][key][subkey[0]] = {}
- dict[group][key][subkey[0]][subkey[1]] = value
+ try:
+ dict[group][key][subkey[0]][subkey[1]] = value
+ except TypeError:
+ print >> sys.stderr, _("Unable to parse settings '%s' (%s:%s:%s:%s)") % \
+ (value, group, key, subkey[0], subkey[1])
else:
- dict[group][key][subkey] = value
-
+ try:
+ dict[group][key][subkey] = value
+ except TypeError:
+ print >> sys.stderr, _("Unable to parse settings '%s' (%s:%s:%s)") % \
+ (value, group, key, subkey)
+
def GetDefaultSettings(self):
"""!Get default user settings"""
return self.defaultSettings
More information about the grass-commit
mailing list