Forráskód Böngészése

wxGUI/giface: correcting the handling of current vs map window's layer tree

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54962 15284696-431f-4ddb-bdfa-cd5b030d7da7
Vaclav Petras 12 éve
szülő
commit
45b3e1d30d
2 módosított fájl, 27 hozzáadás és 1 törlés
  1. 22 0
      gui/wxpython/lmgr/giface.py
  2. 5 1
      gui/wxpython/lmgr/layertree.py

+ 22 - 0
gui/wxpython/lmgr/giface.py

@@ -105,3 +105,25 @@ class LayerManagerGrassInterface(object):
 
     def GetProgress(self):
         return self.lmgr.goutput.GetProgressBar()
+
+
+class LayerManagerGrassInterfaceForMapDisplay(LayerManagerGrassInterface):
+    """!Provides reference only to the given layer list (according to tree),
+        not to the current.
+    """
+    def __init__(self, lmgr, tree):
+        """!
+        @lmgr layer manager
+        @tree tree which will be used instead of the lmgr.tree
+        """
+        LayerManagerGrassInterface.__init__(self, lmgr)
+        self.tree = tree
+
+    def GetLayerTree(self):
+        return self.tree
+
+    def GetLayerList(self):
+        return LayerList(self.tree)
+
+    def GetMapWindow(self):
+        return self.tree.GetMapDisplay()

+ 5 - 1
gui/wxpython/lmgr/layertree.py

@@ -46,6 +46,7 @@ from gui_core.toolbars    import BaseIcons
 from icons.icon           import MetaIcon
 from modules.colorrules   import RasterColorTable
 from web_services.dialogs import SaveWMSLayerDialog
+from lmgr.giface import LayerManagerGrassInterfaceForMapDisplay
 
 
 TREE_ITEM_HEIGHT = 25
@@ -155,7 +156,10 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
         
         # init associated map display
         pos = wx.Point((self.displayIndex + 1) * 25, (self.displayIndex + 1) * 25)
-        self.mapdisplay = MapFrame(self, giface = self._giface, id = wx.ID_ANY, pos = pos,
+        gifaceForDisplay = LayerManagerGrassInterfaceForMapDisplay(self.lmgr,
+                                                                   self)
+        self.mapdisplay = MapFrame(self, giface = gifaceForDisplay,
+                                   id = wx.ID_ANY, pos = pos,
                                    size = globalvar.MAP_WINDOW_SIZE,
                                    style = wx.DEFAULT_FRAME_STYLE,
                                    tree = self, notebook = self.notebook,