[GRASS-SVN] r54392 - in grass/trunk/gui/wxpython: core mapdisp vdigit
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Dec 24 14:49:23 PST 2012
Author: martinl
Date: 2012-12-24 14:49:23 -0800 (Mon, 24 Dec 2012)
New Revision: 54392
Modified:
grass/trunk/gui/wxpython/core/settings.py
grass/trunk/gui/wxpython/mapdisp/frame.py
grass/trunk/gui/wxpython/vdigit/preferences.py
grass/trunk/gui/wxpython/vdigit/toolbars.py
Log:
wxGUI/vdigit: fix settings dialog (use giface)
Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py 2012-12-24 22:31:38 UTC (rev 54391)
+++ grass/trunk/gui/wxpython/core/settings.py 2012-12-24 22:49:23 UTC (rev 54392)
@@ -990,8 +990,8 @@
raise GException(_('Writing settings to file <%(file)s> failed.'
'\n\nDetails: %(detail)s') % { 'file' : self.filePath,
'detail' : e })
-
file.close()
+ return self.filePath
def _parseValue(self, value, read = False):
"""!Parse value to be store in settings file"""
Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py 2012-12-24 22:31:38 UTC (rev 54391)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py 2012-12-24 22:49:23 UTC (rev 54392)
@@ -227,8 +227,8 @@
self._mgr.GetPane('3d').Hide()
self._mgr.GetPane('vdigit').Show()
self.toolbars['vdigit'] = VDigitToolbar(parent = self, MapWindow = self.MapWindow,
- digitClass = VDigit, layerTree = self.tree,
- log = log)
+ digitClass = VDigit, giface = self._giface,
+ layerTree = self.tree, log = log)
self.MapWindowVDigit.SetToolbar(self.toolbars['vdigit'])
self._mgr.AddPane(self.toolbars['vdigit'],
Modified: grass/trunk/gui/wxpython/vdigit/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/preferences.py 2012-12-24 22:31:38 UTC (rev 54391)
+++ grass/trunk/gui/wxpython/vdigit/preferences.py 2012-12-24 22:49:23 UTC (rev 54392)
@@ -26,12 +26,14 @@
from core.settings import UserSettings
class VDigitSettingsDialog(wx.Dialog):
- def __init__(self, parent, title, style = wx.DEFAULT_DIALOG_STYLE):
+ def __init__(self, parent, giface, title = _("Digitization settings"),
+ style = wx.DEFAULT_DIALOG_STYLE):
"""!Standard settings dialog for digitization purposes
"""
wx.Dialog.__init__(self, parent = parent, id = wx.ID_ANY, title = title, style = style)
- self.parent = parent # mapdisplay.MapFrame class instance
+ self._giface = giface
+ self.parent = parent # MapFrame
self.digit = self.parent.MapWindow.digit
# notebook
@@ -666,8 +668,8 @@
UserSettings.ReadSettingsFile(settings = fileSettings)
fileSettings['vdigit'] = UserSettings.Get(group = 'vdigit')
- file = UserSettings.SaveToFile(fileSettings)
- self.parent.GetLayerManager().GetLogWindow().WriteLog(_('Vector digitizer settings saved to file <%s>.') % file)
+ sfile = UserSettings.SaveToFile(fileSettings)
+ self._giface.WriteLog(_('Vector digitizer settings saved to file <%s>.') % sfile)
self.Destroy()
@@ -690,7 +692,8 @@
def UpdateSettings(self):
"""!Update digitizer settings
"""
- self.parent.GetLayerManager().WorkspaceChanged() # geometry attributes
+ if self.parent.GetLayerManager():
+ self.parent.GetLayerManager().WorkspaceChanged() # geometry attributes
# symbology
for key, (enabled, color) in self.symbology.iteritems():
if enabled:
@@ -732,8 +735,11 @@
# geometry attributes (workspace)
mapLayer = self.parent.toolbars['vdigit'].GetLayer()
- tree = self.parent.tree
- item = tree.FindItemByData('maplayer', mapLayer)
+ tree = self._giface.GetLayerTree()
+ if tree:
+ item = tree.FindItemByData('maplayer', mapLayer)
+ else:
+ item = None
for key, val in self.geomAttrb.iteritems():
checked = self.FindWindowById(val['check']).IsChecked()
column = self.FindWindowById(val['column']).GetValue()
Modified: grass/trunk/gui/wxpython/vdigit/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/toolbars.py 2012-12-24 22:31:38 UTC (rev 54391)
+++ grass/trunk/gui/wxpython/vdigit/toolbars.py 2012-12-24 22:49:23 UTC (rev 54392)
@@ -30,7 +30,7 @@
class VDigitToolbar(BaseToolbar):
"""!Toolbar for digitization
"""
- def __init__(self, parent, MapWindow, digitClass, tools = [], layerTree = None, log = None):
+ def __init__(self, parent, MapWindow, digitClass, giface, tools = [], layerTree = None, log = None):
self.MapWindow = MapWindow
self.Map = MapWindow.GetMap() # Map class instance
self.layerTree = layerTree # reference to layer tree associated to map display
@@ -39,6 +39,7 @@
self.digitClass = digitClass
BaseToolbar.__init__(self, parent)
self.digit = None
+ self._giface = giface
# currently selected map layer for editing (reference to MapLayer instance)
self.mapLayer = None
@@ -451,8 +452,7 @@
self.digit = self.MapWindow.digit = None
if not self.settingsDialog:
- self.settingsDialog = VDigitSettingsDialog(parent = self.parent, title = _("Digitization settings"),
- style = wx.DEFAULT_DIALOG_STYLE)
+ self.settingsDialog = VDigitSettingsDialog(parent = self.parent, giface = self._giface)
self.settingsDialog.Show()
def OnHelp(self, event):
More information about the grass-commit
mailing list