[GRASS-SVN] r57233 - in grass/trunk/gui/wxpython: gcp lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jul 20 10:32:40 PDT 2013


Author: wenzeslaus
Date: 2013-07-20 10:32:39 -0700 (Sat, 20 Jul 2013)
New Revision: 57233

Modified:
   grass/trunk/gui/wxpython/gcp/manager.py
   grass/trunk/gui/wxpython/gcp/mapdisplay.py
   grass/trunk/gui/wxpython/gcp/toolbars.py
   grass/trunk/gui/wxpython/lmgr/frame.py
Log:
wxGUI/gcp: removing remaining connection to lmgr and obsolate variables

Modified: grass/trunk/gui/wxpython/gcp/manager.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/manager.py	2013-07-20 10:05:25 UTC (rev 57232)
+++ grass/trunk/gui/wxpython/gcp/manager.py	2013-07-20 17:32:39 UTC (rev 57233)
@@ -299,9 +299,10 @@
 
     def Cleanup(self):
         """!Return to current location and mapset"""
+        # here was also the cleaning of gcpmanagement from layer manager
+        # which is no longer needed
+
         self.SwitchEnv('target')
-        self.parent.gcpmanagement = None
-
         self.wizard.Destroy()
 
 class LocationPage(TitledPage):
@@ -795,20 +796,26 @@
         
         #wx.Frame.__init__(self, parent, id, title, size = size, name = "GCPFrame")
         MapFrame.__init__(self, parent = parent, giface = self._giface, title = title, size = size,
-                            Map = Map, toolbars = toolbars, lmgr = lmgr, name = 'GCPMapWindow')
+                            Map=Map, toolbars=toolbars, name='GCPMapWindow')
 
-        #
         # init variables
+        self.parent = parent
+
         #
-        self.parent = parent # GMFrame
-        self.parent.gcpmanagement = self
-        
-        #
         # register data structures for drawing GCP's
         #
         self.pointsToDrawTgt = self.TgtMapWindow.RegisterGraphicsToDraw(graphicsType = "point", setStatusFunc = self.SetGCPSatus)
         self.pointsToDrawSrc = self.SrcMapWindow.RegisterGraphicsToDraw(graphicsType = "point", setStatusFunc = self.SetGCPSatus)
-        
+
+        # connect to the map windows signals
+        # used to add or edit GCP
+        self.SrcMapWindow.mouseLeftUpPointer.connect(
+            lambda x, y:
+            self._onMouseLeftUpPointer(self.SrcMapWindow, x, y))
+        self.TgtMapWindow.mouseLeftUpPointer.connect(
+            lambda x, y:
+            self._onMouseLeftUpPointer(self.TgtMapWindow, x, y))
+
         # window resized
         self.resize = False
 
@@ -949,7 +956,9 @@
 
     def __del__(self):
         """!Disable GCP manager mode"""
-        self.parent.gcpmanagement = None
+        # leaving the method here but was used only to delete gcpmanagement
+        # from layer manager which is now not needed
+        pass
         
     def CreateGCPList(self):
         """!Create GCP List Control"""
@@ -1333,9 +1342,20 @@
             targetMapWin.UpdateMap(render=False, renderVector=False)
     
     def OnFocus(self, event):
+        # TODO: it is here just to remove old or obsolate beavior of base class gcp/MapFrame?
         # self.grwiz.SwitchEnv('source')
         pass
-        
+
+    def _onMouseLeftUpPointer(self, mapWindow, x, y):
+        if mapWindow == self.SrcMapWindow:
+            coordtype = 'source'
+        else:
+            coordtype = 'target'
+
+        coord = (x, y)
+        self.SetGCPData(coordtype, coord, self, confirm=True)
+        mapWindow.UpdateMap(render=False, renderVector=False)
+
     def OnRMS(self, event):
         """
         RMS button handler

Modified: grass/trunk/gui/wxpython/gcp/mapdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/mapdisplay.py	2013-07-20 10:05:25 UTC (rev 57232)
+++ grass/trunk/gui/wxpython/gcp/mapdisplay.py	2013-07-20 17:32:39 UTC (rev 57233)
@@ -42,17 +42,16 @@
     """!Main frame for map display window. Drawing takes place in
     child double buffered drawing window.
     """
-    def __init__(self, parent, giface, title=_("GRASS GIS Manage Ground Control Points"),
-                 toolbars=["gcpdisp"], tree=None, notebook=None, lmgr=None,
-                 page=None, Map=None, auimgr=None, name = 'GCPMapWindow', **kwargs):
+    def __init__(self, parent, giface,
+                 title=_("GRASS GIS Manage Ground Control Points"),
+                 toolbars=["gcpdisp"], Map=None, auimgr=None,
+                 name='GCPMapWindow', **kwargs):
         """!Main map display window with toolbars, statusbar and
         DrawWindow
 
+        @param giface GRASS interface instance
+        @param title window title
         @param toolbars array of activated toolbars, e.g. ['map', 'digit']
-        @param tree reference to layer tree
-        @param notebook control book ID in Layer Manager
-        @param lmgr Layer Manager
-        @param page notebook page with layer tree
         @param Map instance of render.Map
         @param auimgs AUI manager
         @param kwargs wx.Frame attribures
