def NewWindow(self, pos=wx.DefaultPosition, size=None): 'Creates a new window with the callback function.' win = self.factory(pos, size) win.Show(False) fadein(win, 'normal') return win
def NewWindow(self, pos = wx.DefaultPosition, size = None): 'Creates a new window with the callback function.' win = self.factory(pos, size) win.Show(False) fadein(win,'normal') return win
def OnDragFinish(self, draggedidx): """ Called when a drag completes. Determine whether to create a new IM window, add a tab, etc. and handle destruction of the current frame if all notebook frames are gone. """ assert draggedidx != -1 # FIXME: Really the drop targets themselves should respond to the event IMHO. # Not sure what the proper way of notifying the app that a target was dropped on "desktop space" # is though. pos = wx.GetMousePosition() for imframe in gui.imwin.imtabs.all_imframes(): notebook = imframe.notebook localcoords = notebook._pages.ScreenToClient(pos) notebook._pages._isdragging = True where = notebook._pages.HitTest(localcoords)[0] notebook._pages._isdragging = False if not imframe == self.potentialNewWin and where == fnb.FNB_TAB: # this is ugly, but having external DND handling requires us to fiddle with the class internals page = self.frame.notebook.GetPage(draggedidx) imframe.AddTab(page, True) self.potentialNewWin.Destroy() break else: fadein(self.potentialNewWin, 'normal') self.potentialNewWin.Raise() self.frame.notebook.RemovePage(draggedidx)
def Start(self,overlayimage): """ Fade in overlay and start timer """ wx.Timer.Start(self,1) self.overlay=overlayimage self.overlay.Move(wx.GetMousePosition()+(2,4)) fadein(self.overlay,to=self.overlay.alpha)
def Start(self, overlayimage): """ Fade in overlay and start timer """ wx.Timer.Start(self, 1) self.overlay = overlayimage self.overlay.Move(wx.GetMousePosition() + (2, 4)) fadein(self.overlay, to=self.overlay.alpha)
def _showat(self, rect, nofade=False): self.SetRect(rect) self.EnsureInScreen(client_area=False) if nofade: self.Show() elif getattr(self.vlist.menu, '_showquick', False): self.vlist.menu._showquick = False self.Show() else: fadein(self, 'xfast') # HACK: solves popup Z-fighting if wxMSW: CallLater(1, lambda: self.Refresh() if self else None) self.vlist.OnPopup()
def _showat(self, rect, nofade = False): self.SetRect(rect) self.EnsureInScreen(client_area = False) if nofade: self.Show() elif getattr(self.vlist.menu, '_showquick', False): self.vlist.menu._showquick = False self.Show() else: fadein(self, 'xfast') # HACK: solves popup Z-fighting if wxMSW: CallLater(1, lambda: self.Refresh() if self else None) self.vlist.OnPopup()
def ReadyBook(self, currentbook, pos): """ For when merging windows Knowing what window is being dragged figures out what window is being dragged into and sets up transfer """ #if there is no destination or destination is not valid if not self.destination or not self.destination.window.Rect.Contains( pos): #Look through all books in the book list for bookref in self.books[:]: book = bookref() if book is None or wx.IsDestroyed(book): self.books.remove(bookref) else: #if not the same window that's being dragged if book.window != currentbook.window: rect = book.window.Rect #if this is where the destination is but not set as destination yet if rect.Contains(pos) and self.destination != book: #Set as destination and show tabbar self.destination = book self.destination.tabbar.Toggle(True) #if this book is the destination and is no longer valid if self.destination and not rect.Contains( pos) and self.destination == book: #reset variables back to normal state tb = self.destination.tabbar tb.Toggle() tb.dragtarget = None tb.dragorigin = None tb.dropmarker.Show(False) tb.dragside = None self.destination = None #reshow dragging window if not self.fadeflag: fadein(currentbook.window, pref('tabs.fade_speed', "normal")) if currentbook.preview: currentbook.preview.Show(False) self.fadeflag = True #if there is a destination if self.destination: barrect = self.destination.tabbar.Rect #if mouse is inside destination's tabbar if barrect.Contains(self.destination.ScreenToClient(pos)): #should do drag and drop stuff, showing of drop arrow self.destination.tabbar.DragCalc( self.destination.tabbar.ScreenToClient(pos)) self.destination.tabbar.dragorigin = None #fadeout window if currentbook.preview: currentbook.preview.Move(wx.GetMousePosition() + (2, 4)) if self.fadeflag: self.fadeobject = currentbook.window.Show(False) if currentbook.preview: fadein(currentbook.preview, pref('tabs.fade_speed', "normal"), to=currentbook.preview.alpha) self.fadeflag = False #show tabs #mouse is not in tabbar else: self.destination.tabbar.dropmarker.Show(False) #Fade in window if not self.fadeflag: fadein(currentbook.window, pref('tabs.fade_speed', "normal")) if currentbook.preview: currentbook.preview.Show(False) self.fadeflag = True
def newIMWindow(pos, size): win = ImFrame(pos, size) win.Show(False) fadein(win,'normal') return win
def ReadyBook(self,currentbook,pos): """ For when merging windows Knowing what window is being dragged figures out what window is being dragged into and sets up transfer """ #if there is no destination or destination is not valid if not self.destination or not self.destination.window.Rect.Contains(pos): #Look through all books in the book list for bookref in self.books[:]: book = bookref() if book is None or wx.IsDestroyed(book): self.books.remove(bookref) else: #if not the same window that's being dragged if book.window != currentbook.window: rect = book.window.Rect #if this is where the destination is but not set as destination yet if rect.Contains(pos) and self.destination != book: #Set as destination and show tabbar self.destination=book self.destination.tabbar.Toggle(True) #if this book is the destination and is no longer valid if self.destination and not rect.Contains(pos) and self.destination==book: #reset variables back to normal state tb = self.destination.tabbar tb.Toggle() tb.dragtarget=None tb.dragorigin=None tb.dropmarker.Show(False) tb.dragside=None self.destination=None #reshow dragging window if not self.fadeflag: fadein(currentbook.window,pref('tabs.fade_speed',"normal")) if currentbook.preview: currentbook.preview.Show(False) self.fadeflag=True #if there is a destination if self.destination: barrect=self.destination.tabbar.Rect #if mouse is inside destination's tabbar if barrect.Contains(self.destination.ScreenToClient(pos)): #should do drag and drop stuff, showing of drop arrow self.destination.tabbar.DragCalc(self.destination.tabbar.ScreenToClient(pos)) self.destination.tabbar.dragorigin=None #fadeout window if currentbook.preview: currentbook.preview.Move(wx.GetMousePosition()+(2,4)) if self.fadeflag: self.fadeobject=currentbook.window.Show(False) if currentbook.preview: fadein(currentbook.preview,pref('tabs.fade_speed',"normal"),to=currentbook.preview.alpha) self.fadeflag=False #show tabs #mouse is not in tabbar else: self.destination.tabbar.dropmarker.Show(False) #Fade in window if not self.fadeflag: fadein(currentbook.window,pref('tabs.fade_speed',"normal")) if currentbook.preview: currentbook.preview.Show(False) self.fadeflag=True
def Display(self, caller=None, funnle=True, funnlefullscreen=False): """ Display the menu """ self.BeforeDisplay() if not self.IsShown() and len(self): self.spine.CalcSize() if caller and isinstance(caller, SimpleMenuSpine): self.caller = None rect = caller.GetSelectionRect() position = Point(rect.x + rect.width, rect.y - self.spine.framesize.top) newrect = RectPS(position, self.ScreenRect.Size) screenrect = Monitor.GetFromRect(newrect).Geometry if newrect.bottom > screenrect.bottom: position.y = rect.y + rect.height - self.Size.height if newrect.right > screenrect.right: position.x = rect.x - self.Size.width elif caller: self.caller = caller caller_rect = caller.ScreenRect position = caller_rect.BottomLeft newrect = RectPS(position, self.ScreenRect.Size) screenrect = Monitor.GetFromWindow(caller).Geometry if newrect.bottom > screenrect.bottom: position.y -= caller_rect.Height + self.spine.Size.height if newrect.right > screenrect.right: position.x += caller_rect.Width - self.spine.Size.width else: self.caller = None position = wx.GetMousePosition() newrect = RectPS(position, self.ScreenRect.Size) screenrect = Monitor.GetFromPoint(position).Geometry if newrect.bottom > screenrect.bottom: position.y -= self.spine.Size.height if newrect.right > screenrect.right and pref( 'menus.shift_mode', False): position.x -= self.spine.Size.width newrect = wx.RectPS(position, self.Size) screenrect = Monitor.GetFromRect(newrect).Geometry pos = screenrect.Clamp(newrect).Position if funnle else position self.SetRect(RectPS(pos, self.Size)) self.spine.SetSelection(-1) fadein(self, 'xfast') self.spine.RefreshAll() if not self.spine.HasCapture(): self.spine.CaptureMouse() wx.CallLater(10, self.Refresh) if not isinstance(caller, SimpleMenuSpine): self.TopConnect()
def newIMWindow(pos, size): win = ImFrame(pos, size) win.Show(False) fadein(win, 'normal') return win
def NewWindow(self,tabman=None,pos=wx.DefaultPosition): if pos[1]<0:pos[1]=0 Fn=F(self,tabman,pos) if tabman else F(self,self.tabman,pos) Fn.Show(False) fadein(Fn,'quick') return Fn
def Display(self, caller = None, funnle = True,funnlefullscreen=False): """ Display the menu """ self.BeforeDisplay() if not self.IsShown() and len(self): self.spine.CalcSize() if caller and isinstance(caller, SimpleMenuSpine): self.caller = None rect = caller.GetSelectionRect() position = Point(rect.x+rect.width,rect.y - self.spine.framesize.top) newrect = RectPS(position, self.ScreenRect.Size) screenrect = Monitor.GetFromRect(newrect).Geometry if newrect.bottom > screenrect.bottom: position.y=rect.y+rect.height-self.Size.height if newrect.right > screenrect.right: position.x=rect.x-self.Size.width elif caller: self.caller = caller caller_rect = caller.ScreenRect position = caller_rect.BottomLeft newrect = RectPS(position, self.ScreenRect.Size) screenrect = Monitor.GetFromWindow(caller).Geometry if newrect.bottom > screenrect.bottom: position.y -= caller_rect.Height + self.spine.Size.height if newrect.right > screenrect.right: position.x += caller_rect.Width - self.spine.Size.width else: self.caller = None position = wx.GetMousePosition() newrect = RectPS(position, self.ScreenRect.Size) screenrect = Monitor.GetFromPoint(position).Geometry if newrect.bottom > screenrect.bottom: position.y -= self.spine.Size.height if newrect.right > screenrect.right and pref('menus.shift_mode', False): position.x -= self.spine.Size.width newrect = wx.RectPS(position,self.Size) screenrect = Monitor.GetFromRect(newrect).Geometry pos = screenrect.Clamp(newrect).Position if funnle else position self.SetRect(RectPS(pos, self.Size)) self.spine.SetSelection(-1) fadein(self, 'xfast') self.spine.RefreshAll() if not self.spine.HasCapture(): self.spine.CaptureMouse() wx.CallLater(10, self.Refresh) if not isinstance(caller, SimpleMenuSpine): self.TopConnect()