From 0b789a422a8bb75c10163045658f1acf5e97c263 Mon Sep 17 00:00:00 2001 From: Alex Barreto Date: Thu, 29 Jul 2021 09:40:29 -0400 Subject: [PATCH] wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689) Builds status bars based on wx.StatusBar for SwipeMapFrame, IClassMapFrame, Image2Target Frame, Photo2Image Frame, and GCP manager MapFrame. Some general methods related to a status bar and toolbars moved to gui_core class MapFrameBase. --- gui/wxpython/gcp/mapdisplay.py | 10 ++++++ gui/wxpython/gui_core/mapdisp.py | 38 ++++++++++++++++++++ gui/wxpython/iclass/frame.py | 16 +++++++++ gui/wxpython/image2target/ii2t_mapdisplay.py | 11 ++++++ gui/wxpython/mapdisp/frame.py | 34 ++++++++++++++++++ gui/wxpython/mapswipe/frame.py | 22 ++++++++++++ gui/wxpython/photo2image/ip2i_mapdisplay.py | 10 ++++++ lib/gis/parser_standard_options.c | 6 ++++ lib/init/variables.html | 7 ++++ 9 files changed, 154 insertions(+) diff --git a/gui/wxpython/gcp/mapdisplay.py b/gui/wxpython/gcp/mapdisplay.py index d23e830a7f5..5fd6363dc19 100644 --- a/gui/wxpython/gcp/mapdisplay.py +++ b/gui/wxpython/gcp/mapdisplay.py @@ -107,6 +107,10 @@ def __init__( sbgcp.SbRMSError, ] self.statusbar = self.CreateStatusbar(statusbarItems) +<<<<<<< HEAD +======= + self.statusbarManager.SetMode(8) # goto GCP +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) # # Init map display (buffered DC & set default cursor) @@ -237,13 +241,19 @@ def AddToolbar(self, name): # default toolbar if name == "map": <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) if "map" not in self.toolbars: self.toolbars["map"] = MapToolbar( self, self._toolSwitcher, self._giface ) +<<<<<<< HEAD ======= self.toolbars["map"] = MapToolbar(self, self._toolSwitcher, self._giface) >>>>>>> 953489b535 (wxGUI: fix layout flag assert in wms dialog (#1764)) +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) self._mgr.AddPane( self.toolbars["map"], diff --git a/gui/wxpython/gui_core/mapdisp.py b/gui/wxpython/gui_core/mapdisp.py index fa6be8c3177..9df00807b60 100644 --- a/gui/wxpython/gui_core/mapdisp.py +++ b/gui/wxpython/gui_core/mapdisp.py @@ -28,7 +28,10 @@ from gui_core.toolbars import ToolSwitcher from gui_core.wrap import NewId from mapdisp import statusbar as sb +<<<<<<< HEAD from mapwin.base import MapWindowProperties +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) from grass.script import core as grass @@ -159,6 +162,17 @@ def OnSize(self, event): # update statusbar self.StatusbarUpdate() +<<<<<<< HEAD +======= + def OnFullScreen(self, event): + """!Switch fullscreen mode, hides also toolbars""" + for toolbar in self.toolbars: + self._mgr.GetPane(self.toolbars[toolbar]).Show(self.IsFullScreen()) + self._mgr.Update() + self.ShowFullScreen(not self.IsFullScreen()) + event.Skip() + +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) def OnCloseWindow(self, event): self.Destroy() @@ -326,8 +340,13 @@ def CreateStatusbar(self, statusbarItems): # create statusbar and its manager statusbar = wx.StatusBar(self, id=wx.ID_ANY) statusbar.SetMinHeight(24) +<<<<<<< HEAD statusbar.SetFieldsCount(3) statusbar.SetStatusWidths([-6, -2, -1]) +======= + statusbar.SetFieldsCount(4) + statusbar.SetStatusWidths([-5, -2, -1, -1]) +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) self.statusbarManager = sb.SbManager(mapframe=self, statusbar=statusbar) # fill statusbar manager @@ -335,8 +354,17 @@ def CreateStatusbar(self, statusbarItems): statusbarItems, mapframe=self, statusbar=statusbar ) self.statusbarManager.AddStatusbarItem( +<<<<<<< HEAD sb.SbRender(self, statusbar=statusbar, position=2) ) +======= + sb.SbMask(self, statusbar=statusbar, position=2) + ) + self.statusbarManager.AddStatusbarItem( + sb.SbRender(self, statusbar=statusbar, position=3) + ) + self.statusbarManager.Update() +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) return statusbar def AddStatusbarPane(self): @@ -357,7 +385,11 @@ def AddStatusbarPane(self): ) def SetStatusText(self, *args): +<<<<<<< HEAD """Override wx.StatusBar method""" +======= + """Overide wx.StatusBar method""" +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) self.statusbar.SetStatusText(*args) def ShowStatusbar(self, show): @@ -381,6 +413,9 @@ def StatusbarEnableLongHelp(self, enable=True): toolbar.EnableLongHelp(enable) <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) def ShowAllToolbars(self, show=True): if not show: # hide action = self.RemoveToolbar @@ -422,8 +457,11 @@ def IsPaneShown(self, name): return self._mgr.GetPane(name).IsShown() return False +<<<<<<< HEAD ======= >>>>>>> 953489b535 (wxGUI: fix layout flag assert in wms dialog (#1764)) +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) def OnRender(self, event): """Re-render map composition (each map layer)""" raise NotImplementedError("OnRender") diff --git a/gui/wxpython/iclass/frame.py b/gui/wxpython/iclass/frame.py index 210d9ef08d6..ed9467fd490 100644 --- a/gui/wxpython/iclass/frame.py +++ b/gui/wxpython/iclass/frame.py @@ -192,9 +192,19 @@ def __init__( sb.SbCoordinates, sb.SbRegionExtent, sb.SbCompRegionExtent, +<<<<<<< HEAD + sb.SbDisplayGeometry, + sb.SbMapScale, + sb.SbGoTo, +======= + sb.SbShowRegion, + sb.SbAlignExtent, + sb.SbResolution, sb.SbDisplayGeometry, sb.SbMapScale, sb.SbGoTo, + sb.SbProjection, +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) ] self.statusbar = self.CreateStatusbar(statusbarItems) self._addPanes() @@ -362,6 +372,9 @@ def AddToolbar(self, name): if name == "vdigit": <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) if "vdigit" not in self.toolbars: self.toolbars[name] = VDigitToolbar( parent=self, @@ -383,6 +396,7 @@ def AddToolbar(self, name): ], ) +<<<<<<< HEAD ======= self.toolbars[name] = VDigitToolbar( parent=self, @@ -404,6 +418,8 @@ def AddToolbar(self, name): ], ) >>>>>>> 953489b535 (wxGUI: fix layout flag assert in wms dialog (#1764)) +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) self._mgr.AddPane( self.toolbars[name], wx.aui.AuiPaneInfo() diff --git a/gui/wxpython/image2target/ii2t_mapdisplay.py b/gui/wxpython/image2target/ii2t_mapdisplay.py index ff8cafa9d7e..45ade035893 100644 --- a/gui/wxpython/image2target/ii2t_mapdisplay.py +++ b/gui/wxpython/image2target/ii2t_mapdisplay.py @@ -110,6 +110,11 @@ def __init__( # create statusbar and its manager self.statusbar = self.CreateStatusbar(statusbarItems) +<<<<<<< HEAD +======= + + self.statusbarManager.SetMode(8) # goto GCP +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) # # Init map display (buffered DC & set default cursor) @@ -240,13 +245,19 @@ def AddToolbar(self, name): # default toolbar if name == "map": <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) if "map" not in self.toolbars: self.toolbars["map"] = MapToolbar( self, self._toolSwitcher, self._giface ) +<<<<<<< HEAD ======= self.toolbars["map"] = MapToolbar(self, self._toolSwitcher, self._giface) >>>>>>> 953489b535 (wxGUI: fix layout flag assert in wms dialog (#1764)) +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) self._mgr.AddPane( self.toolbars["map"], diff --git a/gui/wxpython/mapdisp/frame.py b/gui/wxpython/mapdisp/frame.py index f116b767016..927933235ef 100644 --- a/gui/wxpython/mapdisp/frame.py +++ b/gui/wxpython/mapdisp/frame.py @@ -151,17 +151,36 @@ def __init__( if statusbar: <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) # items for choice statusbarItems = [ sb.SbCoordinates, sb.SbRegionExtent, sb.SbCompRegionExtent, +<<<<<<< HEAD sb.SbDisplayGeometry, sb.SbMapScale, sb.SbGoTo, ] self.statusbarItemsDisabledInNviz = ( sb.SbDisplayGeometry, +======= + sb.SbShowRegion, + sb.SbAlignExtent, + sb.SbResolution, + sb.SbDisplayGeometry, + sb.SbMapScale, + sb.SbGoTo, + sb.SbProjection, + ] + self.statusbarItemsHiddenInNviz = ( + sb.SbAlignExtent, + sb.SbDisplayGeometry, + sb.SbShowRegion, + sb.SbResolution, +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) sb.SbMapScale, ) self.statusbar = self.CreateStatusbar(statusbarItems) @@ -176,12 +195,15 @@ def __init__( % {"command": " ".join(cmd), "error": error} ) ) +<<<<<<< HEAD ======= self.statusbar = self.CreateStatusbar() >>>>>>> 015cec3442 (wxGUI/map display: manage wx.StatusBar widget by AUI (#1646)) ======= self.statusbar = self.CreateStatusbar() >>>>>>> 270077e68a (wxGUI/map display: manage wx.StatusBar widget by AUI (#1646)) +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) # init decoration objects self.decorations = {} @@ -251,6 +273,7 @@ def __init__( .Layer(0), ) +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD # statusbar @@ -278,6 +301,11 @@ def __init__( >>>>>>> 015cec3442 (wxGUI/map display: manage wx.StatusBar widget by AUI (#1646)) ======= >>>>>>> 270077e68a (wxGUI/map display: manage wx.StatusBar widget by AUI (#1646)) +======= + # statusbar + self.AddStatusbarPane() + +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) self._mgr.Update() # @@ -338,6 +366,7 @@ def on_show_hide_statusbar(event): action=on_show_hide_statusbar, ) +<<<<<<< HEAD def CreateStatusbar(self): if self.statusbarManager: return @@ -450,6 +479,8 @@ def SetStatusText(self, *args): """Overide wx.StatusBar method""" self.statusbar.SetStatusText(*args) +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) def GetMapWindow(self): return self.MapWindow @@ -811,6 +842,7 @@ def RemoveToolbar(self, name, destroy=False): self._mgr.Update() +<<<<<<< HEAD <<<<<<< HEAD ======= def ShowAllToolbars(self, show=True): @@ -831,6 +863,8 @@ def IsPaneShown(self, name): return False >>>>>>> da7f79c3f9 (libpython: Save and load benchmark results (#1711)) +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) def RemoveQueryLayer(self): """Removes temporary map layers (queries)""" qlayer = self.GetMap().GetListOfLayers(name=globalvar.QUERYLAYER) diff --git a/gui/wxpython/mapswipe/frame.py b/gui/wxpython/mapswipe/frame.py index 14c1fd91e28..e907f1e7ca9 100644 --- a/gui/wxpython/mapswipe/frame.py +++ b/gui/wxpython/mapswipe/frame.py @@ -99,9 +99,19 @@ def __init__( sb.SbCoordinates, sb.SbRegionExtent, sb.SbCompRegionExtent, +<<<<<<< HEAD sb.SbDisplayGeometry, sb.SbMapScale, sb.SbGoTo, +======= + sb.SbShowRegion, + sb.SbAlignExtent, + sb.SbResolution, + sb.SbDisplayGeometry, + sb.SbMapScale, + sb.SbGoTo, + sb.SbProjection, +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) ] self.statusbar = self.CreateStatusbar(statusbarItems) @@ -274,7 +284,11 @@ def AddToolbar(self, name): .Layer(2) .Row(1) .Position(0) +<<<<<<< HEAD .BestSize(self.toolbars["swipeMain"].GetBestSize()), +======= + .BestSize((self.toolbars["swipeMain"].GetBestSize())), +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) ) if name == "swipeMap": @@ -296,7 +310,11 @@ def AddToolbar(self, name): .Layer(2) .Row(1) .Position(1) +<<<<<<< HEAD .BestSize(self.toolbars["swipeMap"].GetBestSize()), +======= + .BestSize((self.toolbars["swipeMap"].GetBestSize())), +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) ) if name == "swipeMisc": @@ -318,7 +336,11 @@ def AddToolbar(self, name): .Layer(2) .Row(1) .Position(2) +<<<<<<< HEAD .BestSize(self.toolbars["swipeMisc"].GetBestSize()), +======= + .BestSize((self.toolbars["swipeMisc"].GetBestSize())), +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) ) def _addPanes(self): diff --git a/gui/wxpython/photo2image/ip2i_mapdisplay.py b/gui/wxpython/photo2image/ip2i_mapdisplay.py index f526580fc47..692473189ac 100644 --- a/gui/wxpython/photo2image/ip2i_mapdisplay.py +++ b/gui/wxpython/photo2image/ip2i_mapdisplay.py @@ -104,6 +104,10 @@ def __init__( # create statusbar and its manager self.statusbar = self.CreateStatusbar(statusbarItems) +<<<<<<< HEAD +======= + self.statusbarManager.SetMode(8) # goto GCP +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) # # Init map display (buffered DC & set default cursor) @@ -232,13 +236,19 @@ def AddToolbar(self, name): # default toolbar if name == "map": <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) if "map" not in self.toolbars: self.toolbars["map"] = MapToolbar( self, self._toolSwitcher, self._giface ) +<<<<<<< HEAD ======= self.toolbars["map"] = MapToolbar(self, self._toolSwitcher, self._giface) >>>>>>> 953489b535 (wxGUI: fix layout flag assert in wms dialog (#1764)) +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) self._mgr.AddPane( self.toolbars["map"], diff --git a/lib/gis/parser_standard_options.c b/lib/gis/parser_standard_options.c index 1be16ba95df..256ad0cb6ff 100644 --- a/lib/gis/parser_standard_options.c +++ b/lib/gis/parser_standard_options.c @@ -762,12 +762,16 @@ struct Option *G_define_standard_option(int opt) Opt->answer = "1"; <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) /* start dynamic answer */ /* check NPROCS in GISRC, set with g.gisenv */ memstr = G_store(G_getenv_nofatal("NPROCS")); if (memstr && *memstr) Opt->answer = memstr; /* end dynamic answer */ +<<<<<<< HEAD Opt->description = _("Number of threads for parallel computing"); break; @@ -775,6 +779,8 @@ struct Option *G_define_standard_option(int opt) ======= ======= >>>>>>> 270077e68a (wxGUI/map display: manage wx.StatusBar widget by AUI (#1646)) +======= +>>>>>>> 03a790ad9a (wxGUI: refactoring: build GUI tools' status bars based on wx.StatusBar widget (#1689)) Opt->description = _("Number of threads for parallel computing"); break; diff --git a/lib/init/variables.html b/lib/init/variables.html index e62e8901b7a..70f369213bc 100644 --- a/lib/init/variables.html +++ b/lib/init/variables.html @@ -557,6 +557,13 @@

List of selected GRASS gisenv variables

# set to 6 GB (default: 300 MB) g.gisenv set="MEMORYMB=6000" + +
NPROCS
+
sets the number of threads for parallel computing +
+# set to use 12 threads (default: 1)
+g.gisenv set="NPROCS=12"
+
NPROCS
sets the number of threads for parallel computing