From 703d5561f7730029a4913cb27a8e6ad070bbc8d3 Mon Sep 17 00:00:00 2001 From: Tomas Zigo <50632337+tmszi@users.noreply.github.com> Date: Tue, 1 Aug 2023 05:12:37 +0200 Subject: [PATCH] wxGUI/lmgr: fix saving web service layer as raster map (#3101) Co-authored-by: Anna Petrasova --- gui/wxpython/lmgr/frame.py | 15 ++++----------- gui/wxpython/lmgr/layertree.py | 5 ++++- gui/wxpython/main_window/frame.py | 14 ++++---------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/gui/wxpython/lmgr/frame.py b/gui/wxpython/lmgr/frame.py index e98512f2502..5e940c67dc3 100644 --- a/gui/wxpython/lmgr/frame.py +++ b/gui/wxpython/lmgr/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 MapDisplay from datacatalog.catalog import DataCatalog from gui_core.forms import GUI @@ -484,10 +481,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 @@ -503,14 +500,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 5d7a46de8da..77ef66604a7 100644 --- a/gui/wxpython/main_window/frame.py +++ b/gui/wxpython/main_window/frame.py @@ -76,10 +76,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 @@ -415,20 +412,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,