Adding support for Drag'n dropping panels between notebooks
authorlaurent
Sun, 08 Jan 2012 19:22:26 +0100
changeset 618 6e48943e821e
parent 617 1a80e0598045
child 619 fc03645162b5
Adding support for Drag'n dropping panels between notebooks
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Sun Jan 08 19:19:42 2012 +0100
+++ b/PLCOpenEditor.py	Sun Jan 08 19:22:26 2012 +0100
@@ -457,6 +457,8 @@
             self.LeftNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORLEFTNOTEBOOK,
                   style=wx.aui.AUI_NB_TOP|wx.aui.AUI_NB_TAB_SPLIT|wx.aui.AUI_NB_TAB_MOVE|
                         wx.aui.AUI_NB_SCROLL_BUTTONS|wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+            self.LeftNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND, 
+                    self.OnAllowNotebookDnD)
             self.AUIManager.AddPane(self.LeftNoteBook, 
                   wx.aui.AuiPaneInfo().Caption(_("Project")).Left().Layer(1).
                   BestSize(wx.Size(300, 500)).CloseButton(False))
@@ -464,6 +466,8 @@
             self.BottomNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORBOTTOMNOTEBOOK,
                   style=wx.aui.AUI_NB_TOP|wx.aui.AUI_NB_TAB_SPLIT|wx.aui.AUI_NB_TAB_MOVE|
                         wx.aui.AUI_NB_SCROLL_BUTTONS|wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+            self.BottomNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND, 
+                    self.OnAllowNotebookDnD)
             self.AUIManager.AddPane(self.BottomNoteBook, 
                   wx.aui.AuiPaneInfo().Bottom().Layer(0).
                   BestSize(wx.Size(800, 300)).CloseButton(False))
@@ -471,10 +475,12 @@
             self.RightNoteBook = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORRIGHTNOTEBOOK,
                   style=wx.aui.AUI_NB_TOP|wx.aui.AUI_NB_TAB_SPLIT|wx.aui.AUI_NB_TAB_MOVE|
                         wx.aui.AUI_NB_SCROLL_BUTTONS|wx.aui.AUI_NB_TAB_EXTERNAL_MOVE)
+            self.RightNoteBook.Bind(wx.aui.EVT_AUINOTEBOOK_ALLOW_DND, 
+                    self.OnAllowNotebookDnD)
             self.AUIManager.AddPane(self.RightNoteBook, 
                   wx.aui.AuiPaneInfo().Right().Layer(0).
                   BestSize(wx.Size(250, 400)).CloseButton(False))
-        
+            
             self.TabsOpened = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORTABSOPENED, 
                   style=wx.aui.AUI_NB_DEFAULT_STYLE|wx.aui.AUI_NB_WINDOWLIST_BUTTON)
             self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING,
@@ -1175,6 +1181,9 @@
         wx.CallAfter(self.RefreshTabCtrlEvent)
         event.Skip()
     
+    def OnAllowNotebookDnD(self, event):
+        event.Allow()
+    
     def RefreshTabCtrlEvent(self):
         if USE_AUI:
             auitabctrl = []
@@ -1200,10 +1209,8 @@
         if selected >= 0:
             window = self.TabsOpened.GetPage(selected)
             if not window.IsDebugging():
-                print "Is not Debugging"
                 wx.CallAfter(self.SelectTypesTreeItem, window.GetTagName())
             else:
-                print "Is Debugging"
                 wx.CallAfter(self.SelectInstancesTreeItem, self.InstancesTree.GetRootItem(), window.GetInstancePath())
             window.RefreshView()
             self._Refresh(FILEMENU, EDITMENU, DISPLAYMENU, TOOLBAR)