Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGUI/main_window: fix switches Map Display frame to full screen mode by keyboard shortcut #2480

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions gui/wxpython/main_window/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@ def CreateNewMapDisplay(giface, 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 @@ -503,6 +508,67 @@ def CreateNewMapDisplay(giface, layertree):

return self.GetMapDisplay()

def ShowFullScreen(self, mapdisplay):
"""Switch Map Display frame to full-screen mode

:param object mapdisplay: current Map Display page instance

: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):
"""Minimize/restore docked datacatalog, layers, tools, console,
history, python pane

:param bool minimize: True if the pane is minimized
"""
# Notebooks panes
notebooks = self._auimgr.GetNotebooks()
for notebook in notebooks:
pane = self._auimgr.GetPane(notebook)
if minimize:
self._auimgr.MinimizePane(pane)
else:
self._auimgr.RestoreMinimizedPane(pane)

panes = [
"datacatalog",
"layers",
"tools",
"console",
"history",
"python",
]
for pane in panes:
pane = self._auimgr.GetPane(pane)
if (
pane.dock_direction != aui.AUI_DOCK_NOTEBOOK_PAGE
and not pane.IsFloating()
):
if minimize:
self._auimgr.MinimizePane(pane)
else:
self._auimgr.RestoreMinimizedPane(pane)

def OnFullScreen(self, event):
"""Switches Map Display frame to full-screen mode, hides toolbars,
statusbar and panes
"""
mapdisplay = self.mapnotebook.GetCurrentPage()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the mapnotebook got renamed.

minimize = self.ShowFullScreen(
mapdisplay=mapdisplay,
)
self.ShowPanes(minimize)
event.Skip()

def _setUpMapDisplay(self, mapdisplay):
"""Set up Map Display properties"""
page = self.currentPage
Expand Down
Loading