[GRASS-SVN] r50143 - in grass/branches/develbranch_6/gui/wxpython:
core gui_core mapdisp nviz psmap
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 12 02:06:17 EST 2012
Author: annakrat
Date: 2012-01-11 23:06:17 -0800 (Wed, 11 Jan 2012)
New Revision: 50143
Modified:
grass/branches/develbranch_6/gui/wxpython/core/settings.py
grass/branches/develbranch_6/gui/wxpython/gui_core/preferences.py
grass/branches/develbranch_6/gui/wxpython/mapdisp/mapwindow.py
grass/branches/develbranch_6/gui/wxpython/nviz/mapwindow.py
grass/branches/develbranch_6/gui/wxpython/nviz/workspace.py
grass/branches/develbranch_6/gui/wxpython/psmap/frame.py
Log:
wxGUI/preferences: added possibility to switch on/off zooming by mouse wheel (requested by Michael Barton), merge from trunk, r50138
Modified: grass/branches/develbranch_6/gui/wxpython/core/settings.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/core/settings.py 2012-01-12 02:57:05 UTC (rev 50142)
+++ grass/branches/develbranch_6/gui/wxpython/core/settings.py 2012-01-12 07:06:17 UTC (rev 50143)
@@ -155,6 +155,10 @@
'bgcolor': {
'color' : (255, 255, 255, 255),
},
+ 'mouseWheelZoom' : {
+ 'enabled' : True,
+ 'selection' : 0,
+ },
},
#
# projection
@@ -683,6 +687,8 @@
self.internalSettings['display']['driver']['choices'] = ['default']
self.internalSettings['display']['statusbarMode']['choices'] = None # set during MapFrame init
+ self.internalSettings['display']['mouseWheelZoom']['choices'] = (_('Scroll forward to zoom in'),
+ _('Scroll back to zoom in'))
self.internalSettings['nviz']['view'] = {}
self.internalSettings['nviz']['view']['twist'] = {}
Modified: grass/branches/develbranch_6/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_core/preferences.py 2012-01-12 02:57:05 UTC (rev 50142)
+++ grass/branches/develbranch_6/gui/wxpython/gui_core/preferences.py 2012-01-12 07:06:17 UTC (rev 50143)
@@ -680,7 +680,32 @@
gridSizer.Add(item = autoZooming,
pos = (row, 0), span = (1, 2))
+
+ #
+ # mouse wheel zoom
+ #
+ row += 1
+ wheelZooming = wx.CheckBox(parent = panel, id = wx.ID_ANY,
+ label = _("Enable zooming by mouse wheel"),
+ name = "IsChecked")
+ wheelZooming.SetValue(self.settings.Get(group = 'display', key = 'mouseWheelZoom',
+ subkey = 'enabled'))
+ self.winId['display:mouseWheelZoom:enabled'] = wheelZooming.GetId()
+ gridSizer.Add(item = wheelZooming,
+ pos = (row, 0), flag = wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL)
+
+ listOfModes = self.settings.Get(group = 'display', key = 'mouseWheelZoom', subkey = 'choices', internal = True)
+ zoomMode = wx.Choice(parent = panel, id = wx.ID_ANY, size = (200, -1),
+ choices = listOfModes,
+ name = "GetSelection")
+ zoomMode.SetSelection(self.settings.Get(group = 'display', key = 'mouseWheelZoom', subkey = 'selection'))
+ self.winId['display:mouseWheelZoom:selection'] = zoomMode.GetId()
+
+ gridSizer.Add(item = zoomMode,
+ flag = wx.ALIGN_RIGHT,
+ pos = (row, 1))
+
sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
@@ -688,7 +713,11 @@
# bindings
fontButton.Bind(wx.EVT_BUTTON, self.OnSetFont)
+ wheelZooming.Bind(wx.EVT_CHECKBOX, self.OnEnableWheelZoom)
+ # enable/disable controls according to settings
+ self.OnEnableWheelZoom(None)
+
return panel
def _createCmdPage(self, notebook):
@@ -761,7 +790,7 @@
self.winId['cmd:verbosity:selection'] = verbosity.GetId()
gridSizer.Add(item = verbosity,
- pos = (row, 1))
+ pos = (row, 1), flag = wx.ALIGN_RIGHT)
sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
@@ -1243,6 +1272,13 @@
event.Skip()
+ def OnEnableWheelZoom(self, event):
+ """!Enable/disable wheel zoom mode control"""
+ checkId = self.winId['display:mouseWheelZoom:enabled']
+ choiceId = self.winId['display:mouseWheelZoom:selection']
+ enable = self.FindWindowById(checkId).IsChecked()
+ self.FindWindowById(choiceId).Enable(enable)
+
class DefaultFontDialog(wx.Dialog):
"""
Opens a file selection dialog to select default font
Modified: grass/branches/develbranch_6/gui/wxpython/mapdisp/mapwindow.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/mapdisp/mapwindow.py 2012-01-12 02:57:05 UTC (rev 50142)
+++ grass/branches/develbranch_6/gui/wxpython/mapdisp/mapwindow.py 2012-01-12 07:06:17 UTC (rev 50143)
@@ -909,6 +909,12 @@
def OnMouseWheel(self, event):
"""!Mouse wheel moved
"""
+ if not UserSettings.Get(group = 'display',
+ key = 'mouseWheelZoom',
+ subkey = 'enabled'):
+ event.Skip()
+ return
+
self.processMouse = False
current = event.GetPositionTuple()[:]
wheel = event.GetWheelRotation()
@@ -924,6 +930,11 @@
else:
zoomtype = -1
+ if UserSettings.Get(group = 'display',
+ key = 'mouseWheelZoom',
+ subkey = 'selection'):
+ zoomtype *= -1
+
# zoom
self.Zoom(begin, end, zoomtype)
Modified: grass/branches/develbranch_6/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/mapwindow.py 2012-01-12 02:57:05 UTC (rev 50142)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/mapwindow.py 2012-01-12 07:06:17 UTC (rev 50143)
@@ -625,6 +625,12 @@
def OnMouseWheel(self, event):
"""!Change perspective"""
+ if not UserSettings.Get(group = 'display',
+ key = 'mouseWheelZoom',
+ subkey = 'enabled'):
+ event.Skip()
+ return
+
wheel = event.GetWheelRotation()
Debug.msg (5, "GLWindow.OnMouseMotion(): wheel = %d" % wheel)
if self.timerFly.IsRunning() and self.fly['mouseControl']:
@@ -633,6 +639,10 @@
else:
self.ChangeFlySpeed(increase = False)
else:
+ if UserSettings.Get(group = 'display',
+ key = 'mouseWheelZoom',
+ subkey = 'selection'):
+ wheel *= -1
self.DoZoom(zoomtype = wheel, pos = event.GetPositionTuple())
# update statusbar
Modified: grass/branches/develbranch_6/gui/wxpython/nviz/workspace.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/nviz/workspace.py 2012-01-12 02:57:05 UTC (rev 50142)
+++ grass/branches/develbranch_6/gui/wxpython/nviz/workspace.py 2012-01-12 07:06:17 UTC (rev 50143)
@@ -25,9 +25,7 @@
class NvizSettings(object):
def __init__(self):
- """Default 3D settings"""
- UserSettings.Reset('nviz')
- UserSettings.ReadSettingsFile()
+ pass
def SetConstantDefaultProp(self):
"""Set default constant data properties"""
Modified: grass/branches/develbranch_6/gui/wxpython/psmap/frame.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/psmap/frame.py 2012-01-12 02:57:05 UTC (rev 50142)
+++ grass/branches/develbranch_6/gui/wxpython/psmap/frame.py 2012-01-12 07:06:17 UTC (rev 50143)
@@ -42,6 +42,7 @@
from gui_core.goutput import CmdThread, EVT_CMD_DONE
from psmap.toolbars import PsMapToolbar
from core.gcmd import RunCommand, GError, GMessage
+from core.settings import UserSettings
from gui_core.forms import GUI
from psmap.menudata import PsMapData
@@ -1132,10 +1133,18 @@
def OnMouse(self, event):
- if event.GetWheelRotation():
+ if event.GetWheelRotation() and UserSettings.Get(group = 'display',
+ key = 'mouseWheelZoom',
+ subkey = 'enabled'):
zoom = event.GetWheelRotation()
use = self.mouse['use']
self.mouse['begin'] = event.GetPosition()
+
+ if UserSettings.Get(group = 'display',
+ key = 'mouseWheelZoom',
+ subkey = 'selection'):
+ zoom *= -1
+
if zoom > 0:
self.mouse['use'] = 'zoomin'
else:
More information about the grass-commit
mailing list