@@ -60,12 +59,9 @@
         
         SingleMapFrame.__init__(self, parent = parent, giface = giface, title = title,
                               Map = Map, auimgr = auimgr, name = name, **kwargs)
-        
-        self._layerManager = lmgr   # Layer Manager object
-        self.tree       = tree      # Layer Manager layer tree object
-        self.page       = page      # Notebook page holding the layer tree
-        self.layerbook  = notebook  # Layer Manager layer tree notebook
+
         self._giface = giface
+
         #
         # Add toolbars
         #
@@ -115,11 +111,11 @@
         #
         self.grwiz.SwitchEnv('source')
         self.SrcMapWindow = BufferedWindow(parent=self, giface=self._giface, id=wx.ID_ANY,
-                                          Map=self.SrcMap, frame = self, tree=self.tree, lmgr=self._layerManager)
+                                           Map=self.SrcMap, frame=self)
 
         self.grwiz.SwitchEnv('target')
         self.TgtMapWindow = BufferedWindow(parent=self, giface=self._giface, id=wx.ID_ANY,
-                                          Map=self.TgtMap, frame = self, tree=self.tree, lmgr=self._layerManager)
+                                          Map=self.TgtMap, frame=self)
         self.MapWindow = self.SrcMapWindow
         self.Map = self.SrcMap
         self._setUpMapWindow(self.SrcMapWindow)
@@ -133,13 +129,6 @@
         self.TgtMapWindow.mouseEntered.connect(
             lambda:
             self._setActiveMapWindow(self.TgtMapWindow))
-        # used to add or edit GCP
-        self.SrcMapWindow.mouseLeftUpPointer.connect(
-            lambda x, y:
-            self._onMouseLeftUpPointer(self.SrcMapWindow, x, y))
-        self.TgtMapWindow.mouseLeftUpPointer.connect(
-            lambda x, y:
-            self._onMouseLeftUpPointer(self.TgtMapWindow, x, y))
 
         #
         # initialize region values
@@ -289,19 +278,13 @@
         Change choicebook page to match display.
         Or set display for georectifying
         """
-        if self._layerManager and \
-                self._layerManager.gcpmanagement:
-            # in GCP Management, set focus to current MapWindow for mouse actions
-            self.OnPointer(event)
-            self.MapWindow.SetFocus()
-        else:
-            # change bookcontrol page to page associated with display
-            # GCP Manager: use bookcontrol?
-            if self.page:
-                pgnum = self.layerbook.GetPageIndex(self.page)
-                if pgnum > -1:
-                    self.layerbook.SetSelection(pgnum)
-        
+        # was in if layer manager but considering the state it was executed
+        # always, moreover, there is no layer manager dependent code
+
+        # in GCP Management, set focus to current MapWindow for mouse actions
+        self.OnPointer(event)
+        self.MapWindow.SetFocus()
+
         event.Skip()
 
     def OnDraw(self, event):
@@ -627,19 +610,16 @@
         
     def IsStandalone(self):
         """!Check if Map display is standalone"""
-        if self._layerManager:
-            return False
-        
+        # we do not know and we do not care, so always False
         return True
     
     def GetLayerManager(self):
         """!Get reference to Layer Manager
 
-        @return window reference
-        @return None (if standalone)
+        @return always None
         """
-        return self._layerManager
-    
+        return None
+
     def GetSrcWindow(self):
         return self.SrcMapWindow
         
@@ -660,13 +640,3 @@
             self.UpdateActive(mapWindow)
             # needed for wingrass
             self.SetFocus()
-
-    def _onMouseLeftUpPointer(self, mapWindow, x, y):
-        if mapWindow == self.SrcMapWindow:
-            coordtype = 'source'
-        else:
-            coordtype = 'target'
-
-        coord = (x, y)
-        self._layerManager.gcpmanagement.SetGCPData(coordtype, coord, self, confirm=True)
-        mapWindow.UpdateMap(render=False, renderVector=False)

Modified: grass/trunk/gui/wxpython/gcp/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/toolbars.py	2013-07-20 10:05:25 UTC (rev 57232)
+++ grass/trunk/gui/wxpython/gcp/toolbars.py	2013-07-20 17:32:39 UTC (rev 57233)
@@ -23,8 +23,9 @@
 from core              import globalvar
 from core.utils import _
 from gui_core.toolbars import BaseToolbar, BaseIcons
-from icon              import MetaIcon
-    
+from icons.icon import MetaIcon
+
+
 class GCPManToolbar(BaseToolbar):
     """!Toolbar for managing ground control points
 

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2013-07-20 10:05:25 UTC (rev 57232)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2013-07-20 17:32:39 UTC (rev 57233)
@@ -94,8 +94,7 @@
         self.currentPageNum  = None       # currently selected page number for layer tree notebook
         self.workspaceFile = workspace    # workspace file
         self.workspaceChanged = False     # track changes in workspace
-        self.gcpmanagement = None         # reference to GCP class or None
-        
+
         wx.Frame.__init__(self, parent = parent, id = id, size = size,
                           style = style, **kwargs)
         self._setTitle()



More information about the grass-commit mailing list