--- a/PLCOpenEditor.py Sun Jul 01 23:36:44 2012 +0200
+++ b/PLCOpenEditor.py Sat Jul 07 20:48:23 2012 +0200
@@ -346,7 +346,7 @@
split = None
for idx, tab in enumerate(tabs):
if len(tab["pages"]) == 0:
- raise ValueError, "Not possible"
+ raise ValueError, "Not possible"
if tab["size"][0] == rect.width:
if tab["pos"][1] == rect.y:
split = (wx.TOP, float(tab["size"][1]) / float(rect.height))
@@ -824,17 +824,18 @@
tabs = []
for child in notebook.GetChildren():
if isinstance(child, wx.aui.AuiTabCtrl):
- 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 not tab.has_key("size"):
- 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)
+ 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 not tab.has_key("size"):
+ 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))