Переглянути джерело

wxGUI: update statusbar when projection settings checkbox has been toggled (#2178)

Linda Kladivova 2 роки тому
батько
коміт
2c2879745b

+ 1 - 4
gui/wxpython/gcp/mapdisplay.py

@@ -30,7 +30,6 @@ from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.mapdisp import SingleMapPanel
 from gui_core.wrap import Menu
 from mapwin.buffered import BufferedMapWindow
-from mapwin.base import MapWindowProperties
 
 import mapdisp.statusbar as sb
 import gcp.statusbar as sbgcp
@@ -78,9 +77,7 @@ class MapPanel(SingleMapPanel):
         )
 
         self._giface = giface
-        # properties are shared in other objects, so defining here
-        self.mapWindowProperties = MapWindowProperties()
-        self.mapWindowProperties.setValuesFromUserSettings()
+
         self.mapWindowProperties.alignExtent = True
 
         #

+ 9 - 0
gui/wxpython/gui_core/mapdisp.py

@@ -28,6 +28,7 @@ from core.debug import Debug
 from gui_core.toolbars import ToolSwitcher
 from gui_core.wrap import NewId
 from mapdisp import statusbar as sb
+from mapwin.base import MapWindowProperties
 
 from grass.script import core as grass
 
@@ -87,6 +88,14 @@ class MapPanelBase(wx.Panel):
         self.toolbars = {}
         self.iconsize = (16, 16)
 
+        # properties are shared in other objects, so defining here
+        self.mapWindowProperties = MapWindowProperties()
+        self.mapWindowProperties.setValuesFromUserSettings()
+        # update statusbar when user-defined projection changed
+        self.mapWindowProperties.useDefinedProjectionChanged.connect(
+            self.StatusbarUpdate
+        )
+
         #
         # Fancy gui
         #

+ 1 - 3
gui/wxpython/iclass/frame.py

@@ -49,7 +49,6 @@ from core.render import Map
 from core.gcmd import RunCommand, GMessage, GError
 from gui_core.dialogs import SetOpacityDialog
 from gui_core.wrap import Menu
-from mapwin.base import MapWindowProperties
 from dbmgr.vinfo import VectorDBInfo
 
 from iclass.digit import IClassVDigitWindow, IClassVDigit
@@ -113,8 +112,7 @@ class IClassMapPanel(DoubleMapPanel):
         else:
             self.giface = StandaloneMapDisplayGrassInterface(self)
         self.tree = None
-        self.mapWindowProperties = MapWindowProperties()
-        self.mapWindowProperties.setValuesFromUserSettings()
+
         # show computation region by defaut
         self.mapWindowProperties.showRegion = True
 

+ 1 - 4
gui/wxpython/image2target/ii2t_mapdisplay.py

@@ -30,7 +30,6 @@ from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.mapdisp import SingleMapPanel
 from gui_core.wrap import Menu
 from mapwin.buffered import BufferedMapWindow
-from mapwin.base import MapWindowProperties
 
 import mapdisp.statusbar as sb
 import gcp.statusbar as sbgcp
@@ -78,9 +77,7 @@ class MapPanel(SingleMapPanel):
         )
 
         self._giface = giface
-        # properties are shared in other objects, so defining here
-        self.mapWindowProperties = MapWindowProperties()
-        self.mapWindowProperties.setValuesFromUserSettings()
+
         self.mapWindowProperties.alignExtent = True
 
         #

+ 0 - 5
gui/wxpython/mapdisp/frame.py

@@ -37,7 +37,6 @@ from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from core.debug import Debug
 from core.settings import UserSettings
 from gui_core.mapdisp import SingleMapPanel, FrameMixin
-from mapwin.base import MapWindowProperties
 from gui_core.query import QueryDialog, PrepareQueryResults
 from mapwin.buffered import BufferedMapWindow
 from mapwin.decorations import (
@@ -130,10 +129,6 @@ class MapPanel(SingleMapPanel):
         # Emitted when closing display by closing its window.
         self.closingVNETDialog = Signal("MapPanel.closingVNETDialog")
 
-        # properties are shared in other objects, so defining here
-        self.mapWindowProperties = MapWindowProperties()
-        self.mapWindowProperties.setValuesFromUserSettings()
-
         #
         # Add toolbars
         #

+ 0 - 3
gui/wxpython/mapswipe/frame.py

@@ -24,7 +24,6 @@ import grass.script as grass
 from gui_core.mapdisp import DoubleMapPanel, FrameMixin
 from gui_core.dialogs import GetImageHandlers
 from gui_core.wrap import Slider
-from mapwin.base import MapWindowProperties
 from core.render import Map
 from mapdisp import statusbar as sb
 from core.debug import Debug
@@ -68,8 +67,6 @@ class SwipeMapPanel(DoubleMapPanel):
         self.sliderH = Slider(self, id=wx.ID_ANY, style=wx.SL_HORIZONTAL)
         self.sliderV = Slider(self, id=wx.ID_ANY, style=wx.SL_VERTICAL)
 
-        self.mapWindowProperties = MapWindowProperties()
-        self.mapWindowProperties.setValuesFromUserSettings()
         self.mapWindowProperties.autoRenderChanged.connect(self.OnAutoRenderChanged)
         self.firstMapWindow = SwipeBufferedWindow(
             parent=self.splitter,

+ 3 - 1
gui/wxpython/mapwin/base.py

@@ -104,7 +104,9 @@ class MapWindowProperties(object):
 
     @useDefinedProjection.setter
     def useDefinedProjection(self, value):
-        self._useDefinedProjection = value
+        if value != self._useDefinedProjection:
+            self._useDefinedProjection = value
+            self.useDefinedProjectionChanged.emit(value=value)
 
     @property
     def epsg(self):

+ 1 - 4
gui/wxpython/photo2image/ip2i_mapdisplay.py

@@ -25,7 +25,6 @@ from gui_core.dialogs import GetImageHandlers, ImageSizeDialog
 from gui_core.mapdisp import SingleMapPanel
 from gui_core.wrap import Menu
 from mapwin.buffered import BufferedMapWindow
-from mapwin.base import MapWindowProperties
 
 import mapdisp.statusbar as sb
 import gcp.statusbar as sbgcp
@@ -72,9 +71,7 @@ class MapPanel(SingleMapPanel):
         )
 
         self._giface = giface
-        # properties are shared in other objects, so defining here
-        self.mapWindowProperties = MapWindowProperties()
-        self.mapWindowProperties.setValuesFromUserSettings()
+
         self.mapWindowProperties.alignExtent = True
 
         #