diff --git a/gui/wxpython/lmgr/frame.py b/gui/wxpython/lmgr/frame.py index 28b1841bea3..bc12315e5d8 100644 --- a/gui/wxpython/lmgr/frame.py +++ b/gui/wxpython/lmgr/frame.py @@ -65,10 +65,7 @@ from lmgr.statusbar import SbMain from lmgr.workspace import WorkspaceManager from lmgr.pyshell import PyShellWindow -from lmgr.giface import ( - LayerManagerGrassInterface, - LayerManagerGrassInterfaceForMapDisplay, -) +from lmgr.giface import LayerManagerGrassInterface from mapdisp.frame import MapDisplay from datacatalog.catalog import DataCatalog from gui_core.forms import GUI @@ -466,10 +463,10 @@ def NewDisplay(self, name=None, show=True): self.notebookLayers.AddPage(page=self.pg_panel, text=name, select=True) self.currentPage = self.notebookLayers.GetCurrentPage() - def CreateNewMapDisplay(layertree): + def CreateNewMapDisplay(giface, layertree): """Callback function which creates a new Map Display window + :param giface: giface for map display :param layertree: layer tree object - :param name: name of new map display window :return: reference to mapdisplay instance """ # count map display frame position @@ -485,14 +482,10 @@ def CreateNewMapDisplay(layertree): title=name, ) - # create instance of Map Display interface - self._gifaceForDisplay = LayerManagerGrassInterfaceForMapDisplay( - self._giface, layertree - ) # create Map Display mapdisplay = MapDisplay( parent=mapframe, - giface=self._gifaceForDisplay, + giface=giface, id=wx.ID_ANY, size=globalvar.MAP_WINDOW_SIZE, tree=layertree, diff --git a/gui/wxpython/lmgr/layertree.py b/gui/wxpython/lmgr/layertree.py index 916936509fb..db7b6d7483f 100644 --- a/gui/wxpython/lmgr/layertree.py +++ b/gui/wxpython/lmgr/layertree.py @@ -45,6 +45,7 @@ from icons.icon import MetaIcon from gui_core.widgets import MapValidator from gui_core.wrap import Menu, GenBitmapButton, TextCtrl, NewId +from lmgr.giface import LayerManagerGrassInterfaceForMapDisplay TREE_ITEM_HEIGHT = 25 @@ -152,7 +153,9 @@ def __init__( self._setGradient() # init associated map display - self.mapdisplay = createNewMapDisplay(layertree=self) + # create instance of Map Display interface + self._gifaceForDisplay = LayerManagerGrassInterfaceForMapDisplay(giface, self) + self.mapdisplay = createNewMapDisplay(self._gifaceForDisplay, layertree=self) self.root = self.AddRoot(_("Map Layers")) self.SetPyData(self.root, (None, None)) diff --git a/gui/wxpython/main_window/frame.py b/gui/wxpython/main_window/frame.py index 6f5b8bbf956..1590547ac04 100644 --- a/gui/wxpython/main_window/frame.py +++ b/gui/wxpython/main_window/frame.py @@ -70,10 +70,7 @@ from lmgr.statusbar import SbMain from lmgr.workspace import WorkspaceManager from lmgr.pyshell import PyShellWindow -from lmgr.giface import ( - LayerManagerGrassInterface, - LayerManagerGrassInterfaceForMapDisplay, -) +from lmgr.giface import LayerManagerGrassInterface from mapdisp.frame import MapPanel from datacatalog.catalog import DataCatalog from gui_core.forms import GUI @@ -417,20 +414,17 @@ def NewDisplay(self, name=None, show=True): self.currentPageNum = self.notebookLayers.GetSelection() self.notebookLayers.EnsureVisible(self.currentPageNum) - def CreateNewMapDisplay(layertree): + def CreateNewMapDisplay(giface, layertree): """Callback function which creates a new Map Display window + :param giface: giface for map display :param layertree: layer tree object :return: reference to mapdisplay instance """ - # create instance of Map Display interface - self._gifaceForDisplay = LayerManagerGrassInterfaceForMapDisplay( - self._giface, layertree - ) # create Map Display mapdisplay = MapPanel( parent=self.mapnotebook, - giface=self._gifaceForDisplay, + giface=giface, id=wx.ID_ANY, tree=layertree, lmgr=self,