Skip to content

Commit

Permalink
wxGUI/main_window: fix switches Map Display frame to full screen mode…
Browse files Browse the repository at this point in the history
… by keyboard shortcut

Hides toolbars, statusbar and panes with keyboard shortcut F11 in
single window mode.
  • Loading branch information
tmszi committed Jul 13, 2022
1 parent d0b904f commit 7db8dee
Showing 1 changed file with 57 additions and 8 deletions.
65 changes: 57 additions & 8 deletions gui/wxpython/main_window/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,11 @@ def CreateNewMapDisplay(layertree):
# set map display properties
self._setUpMapDisplay(mapdisplay)

# extend shortcuts and create frame accelerator table
mapdisplay.shortcuts_table.append(
(self.OnFullScreen, wx.ACCEL_NORMAL, wx.WXK_F11)
)
mapdisplay._initShortcuts()
return mapdisplay

# create layer tree (tree control for managing GIS layers) and put on
Expand Down Expand Up @@ -465,6 +470,48 @@ def CreateNewMapDisplay(layertree):

return self.GetMapDisplay()

def ShowFullScreen(self, mapdisplay):
"""Show fullscreen Map Display frame
:param Window mapdisplay: current Map Display page
:return bool: True if statusbar pane is shown
"""
for toolbar in mapdisplay.toolbars.keys():
pane = mapdisplay._mgr.GetPane(mapdisplay.toolbars[toolbar])
pane.Show(False if pane.IsShown() else True)
if self.statusbar:
pane = mapdisplay._mgr.GetPane("statusbar")
pane.Show(False if pane.IsShown() else True)
mapdisplay._mgr.Update()
return False if pane.IsShown() else True

def ShowPanes(self, minimize):
"""Show/hide datacatalog, layers, tools panes
:param bool minimize: show/hide pane
:return None
"""
for pane in ["datacatalog", "layers", "tools"]:
if minimize:
# Hide
self._auimgr.MinimizePane(self._auimgr.GetPane(pane))
else:
# Show
self._auimgr.RestoreMinimizedPane(self._auimgr.GetPane(pane))

def OnFullScreen(self, event):
"""Switches frame to fullscreen mode, hides toolbars, statusbar
and panes
"""
mapdisplay = self.mapnotebook.GetCurrentPage()
show = self.ShowFullScreen(
mapdisplay=mapdisplay,
)
self.ShowPanes(minimize=show)
event.Skip()

def _setUpMapDisplay(self, mapdisplay):
"""Set up Map Display properties"""
page = self.currentPage
Expand Down Expand Up @@ -673,14 +720,16 @@ def BuildPanes(self):
self._auimgr.GetPane("toolbarNviz").Hide()

# Set Tools as active tab
tools = self._auimgr.GetPane("tools")
notebook = self._auimgr.GetNotebooks()[0]
notebook.SetSelectionToPage(tools)

# Set the size for automatic notebook
pane = self._auimgr.GetPane(notebook)
pane.BestSize(self.PANE_BEST_SIZE)
pane.MinSize(self.PANE_MIN_SIZE)
notebook = self._auimgr.GetNotebooks()
if notebook:
notebook = notebook[0]
tools = self._auimgr.GetPane("tools")
notebook.SetSelectionToPage(tools)

# Set the size for automatic notebook
pane = self._auimgr.GetPane(notebook)
pane.BestSize(self.PANE_BEST_SIZE)
pane.MinSize(self.PANE_MIN_SIZE)

wx.CallAfter(self.datacatalog.LoadItems)

Expand Down

0 comments on commit 7db8dee

Please sign in to comment.