Skip to content

Commit

Permalink
wxGUI Single-Window: Focus the Console pane when console content has …
Browse files Browse the repository at this point in the history
…been changed (#2121)
  • Loading branch information
lindakarlovska authored Jan 26, 2022
1 parent 45c1e7f commit 64d3a85
Showing 1 changed file with 20 additions and 0 deletions.
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

0 comments on commit 64d3a85

Please sign in to comment.