def SaveTabLayout(self, notebook):
tabs = []
for child in notebook.GetChildren():
if isinstance(child, wx.aui.AuiTabCtrl):
if child.GetPageCount() > 0:
pos = child.GetPosition()
tab = {"pos": (pos.x, pos.y), "pages": []}
tab_size = child.GetSize()
for page_idx in xrange(child.GetPageCount()):
page = child.GetWindowFromIdx(page_idx)
if "size" not in tab:
tab["size"] = (tab_size[0], tab_size[1] + page.GetSize()[1])
tab_infos = self.GetTabInfos(page)
if tab_infos is not None:
tab["pages"].append((tab_infos, page_idx == child.GetActivePage()))
tabs.append(tab)
tabs.sort(lambda x, y: cmp(x["pos"], y["pos"]))
size = notebook.GetSize()
return ComputeTabsLayout(tabs, wx.Rect(1, 1, size[0] - NOTEBOOK_BORDER, size[1] - NOTEBOOK_BORDER))
评论列表
文章目录