Skip to content

Instantly share code, notes, and snippets.

@TkTech
Created November 19, 2012 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TkTech/4108678 to your computer and use it in GitHub Desktop.
Save TkTech/4108678 to your computer and use it in GitHub Desktop.
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