345 |
345 |
346 self._init_sizers() |
346 self._init_sizers() |
347 else: |
347 else: |
348 self.AUIManager = wx.aui.AuiManager(self) |
348 self.AUIManager = wx.aui.AuiManager(self) |
349 self.AUIManager.SetDockSizeConstraint(0.5, 0.5) |
349 self.AUIManager.SetDockSizeConstraint(0.5, 0.5) |
|
350 self.Panes = {} |
350 |
351 |
351 self.PluginTree = CT.CustomTreeCtrl(id=ID_BEREMIZPLUGINTREE, |
352 self.PluginTree = CT.CustomTreeCtrl(id=ID_BEREMIZPLUGINTREE, |
352 name='PluginTree', parent=self, pos=wx.Point(0, 0), |
353 name='PluginTree', parent=self, pos=wx.Point(0, 0), |
353 size=wx.Size(-1, -1), style=CT.TR_HAS_BUTTONS|CT.TR_EDIT_LABELS|CT.TR_HAS_VARIABLE_ROW_HEIGHT|CT.TR_NO_LINES|wx.TR_SINGLE|wx.SUNKEN_BORDER) |
354 size=wx.Size(-1, -1), style=CT.TR_HAS_BUTTONS|CT.TR_EDIT_LABELS|CT.TR_HAS_VARIABLE_ROW_HEIGHT|CT.TR_NO_LINES|wx.TR_SINGLE|wx.SUNKEN_BORDER) |
354 self.PluginTree.Bind(wx.EVT_RIGHT_UP, self.OnPluginTreeRightUp) |
355 self.PluginTree.Bind(wx.EVT_RIGHT_UP, self.OnPluginTreeRightUp) |
546 if wx.VERSION >= (2, 8, 0): |
547 if wx.VERSION >= (2, 8, 0): |
547 item = self.PluginTree.AppendItem(root, "", ct_type=1) |
548 item = self.PluginTree.AppendItem(root, "", ct_type=1) |
548 else: |
549 else: |
549 item = self.PluginTree.AppendItem(root, "") |
550 item = self.PluginTree.AppendItem(root, "") |
550 |
551 |
551 if wx.Platform != '__WXMSW__': |
552 if wx.Platform != '__WXMSW__' or wx.VERSION >= (2, 8, 0): |
552 item, root_cookie = self.PluginTree.GetNextChild(root, root_cookie) |
553 item, root_cookie = self.PluginTree.GetNextChild(root, root_cookie) |
553 self.GenerateTreeBranch(item, values) |
554 self.GenerateTreeBranch(item, values) |
554 item, root_cookie = self.PluginTree.GetNextChild(root, root_cookie) |
555 item, root_cookie = self.PluginTree.GetNextChild(root, root_cookie) |
555 while item is not None and item.IsOk(): |
556 while item is not None and item.IsOk(): |
556 to_delete.append(item) |
557 to_delete.append(item) |
641 event.Skip() |
642 event.Skip() |
642 |
643 |
643 def RefreshPluginToolBar(self): |
644 def RefreshPluginToolBar(self): |
644 if wx.VERSION < (2, 8, 0): |
645 if wx.VERSION < (2, 8, 0): |
645 self.ClearSizer(self.MenuSizer) |
646 self.ClearSizer(self.MenuSizer) |
|
647 else: |
|
648 if "ToolBar" in self.Panes: |
|
649 self.AUIManager.DetachPane(self.Panes["ToolBar"]) |
|
650 self.Panes["ToolBar"].Destroy() |
646 if self.PluginRoot.HasOpenedProject() and len(self.PluginRoot.PluginMethods) > 0: |
651 if self.PluginRoot.HasOpenedProject() and len(self.PluginRoot.PluginMethods) > 0: |
647 if wx.VERSION > (2, 8, 0): |
652 if wx.VERSION > (2, 8, 0): |
648 toolbar = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, |
653 toolbar = wx.ToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, |
649 wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER | wx.TB_TEXT) |
654 wx.TB_FLAT | wx.TB_NODIVIDER | wx.NO_BORDER | wx.TB_TEXT) |
|
655 toolbar.SetToolBitmapSize(wx.Size(48, 48)) |
650 else: |
656 else: |
651 boxsizer = wx.BoxSizer(wx.HORIZONTAL) |
657 boxsizer = wx.BoxSizer(wx.HORIZONTAL) |
652 for plugin_infos in self.PluginRoot.PluginMethods: |
658 for plugin_infos in self.PluginRoot.PluginMethods: |
653 if "method" in plugin_infos: |
659 if "method" in plugin_infos: |
654 id = wx.NewId() |
660 id = wx.NewId() |
680 if wx.VERSION < (2, 8, 0): |
686 if wx.VERSION < (2, 8, 0): |
681 self.MenuSizer.AddSizer(boxsizer, 0, border=5, flag=wx.GROW|wx.ALL) |
687 self.MenuSizer.AddSizer(boxsizer, 0, border=5, flag=wx.GROW|wx.ALL) |
682 self.RightGridSizer.Layout() |
688 self.RightGridSizer.Layout() |
683 else: |
689 else: |
684 toolbar.Realize() |
690 toolbar.Realize() |
|
691 self.Panes["ToolBar"] = toolbar |
685 self.AUIManager.AddPane(toolbar, wx.aui.AuiPaneInfo(). |
692 self.AUIManager.AddPane(toolbar, wx.aui.AuiPaneInfo(). |
686 Name("ToolBar").Caption("Toolbar"). |
693 Name("ToolBar").Caption("Toolbar"). |
687 ToolbarPane().Top(). |
694 ToolbarPane().Top(). |
688 LeftDockable(False).RightDockable(False)) |
695 LeftDockable(False).RightDockable(False)) |
689 self.AUIManager.Update() |
696 self.AUIManager.Update() |