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 Single-Window: Focus the Console pane when console content has been changed #2121

Merged
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
20 changes: 20 additions & 0 deletions gui/wxpython/main_window/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ def _createConsole(self, parent):
self.goutput.showNotification.connect(
lambda message: self.SetStatusText(message)
)
self.goutput.contentChanged.connect(
lambda notification: self._focusPage(notification)
)

self._gconsole.mapCreated.connect(self.OnMapCreated)
self._gconsole.Bind(
Expand Down Expand Up @@ -947,6 +950,23 @@ def _closePageNoEvent(self, pgnum_dict):
)
self.mapnotebook.DeletePage(pgnum_dict["mapnotebook"])

def _focusPage(self, notification):
"""Focus the 'Console' notebook page according to event notification."""
if (
notification == Notification.HIGHLIGHT
or notification == Notification.MAKE_VISIBLE
or notification == Notification.RAISE_WINDOW
):
self.FocusPage("Console")

def FocusPage(self, page_text):
"""Focus the page if part of any of aui notebooks"""
notebooks = self._auimgr.GetNotebooks()
for notebook in notebooks:
for i in range(notebook.GetPageCount()):
if notebook.GetPageText(i) == page_text:
notebook.SetSelection(i)

def RunSpecialCmd(self, command):
"""Run command from command line, check for GUI wrappers"""
if re.compile(r"^d\..*").search(command[0]):
Expand Down