Created
November 19, 2012 02:36
-
-
Save TkTech/4108678 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class JawaEditorPanel(wx.Panel): | |
""" | |
Constructs the right panel which contains the viewer window. | |
""" | |
def __init__(self, *args, **kwargs): | |
super(JawaEditorPanel, self).__init__(*args, **kwargs) | |
self._notebook = notebook = wx.aui.AuiNotebook( | |
self, | |
wx.ID_ANY, style=( | |
wx.EXPAND | | |
wx.aui.AUI_NB_CLOSE_ON_ACTIVE_TAB | | |
wx.aui.AUI_NB_WINDOWLIST_BUTTON | |
) | |
) | |
self.box = box = wx.BoxSizer(wx.HORIZONTAL) | |
box.Add(notebook, proportion=1, flag=wx.EXPAND) | |
self.SetSizer(box) | |
self.Bind( | |
wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE, | |
self._notebook_closing, | |
notebook) | |
self.Bind( | |
wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSED, | |
self._notebook_closed, | |
notebook) | |
@property | |
def notebook(self): | |
return self._notebook | |
def _notebook_closing(self, event): | |
# Temporary workaround due to Freeze being broken in 2.9.3+ | |
self.notebook.Freeze() | |
# Select the previous page BEFORE closing this page. | |
if event.Selection > 0: | |
self.notebook.SetSelection(event.Selection - 1) | |
def _notebook_closed(self, event): | |
# Pages have been closed & switched. | |
self.notebook.Thaw() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment