예제 #1
0
    def Notify(self):
        """
            On the trigger time does D&D operations
        """

        current = self.GetFrame(wx.FindWindowAtPointer())

        #Toggles tabbar of the window
        if current and current != self.target:
            if hasattr(self.target, 'notebook'):
                self.target.notebook.tabbar.Toggle(False)
            self.target = current
            if hasattr(self.target, 'notebook'):
                self.target.notebook.tabbar.Toggle(True)
        elif not current:
            if hasattr(self.target, 'notebook'):
                self.target.notebook.tabbar.Toggle(False)
            self.target = current

        #move overlay with mouse
        self.overlay.Move(wx.GetMousePosition() + (2, 4))

        #hides dropmarker if no place to drop
        if (not self.manager.destination
                or not self.manager.destination.tabbar.Rect.Contains(
                    self.manager.destination.ScreenToClient(
                        wx.GetMousePosition()))
            ) and not self.manager.source.tabbar.Rect.Contains(
                self.manager.source.ScreenToClient(wx.GetMousePosition())):
            self.manager.ShowDropMarker()
        #trigers dragand drop stuff if mouse button goes up
        if not wx.LeftDown():
            self.manager.Trigger()
            self.Stop()
예제 #2
0
파일: umenu.py 프로젝트: sgricci/digsby
    def OnPopup(self):
        parentless = self.TopMenu == self.menu

        if parentless:
            # call ReleaseCapture here on windows to prevent the control that
            # spawned this menu from keeping capture--another right click
            # should open a new menu, not the same menu (see #1995)
            if wxMSW:
                ReleaseCapture_win32()

            if self.menu.Windowless:
                if not hasattr(self, 'traytimer'):
                    self.traytimer = UMenuTrayTimer(self)
                self.traytimer.Start(50)

        if not self.menu._parentmenu:
            self._grabkeyboard()

        if wx.LeftDown():
            self._leftbuttondown = True

        if not self.HasCapture():
            self.CaptureMouse()
        self.SetCursor(StockCursor(CURSOR_DEFAULT))
        self.SetFocus()
예제 #3
0
    def Notify(self):
        'If mouse is released, start transaction.'

        if not wx.LeftDown():
            self.Stop()
            nb = self.notebook
            if nb is not None:
                nb.manager.Transaction(nb)
예제 #4
0
    def Notify(self):
        """
            On the trigger time does D&D operations
        """

        if not wx.LeftDown():
            self.Stop()
            self.source.OnDragFinish()
        else:
            self.source.OnDragging()
예제 #5
0
파일: UberBook.py 프로젝트: sgricci/digsby
    def StartWindowDrag(self):
        'Called when the window is moved to prep for merging into another window.'

        if wx.LeftDown():
            global wdt
            if not wdt.IsRunning():
                self.preview = SimpleOverlayImage(self,
                                                  MultiTab(self.tabbar.tabs))
                wdt.Start(self)

            self.manager.ReadyBook(self, wx.GetMousePosition())
예제 #6
0
파일: ubersplit.py 프로젝트: sgricci/digsby
    def __paint(self, e):
        dc2 = wx.PaintDC(self)
        r = self.SplitRect

        if r is None: return e.Skip()

        bg = 'bg'
        if wx.FindWindowAtPointer() is self:
            bg = 'bgactive' if wx.LeftDown() else 'bghover'

        wx.CallAfter(
            lambda: getattr(self, bg).Draw(wx.ClientDC(self), self.SplitRect))
예제 #7
0
    def OnKeyUp(self, event):
        """
        Allow spacebar to emulate mouse up
        """

        if self.native:
            event.Skip()
            self.Refresh()
            return

        if event.KeyCode == wx.WXK_SPACE:
            if self.isdown and not wx.LeftDown(): self.OnLeftUp(event)
        else:
            event.Skip()
예제 #8
0
파일: imhub.py 프로젝트: sgricci/digsby
def create_imwin(convo, meta, sms, focus = None, mode = 'im'):
    '''
    Logic for where to place a new IM tab.

    Spawns a a new ImWin object, placing it as a new tab in _some_ window
    somewhere, and returns the ImWin.
    '''
    thread_check()

    from gui.imwin.imtabs import ImFrame
    f = None

    hooks.notify('imwin.created')

    focus = new_action() == 'stealfocus' if focus is None else focus

    # if tabs are enabled, search for the oldest living ImFrame and place
    # the new message there--unless CTRL is being held down.
    ctrlDown = pref('messaging.tabs.ctrl_new_window', True) and GetKeyState(WXK_CONTROL)

    if not ctrlDown and pref('messaging.tabs.enabled', True):
        for win in GetTopLevelWindows():
            if isinstance(win, ImFrame):
                f = win
                if f.IsActive():
                    focus = False
                break

    # if the focused control is an IM win's input box, don't steal focus.
    if isinstance(focused_top(), ImFrame):
        focus = False

    if getattr(wx.Window.FindFocus(), 'click_raises_imwin', False) and wx.LeftDown():
        focus = True

    # if we haven't found an ImFrame to put the tab in, create a new one
    if f is None:
        if pref('messaging.tabs.enabled', True):
            id = ''
        else:
            id = meta.idstr() if meta is not None else convo.buddy.idstr()
        f = ImFrame(startMinimized = not focus, posId = id)

    w = ImWinPanel(f)

    if convo is not None:
        w.set_conversation(convo, meta)

    if focus:
        global im_show
        im_show += lambda: raise_imwin(f, w)
        im_show += lambda: w.FocusTextCtrl()

    tab = f.AddTab(w, focus = focus)
    # NOTE: the native IM window doesn't use Page objects so we need to check
    # for it before adding to it.
    # FIXME: tab.OnActive seems to always be called by tab.SetActive, and tab.SetActive
    # also calls FocusTextCtrl on its text control, so is this needed still?
    if hasattr(tab, "OnActive"):
        tab.OnActive += w.FocusTextCtrl

    hooks.notify('digsby.statistics.imwin.imwin_created')

    return w