Skip to content
Snippets Groups Projects
Commit 72d8c6da authored by Paul McCarthy's avatar Paul McCarthy
Browse files

Fixed bug w.r.t. user grouping control panels into a tabbed notebook.

parent 13de8170
No related branches found
No related tags found
No related merge requests found
...@@ -557,31 +557,49 @@ class ViewPanel(fslpanel.FSLEyesPanel): ...@@ -557,31 +557,49 @@ class ViewPanel(fslpanel.FSLEyesPanel):
ev.Skip() ev.Skip()
panel = ev.GetPane().window panel = ev.GetPane().window
if isinstance(panel, (fslpanel .FSLEyesPanel, # If the user has grouped multiple control panels
fsltoolbar.FSLEyesToolBar)): # into a single tabbed notebook, and then closed
# the entire notebook, the AuiManager will generate
panel = self.__panels.pop(type(panel), None) # a single close event, and will pass us that
# notebook. So we have to look in the notebook
# WTF AUI. Sometimes this method gets called # to see which control panels were actually closed.
# twice for a panel, the second time with a if isinstance(panel, wx.lib.agw.aui.AuiNotebook):
# reference to a wx._wxpyDeadObject; in such panels = [panel.GetPage(i) for i in range(panel.GetPageCount())]
# situations, the Destroy method call below else:
# will result in an exception being raised. panels = [panel]
if panel is not None:
log.debug('Panel closed: {}'.format(type(panel).__name__)) for panel in list(panels):
if isinstance(panel, (fslpanel .FSLEyesPanel,
fsltoolbar.FSLEyesToolBar)):
# WTF AUI. Sometimes this method gets called
# twice for a panel, the second time with a
# reference to a wx._wxpyDeadObject; in such
# situations, the Destroy method call below
# would result in an exception being raised.
if self.__panels.pop(type(panel), None) is None:
panels.remove(panel)
# calling fslpanel.FSLEyesPanel.destroy() # calling fslpanel.FSLEyesPanel.destroy()
# here - wx.Destroy is done below # here - wx.Destroy is done below
panel.destroy() else:
log.debug('Panel closed: {}'.format(type(panel).__name__))
# Even when the user closes a pane, panel.destroy()
# AUI does not detach said pane -
# we have to do it manually # Destroy all the panels
self.__auiMgr.DetachPane(panel) for panel in panels:
self.__auiMgrUpdate()
# Even when the user closes a pane,
panel.Destroy() # AUI does not detach said pane -
# we have to do it manually
self.__auiMgr.DetachPane(panel)
wx.CallAfter(panel.Destroy)
# Update the view panel layout
wx.CallAfter(self.__auiMgrUpdate)
# #
# Here I am monkey patching the # Here I am monkey patching the
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment