parameters: (self, event)
docstring: Handles the ``EVT_AUINOTEBOOK_END_DRAG`` event for :class:`AuiNotebook`.
  
          :param `event`: a :class:`AuiNotebookEvent` event to be processed.
docstring_summary: Handles the ``EVT_AUINOTEBOOK_END_DRAG`` event for :class:`AuiNotebook`.
docstring_tokens: Handles the EVT_AUINOTEBOOK_END_DRAG event for : class : AuiNotebook .
function: def OnTabEndDrag(self, event):
          """
          Handles the ``EVT_AUINOTEBOOK_END_DRAG`` event for :class:`AuiNotebook`.
  
          :param `event`: a :class:`AuiNotebookEvent` event to be processed.
          """
  
          tabs = event.GetEventObject()
          if not tabs.GetEnabled(event.GetSelection()):
              return
  
          self._mgr.HideHint()
  
          src_tabs = event.GetEventObject()
          if not src_tabs:
              raise Exception("no source object?")
  
          # get the mouse position, which will be used to determine the drop point
          mouse_screen_pt = wx.GetMousePosition()
          mouse_client_pt = self.ScreenToClient(mouse_screen_pt)
  
          # check for an external move
          if self._agwFlags & AUI_NB_TAB_EXTERNAL_MOVE:
              tab_ctrl = wx.FindWindowAtPoint(mouse_screen_pt)
  
              while tab_ctrl:
  
                  if isinstance(tab_ctrl, AuiTabCtrl):
                      break
  
                  tab_ctrl = tab_ctrl.GetParent()
  
              if tab_ctrl:
  
                  nb = tab_ctrl.GetParent()
  
                  if nb != self:
  
                      # find out from the destination control
                      # if it's ok to drop this tab here
                      e = AuiNotebookEvent(wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND, self.GetId())
                      e.SetSelection(event.GetSelection())
                      e.SetOldSelection(event.GetSelection())
                      e.SetEventObject(self)
                      e.SetDragSource(self)
                      e.Veto() # dropping must be explicitly approved by control owner
  
                      nb.GetEventHandler().ProcessEvent(e)
  
                      if not e.IsAllowed():
  
                          # no answer or negative answer
                          self._mgr.HideHint()
                          return
  
                      # drop was allowed
                      src_idx = event.GetSelection()
                      src_page = src_tabs.GetWindowFromIdx(src_idx)
  
                      # Check that it's not an impossible parent relationship
                      p = nb
                      while p and not p.IsTopLevel():
                          if p == src_page:
                              return
  
                          p = p.GetParent()
  
                      # get main index of the page
                      main_idx = self._tabs.GetIdxFromWindow(src_page)
                      if main_idx == wx.NOT_FOUND:
                          raise Exception("no source page?")
  
                      # make a copy of the page info
                      page_info = self._tabs.GetPage(main_idx)
  
                      # remove the page from the source notebook
                      self.RemovePage(main_idx)
  
                      # reparent the page
                      src_page.Reparent(nb)
  
                      # Reparent the control in a tab (if any)
                      if page_info.control:
                          self.ReparentControl(page_info.control, tab_ctrl)
  
                      # find out the insert idx
                      dest_tabs = tab_ctrl
                      pt = dest_tabs.ScreenToClient(mouse_screen_pt)
  
                      target = dest_tabs.TabHitTest(pt.x, pt.y)
                      insert_idx = -1
                      if target:
                          insert_idx = dest_tabs.GetIdxFromWindow(target)
  
                      # add the page to the new notebook
                      if insert_idx == -1:
                          insert_idx = dest_tabs.GetPageCount()
  
                      dest_tabs.InsertPage(page_info.window, page_info, insert_idx)
                      nb._tabs.AddPage(page_info.window, page_info)
  
                      nb.DoSizing()
                      dest_tabs.DoShowHide()
                      dest_tabs.Refresh()
  
                      # set the selection in the destination tab control
                      nb.SetSelectionToPage(page_info)
  
                      # notify owner that the tab has been dragged
                      e2 = AuiNotebookEvent(wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, self.GetId())
                      e2.SetSelection(event.GetSelection())
                      e2.SetOldSelection(event.GetSelection())
                      e2.SetEventObject(self)
                      self.GetEventHandler().ProcessEvent(e2)
  
                      # notify the target notebook that the tab has been dragged
                      e3 = AuiNotebookEvent(wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, nb.GetId())
                      e3.SetSelection(insert_idx)
                      e3.SetOldSelection(insert_idx)
                      e3.SetEventObject(nb)
                      nb.GetEventHandler().ProcessEvent(e3)
  
                      return
  
          if self._agwFlags & AUI_NB_TAB_FLOAT:
              self._mgr.HideHint()
              if self.IsMouseWellOutsideWindow():
                  # Use CallAfter so we our superclass can deal with the event first
                  wx.CallAfter(self.FloatPage, self.GetSelection())
                  event.Skip()
                  return
  
          # only perform a tab split if it's allowed
          dest_tabs = None
  
          if self._agwFlags & AUI_NB_TAB_SPLIT and self._tabs.GetPageCount() >= 2:
  
              # If the pointer is in an existing tab frame, do a tab insert
              hit_wnd = wx.FindWindowAtPoint(mouse_screen_pt)
              tab_frame = self.GetTabFrameFromTabCtrl(hit_wnd)
              insert_idx = -1
  
              if tab_frame:
  
                  dest_tabs = tab_frame._tabs
  
                  if dest_tabs == src_tabs:
                      return
  
                  pt = dest_tabs.ScreenToClient(mouse_screen_pt)
                  target = dest_tabs.TabHitTest(pt.x, pt.y)
  
                  if target:
                      insert_idx = dest_tabs.GetIdxFromWindow(target)
  
              else:
  
                  zero = wx.Point(0, 0)
                  rect = self._mgr.CalculateHintRect(self._dummy_wnd, mouse_client_pt, zero)
  
                  if rect.IsEmpty():
                      # there is no suitable drop location here, exit out
                      return
  
                  # If there is no tabframe at all, create one
                  new_tabs = TabFrame(self)
                  new_tabs._rect = wx.RectPS(wx.Point(0, 0), self.CalculateNewSplitSize())
                  new_tabs.SetTabCtrlHeight(self._tab_ctrl_height)
                  self._tab_id_counter += 1
                  new_tabs._tabs = AuiTabCtrl(self, self._tab_id_counter)
                  new_tabs._tabs.SetArtProvider(self._tabs.GetArtProvider().Clone())
                  new_tabs._tabs.SetAGWFlags(self._agwFlags)
  
                  self._mgr.AddPane(new_tabs, framemanager.AuiPaneInfo().Bottom().CaptionVisible(False), mouse_client_pt)
                  self._mgr.Update()
                  dest_tabs = new_tabs._tabs
  
                  cloned_buttons = self.CloneTabAreaButtons()
                  for clone in cloned_buttons:
                      dest_tabs.AddButton(clone.id, clone.location, clone.bitmap, clone.dis_bitmap)
              # remove the page from the source tabs
              page_info = src_tabs.GetPage(event.GetSelection())
  
              if page_info.control:
                  self.ReparentControl(page_info.control, dest_tabs)
  
              page_info.active = False
              src_tabs.RemovePage(page_info.window)
  
              if src_tabs.GetPageCount() > 0:
                  src_tabs.SetActivePage(0)
                  src_tabs.DoShowHide()
                  src_tabs.Refresh()
  
              # add the page to the destination tabs
              if insert_idx == -1:
                  insert_idx = dest_tabs.GetPageCount()
  
              dest_tabs.InsertPage(page_info.window, page_info, insert_idx)
  
              if src_tabs.GetPageCount() == 0:
                  self.RemoveEmptyTabFrames()
  
              self.DoSizing()
              dest_tabs.DoShowHide()
              dest_tabs.Refresh()
  
              # force the set selection function reset the selection
              self._curpage = -1
  
              # set the active page to the one we just split off
              self.SetSelectionToPage(page_info)
  
              self.UpdateHintWindowSize()
  
          # notify owner that the tab has been dragged
          e = AuiNotebookEvent(wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE, self.GetId())
          e.SetSelection(event.GetSelection())
          e.SetOldSelection(event.GetSelection())
          e.SetEventObject(self)
          self.GetEventHandler().ProcessEvent(e)
function_tokens: def OnTabEndDrag ( self , event ) : tabs = event . GetEventObject ( ) if not tabs . GetEnabled ( event . GetSelection ( ) ) : return self . _mgr . HideHint ( ) src_tabs = event . GetEventObject ( ) if not src_tabs : raise Exception ( "no source object?" ) # get the mouse position, which will be used to determine the drop point mouse_screen_pt = wx . GetMousePosition ( ) mouse_client_pt = self . ScreenToClient ( mouse_screen_pt ) # check for an external move if self . _agwFlags & AUI_NB_TAB_EXTERNAL_MOVE : tab_ctrl = wx . FindWindowAtPoint ( mouse_screen_pt ) while tab_ctrl : if isinstance ( tab_ctrl , AuiTabCtrl ) : break tab_ctrl = tab_ctrl . GetParent ( ) if tab_ctrl : nb = tab_ctrl . GetParent ( ) if nb != self : # find out from the destination control # if it's ok to drop this tab here e = AuiNotebookEvent ( wxEVT_COMMAND_AUINOTEBOOK_ALLOW_DND , self . GetId ( ) ) e . SetSelection ( event . GetSelection ( ) ) e . SetOldSelection ( event . GetSelection ( ) ) e . SetEventObject ( self ) e . SetDragSource ( self ) e . Veto ( ) # dropping must be explicitly approved by control owner nb . GetEventHandler ( ) . ProcessEvent ( e ) if not e . IsAllowed ( ) : # no answer or negative answer self . _mgr . HideHint ( ) return # drop was allowed src_idx = event . GetSelection ( ) src_page = src_tabs . GetWindowFromIdx ( src_idx ) # Check that it's not an impossible parent relationship p = nb while p and not p . IsTopLevel ( ) : if p == src_page : return p = p . GetParent ( ) # get main index of the page main_idx = self . _tabs . GetIdxFromWindow ( src_page ) if main_idx == wx . NOT_FOUND : raise Exception ( "no source page?" ) # make a copy of the page info page_info = self . _tabs . GetPage ( main_idx ) # remove the page from the source notebook self . RemovePage ( main_idx ) # reparent the page src_page . Reparent ( nb ) # Reparent the control in a tab (if any) if page_info . control : self . ReparentControl ( page_info . control , tab_ctrl ) # find out the insert idx dest_tabs = tab_ctrl pt = dest_tabs . ScreenToClient ( mouse_screen_pt ) target = dest_tabs . TabHitTest ( pt . x , pt . y ) insert_idx = - 1 if target : insert_idx = dest_tabs . GetIdxFromWindow ( target ) # add the page to the new notebook if insert_idx == - 1 : insert_idx = dest_tabs . GetPageCount ( ) dest_tabs . InsertPage ( page_info . window , page_info , insert_idx ) nb . _tabs . AddPage ( page_info . window , page_info ) nb . DoSizing ( ) dest_tabs . DoShowHide ( ) dest_tabs . Refresh ( ) # set the selection in the destination tab control nb . SetSelectionToPage ( page_info ) # notify owner that the tab has been dragged e2 = AuiNotebookEvent ( wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE , self . GetId ( ) ) e2 . SetSelection ( event . GetSelection ( ) ) e2 . SetOldSelection ( event . GetSelection ( ) ) e2 . SetEventObject ( self ) self . GetEventHandler ( ) . ProcessEvent ( e2 ) # notify the target notebook that the tab has been dragged e3 = AuiNotebookEvent ( wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE , nb . GetId ( ) ) e3 . SetSelection ( insert_idx ) e3 . SetOldSelection ( insert_idx ) e3 . SetEventObject ( nb ) nb . GetEventHandler ( ) . ProcessEvent ( e3 ) return if self . _agwFlags & AUI_NB_TAB_FLOAT : self . _mgr . HideHint ( ) if self . IsMouseWellOutsideWindow ( ) : # Use CallAfter so we our superclass can deal with the event first wx . CallAfter ( self . FloatPage , self . GetSelection ( ) ) event . Skip ( ) return # only perform a tab split if it's allowed dest_tabs = None if self . _agwFlags & AUI_NB_TAB_SPLIT and self . _tabs . GetPageCount ( ) >= 2 : # If the pointer is in an existing tab frame, do a tab insert hit_wnd = wx . FindWindowAtPoint ( mouse_screen_pt ) tab_frame = self . GetTabFrameFromTabCtrl ( hit_wnd ) insert_idx = - 1 if tab_frame : dest_tabs = tab_frame . _tabs if dest_tabs == src_tabs : return pt = dest_tabs . ScreenToClient ( mouse_screen_pt ) target = dest_tabs . TabHitTest ( pt . x , pt . y ) if target : insert_idx = dest_tabs . GetIdxFromWindow ( target ) else : zero = wx . Point ( 0 , 0 ) rect = self . _mgr . CalculateHintRect ( self . _dummy_wnd , mouse_client_pt , zero ) if rect . IsEmpty ( ) : # there is no suitable drop location here, exit out return # If there is no tabframe at all, create one new_tabs = TabFrame ( self ) new_tabs . _rect = wx . RectPS ( wx . Point ( 0 , 0 ) , self . CalculateNewSplitSize ( ) ) new_tabs . SetTabCtrlHeight ( self . _tab_ctrl_height ) self . _tab_id_counter += 1 new_tabs . _tabs = AuiTabCtrl ( self , self . _tab_id_counter ) new_tabs . _tabs . SetArtProvider ( self . _tabs . GetArtProvider ( ) . Clone ( ) ) new_tabs . _tabs . SetAGWFlags ( self . _agwFlags ) self . _mgr . AddPane ( new_tabs , framemanager . AuiPaneInfo ( ) . Bottom ( ) . CaptionVisible ( False ) , mouse_client_pt ) self . _mgr . Update ( ) dest_tabs = new_tabs . _tabs cloned_buttons = self . CloneTabAreaButtons ( ) for clone in cloned_buttons : dest_tabs . AddButton ( clone . id , clone . location , clone . bitmap , clone . dis_bitmap ) # remove the page from the source tabs page_info = src_tabs . GetPage ( event . GetSelection ( ) ) if page_info . control : self . ReparentControl ( page_info . control , dest_tabs ) page_info . active = False src_tabs . RemovePage ( page_info . window ) if src_tabs . GetPageCount ( ) > 0 : src_tabs . SetActivePage ( 0 ) src_tabs . DoShowHide ( ) src_tabs . Refresh ( ) # add the page to the destination tabs if insert_idx == - 1 : insert_idx = dest_tabs . GetPageCount ( ) dest_tabs . InsertPage ( page_info . window , page_info , insert_idx ) if src_tabs . GetPageCount ( ) == 0 : self . RemoveEmptyTabFrames ( ) self . DoSizing ( ) dest_tabs . DoShowHide ( ) dest_tabs . Refresh ( ) # force the set selection function reset the selection self . _curpage = - 1 # set the active page to the one we just split off self . SetSelectionToPage ( page_info ) self . UpdateHintWindowSize ( ) # notify owner that the tab has been dragged e = AuiNotebookEvent ( wxEVT_COMMAND_AUINOTEBOOK_DRAG_DONE , self . GetId ( ) ) e . SetSelection ( event . GetSelection ( ) ) e . SetOldSelection ( event . GetSelection ( ) ) e . SetEventObject ( self ) self . GetEventHandler ( ) . ProcessEvent ( e )