785 # ------------------------------------------------------------------------------- |
785 # ------------------------------------------------------------------------------- |
786 # Saving and restoring frame organization functions |
786 # Saving and restoring frame organization functions |
787 # ------------------------------------------------------------------------------- |
787 # ------------------------------------------------------------------------------- |
788 |
788 |
789 def GetTabInfos(self, tab): |
789 def GetTabInfos(self, tab): |
790 for page_name, (page_ref, page_title) in self.MainTabs.iteritems(): |
790 for page_name, (page_ref, _page_title) in self.MainTabs.iteritems(): |
791 if page_ref == tab: |
791 if page_ref == tab: |
792 return ("main", page_name) |
792 return ("main", page_name) |
793 return None |
793 return None |
794 |
794 |
795 def SaveTabLayout(self, notebook): |
795 def SaveTabLayout(self, notebook): |
839 raise ValueError("Not supported") |
839 raise ValueError("Not supported") |
840 |
840 |
841 if "split" in tabs: |
841 if "split" in tabs: |
842 self.LoadTabLayout(notebook, tabs["others"]) |
842 self.LoadTabLayout(notebook, tabs["others"]) |
843 |
843 |
844 split_dir, split_ratio = tabs["split"] |
844 split_dir, _split_ratio = tabs["split"] |
845 first_index = self.LoadTabLayout(notebook, tabs["tab"], mode="first") |
845 first_index = self.LoadTabLayout(notebook, tabs["tab"], mode="first") |
846 notebook.Split(first_index, split_dir) |
846 notebook.Split(first_index, split_dir) |
847 self.LoadTabLayout(notebook, tabs["tab"], mode="others", first_index=first_index) |
847 self.LoadTabLayout(notebook, tabs["tab"], mode="others", first_index=first_index) |
848 |
848 |
849 elif mode == "first": |
849 elif mode == "first": |
864 def ResetPerspective(self): |
864 def ResetPerspective(self): |
865 if self.DefaultPerspective is not None: |
865 if self.DefaultPerspective is not None: |
866 self.AUIManager.LoadPerspective(self.DefaultPerspective["perspective"]) |
866 self.AUIManager.LoadPerspective(self.DefaultPerspective["perspective"]) |
867 |
867 |
868 for notebook in [self.LeftNoteBook, self.BottomNoteBook, self.RightNoteBook]: |
868 for notebook in [self.LeftNoteBook, self.BottomNoteBook, self.RightNoteBook]: |
869 for idx in xrange(notebook.GetPageCount()): |
869 for dummy in xrange(notebook.GetPageCount()): |
870 notebook.RemovePage(0) |
870 notebook.RemovePage(0) |
871 |
871 |
872 notebooks = self.DefaultPerspective["notebooks"] |
872 notebooks = self.DefaultPerspective["notebooks"] |
873 for notebook, entry_name in [(self.LeftNoteBook, "leftnotebook"), |
873 for notebook, entry_name in [(self.LeftNoteBook, "leftnotebook"), |
874 (self.BottomNoteBook, "bottomnotebook"), |
874 (self.BottomNoteBook, "bottomnotebook"), |
1013 |
1013 |
1014 def DeleteAllPages(self): |
1014 def DeleteAllPages(self): |
1015 """Function that fix difference in deleting all tabs between |
1015 """Function that fix difference in deleting all tabs between |
1016 wx.Notebook and wx.aui.AUINotebook. |
1016 wx.Notebook and wx.aui.AUINotebook. |
1017 """ |
1017 """ |
1018 for idx in xrange(self.TabsOpened.GetPageCount()): |
1018 for dummy in xrange(self.TabsOpened.GetPageCount()): |
1019 self.TabsOpened.DeletePage(0) |
1019 self.TabsOpened.DeletePage(0) |
1020 self.RefreshTabCtrlEvent() |
1020 self.RefreshTabCtrlEvent() |
1021 |
1021 |
1022 def SetPageBitmap(self, idx, bitmap): |
1022 def SetPageBitmap(self, idx, bitmap): |
1023 """Function that fix difference in setting picture on tab between |
1023 """Function that fix difference in setting picture on tab between |
2639 dc.DrawRectangle(margin_left, margin_top, area_width, area_height) |
2639 dc.DrawRectangle(margin_left, margin_top, area_width, area_height) |
2640 |
2640 |
2641 dc.SetFont(wx.Font(fontsize, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) |
2641 dc.SetFont(wx.Font(fontsize, wx.DEFAULT, wx.NORMAL, wx.NORMAL)) |
2642 dc.SetTextForeground(wx.BLACK) |
2642 dc.SetTextForeground(wx.BLACK) |
2643 block_name = " - ".join(self.Viewer.GetTagName().split("::")[1:]) |
2643 block_name = " - ".join(self.Viewer.GetTagName().split("::")[1:]) |
2644 text_width, text_height = dc.GetTextExtent(block_name) |
2644 _text_width, text_height = dc.GetTextExtent(block_name) |
2645 dc.DrawText(block_name, margin_left, margin_top - text_height - self.TextMargin) |
2645 dc.DrawText(block_name, margin_left, margin_top - text_height - self.TextMargin) |
2646 dc.DrawText(_("Page: %d") % page, margin_left, margin_top + area_height + self.TextMargin) |
2646 dc.DrawText(_("Page: %d") % page, margin_left, margin_top + area_height + self.TextMargin) |
2647 |
2647 |
2648 # Calculate the position on the DC for centering the graphic |
2648 # Calculate the position on the DC for centering the graphic |
2649 posX = area_width * ((page - 1) % self.PageGrid[0]) |
2649 posX = area_width * ((page - 1) % self.PageGrid[0]) |