[GRASS-SVN] r49880 - in grass/trunk/gui/wxpython: iclass mapdisp vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Dec 23 06:36:53 EST 2011


Author: martinl
Date: 2011-12-23 03:36:53 -0800 (Fri, 23 Dec 2011)
New Revision: 49880

Modified:
   grass/trunk/gui/wxpython/iclass/frame.py
   grass/trunk/gui/wxpython/mapdisp/frame.py
   grass/trunk/gui/wxpython/vdigit/toolbars.py
Log:
wxGUI: don't import iclass.digit in vdigit.toolbars


Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py	2011-12-23 10:50:43 UTC (rev 49879)
+++ grass/trunk/gui/wxpython/iclass/frame.py	2011-12-23 11:36:53 UTC (rev 49880)
@@ -19,16 +19,15 @@
 
 import os
 import sys
+import copy
 
-#if __name__ == "__main__":
-sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
-
-import copy
+if __name__ == "__main__":
+    sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
+from core import globalvar
 import wx
 
 from ctypes import *
 
-from core import globalvar
 try:
     from grass.lib.imagery import *
     from grass.lib.vector import *
@@ -269,6 +268,7 @@
 
         if name == "vdigit":
             self.toolbars[name] = VDigitToolbar(self, MapWindow = self.GetFirstWindow(),
+                                                digitClass = IClassIVDigit,
                                                 tools = ['addArea', 'moveVertex', 'addVertex',
                                                          'removeVertex', 'editLine',
                                                          'moveLine', 'deleteLine'])

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2011-12-23 10:50:43 UTC (rev 49879)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2011-12-23 11:36:53 UTC (rev 49880)
@@ -186,7 +186,7 @@
     def _addToolbarVDigit(self):
         """!Add vector digitizer toolbar
         """
-        from vdigit.main import haveVDigit
+        from vdigit.main import haveVDigit, VDigit
         
         if not haveVDigit:
             from vdigit import errorMsg
@@ -232,7 +232,7 @@
             self._mgr.GetPane('3d').Hide()
         self._mgr.GetPane('vdigit').Show()
         self.toolbars['vdigit'] = VDigitToolbar(parent = self, MapWindow = self.MapWindow,
-                                                layerTree = self.tree,
+                                                digitClass = VDigit, layerTree = self.tree,
                                                 log = log)
         self.MapWindowVDigit.SetToolbar(self.toolbars['vdigit'])
         

Modified: grass/trunk/gui/wxpython/vdigit/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/toolbars.py	2011-12-23 10:50:43 UTC (rev 49879)
+++ grass/trunk/gui/wxpython/vdigit/toolbars.py	2011-12-23 11:36:53 UTC (rev 49880)
@@ -20,8 +20,6 @@
 from gui_core.toolbars  import BaseToolbar, BaseIcons
 from gui_core.dialogs   import CreateNewVector
 from vdigit.preferences import VDigitSettingsDialog
-from vdigit.main        import VDigit
-from iclass.digit       import IClassIVDigit
 from core.debug         import Debug
 from core.settings      import UserSettings
 from core.gcmd          import GError
@@ -30,12 +28,13 @@
 class VDigitToolbar(BaseToolbar):
     """!Toolbar for digitization
     """
-    def __init__(self, parent, MapWindow, tools = [], layerTree = None, log = None):
+    def __init__(self, parent, MapWindow, digitClass, 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
         self.log           = log        # log area
         self.tools         = tools
+        self.digitClass    = digitClass
         BaseToolbar.__init__(self, parent)
         self.digit         = None
         
@@ -388,7 +387,7 @@
         """!Show settings dialog"""
         if self.digit is None:
             try:
-                self.digit = self.MapWindow.digit = VDigit(mapwindow = self.MapWindow)
+                self.digit = self.MapWindow.digit = self.digitClass(mapwindow = self.MapWindow)
             except SystemExit:
                 self.digit = self.MapWindow.digit = None
         
@@ -693,10 +692,7 @@
                                         0)
         
         self.MapWindow.pdcVector = wx.PseudoDC()
-        if self.parent.GetName() == 'IClassWindow':
-            self.digit = self.MapWindow.digit = IClassIVDigit(mapwindow = self.MapWindow)
-        else:
-            self.digit = self.MapWindow.digit = VDigit(mapwindow = self.MapWindow)
+        self.digit = self.MapWindow.digit = self.digitClass(mapwindow = self.MapWindow)
         
         self.mapLayer = mapLayer
         # open vector map
@@ -737,7 +733,7 @@
         if 'map' in self.parent.toolbars:
             self.parent.toolbars['map'].combo.SetValue (_('Digitize'))
         
-        if self.parent.GetName() != "IClassWindow":
+        if self.digitClass != "iclass.digit.IClassWindow":
             lmgr = self.parent.GetLayerManager()
             if lmgr:
                 lmgr.toolbars['tools'].Enable('vdigit', enable = False)



More information about the grass-commit mailing list