dabo Commit
Revision 7182
Date: 2012-05-15 10:28:30 -0700 (Tue, 15 May 2012)
Author: Ed
Trac: http://trac.dabodev.com/changeset/7182
Changed:
U trunk/dabo/ui/uiwx/dPageFrame.py
Log:
Removing pages in dPageToolBar did not properly remove the associated tool
button. This commit fixes that.
Diff:
Modified: trunk/dabo/ui/uiwx/dPageFrame.py
===================================================================
--- trunk/dabo/ui/uiwx/dPageFrame.py 2012-05-15 17:25:01 UTC (rev 7181)
+++ trunk/dabo/ui/uiwx/dPageFrame.py 2012-05-15 17:28:30 UTC (rev 7182)
@@ -92,6 +92,37 @@
super(dPageToolBar, self)._afterInit()
+ def removePage(self, pgOrPos, delPage=True):
+ """
+ Removes the specified page. You can specify a page by either
+ passing the page itself, or a position. If delPage is True
(default),
+ the page is released, and None is returned. If delPage is
+ False, the page is returned. There is a bug in the wx.Toolbook
class
+ that breaks the link between the toolbar buttons and their pages
+ when a page is removed, so this attempts to work around this.
+ """
+ pos = pgOrPos
+ if isinstance(pgOrPos, int):
+ pg = self.Pages[pgOrPos]
+ else:
+ pg = pgOrPos
+ pos = self.Pages.index(pg)
+ # Get all the pages after the one to be deleted
+ laterPages = self.Pages[pos + 1:]
+ for lpg in laterPages:
+ self.RemovePage(pos + 1)
+ if delPage:
+ self.DeletePage(pos)
+ ret = None
+ else:
+ self.RemovePage(pos)
+ ret = pg
+ for lpg in laterPages:
+ self.appendPage(lpg, caption=lpg.Caption,
imgKey=lpg.imgKey)
+ return ret
+
+
+
class dPageList(dPageFrameMixin, wx.Listbook):
_evtPageChanged = readonly(wx.EVT_LISTBOOK_PAGE_CHANGED)
_evtPageChanging = readonly(wx.EVT_LISTBOOK_PAGE_CHANGING)
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message:
http://leafe.com/archives/byMID/[email protected]