Esempio n. 1
0
 def idle(self, *args):
     self.SetPort()
     point = Evt.GetMouse()
     widget = self.findwidget(point, 0)
     if self._bindings.has_key("<idle>"):
         callback = self._bindings["<idle>"]
         if callback():
             return
     if self._currentwidget is not None and hasattr(self._currentwidget,
                                                    "idle"):
         if self._currentwidget._bindings.has_key("<idle>"):
             callback = self._currentwidget._bindings["<idle>"]
             if callback():
                 return
         if self._currentwidget.idle():
             return
     if widget is not None and hasattr(widget, "rollover"):
         if 1:  #self._lastrollover <> widget:
             if self._lastrollover:
                 self._lastrollover.rollover(point, 0)
             self._lastrollover = widget
             self._lastrollover.rollover(point, 1)
     else:
         if self._lastrollover:
             self._lastrollover.rollover(point, 0)
         self._lastrollover = None
         Wbase.SetCursor("arrow")
Esempio n. 2
0
        l, t, r, b = self._bounds
        bounds = l, t, r, b = l + 1, t + 1, r - 16, b - 1
        abscol = l + self.col
        mincol = l + self.mincol
        maxcol = r - 10
        diff = abscol - x
        Qd.PenPat('\000\377\000\377\000\377\000\377')
        Qd.PenMode(QuickDraw.srcXor)
        rect = abscol - 1, t, abscol, b
        Qd.PaintRect(rect)
        lastpoint = (x, y)
        newcol = -1
        #W.SetCursor('fist')
        while Evt.Button():
            Evt.WaitNextEvent(0, 1, None)  # needed for OSX
            (x, y) = Evt.GetMouse()
            if (x, y) <> lastpoint:
                newcol = x + diff
                newcol = max(newcol, mincol)
                newcol = min(newcol, maxcol)
                Qd.PaintRect(rect)
                rect = newcol - 1, t, newcol, b
                Qd.PaintRect(rect)
                lastpoint = (x, y)
        Qd.PaintRect(rect)
        Qd.PenPat(Qd.GetQDGlobalsBlack())
        Qd.PenNormal()
        if newcol > 0 and newcol <> abscol:
            self.setcolumn(newcol - l)

    def click(self, point, modifiers):
Esempio n. 3
0
 if lurf == 4:
     # Adapt pinning rectangle for middle lurf
     # XXXX This is wrong
     rx0, ry0, rx1, ry1 = self.ourrect
     ##             w = (rx1-rx0)/2
     ##             h = (ry1-ry0)/2
     ##             x0 = x0 + w
     ##             x1 = x1 - w
     ##             y0 = y0 + h
     ##             y1 = y1 - h
     x0 = x - (rx0 - x0)
     x1 = x + (x1 - rx1)
     y0 = y - (ry0 - y0)
     y1 = y + (y1 - ry1)
 while Evt.WaitMouseUp():
     newx, newy = Evt.GetMouse()
     # Pin the mouse to our rectangle
     if newx < x0: newx = x0
     if newx > x1: newx = x1
     if newy < y0: newy = y0
     if newy > y1: newy = y1
     deltax = newx - x
     deltay = newy - y
     x = newx
     y = newy
     if deltax or deltay:
         # Something has changed. Recompute and redraw
         self.drawourrect()
         rx0, ry0, rx1, ry1 = self.ourrect
         if lurf in (0, 3, 4, 6):
             rx0 = rx0 + deltax
Esempio n. 4
0
    def click(self, point, modifiers):
        # what a mess...
        orgmouse = point[self._direction]
        halfgutter = self._gutter / 2
        l, t, r, b = self._bounds
        if self._direction:
            begin, end = t, b
        else:
            begin, end = l, r

        i = self.findgutter(orgmouse, begin, end)
        if i is None:
            return

        pos = orgpos = begin + (end - begin) * self._gutters[
            i]  # init pos too, for fast click on border, bug done by Petr

        minpos = self._panesizes[i][0]
        maxpos = self._panesizes[i + 1][1]
        minpos = begin + (end - begin) * minpos + 64
        maxpos = begin + (end - begin) * maxpos - 64
        if minpos > orgpos and maxpos < orgpos:
            return

        #SetCursor("fist")
        self.SetPort()
        if self._direction:
            rect = l, orgpos - 1, r, orgpos
        else:
            rect = orgpos - 1, t, orgpos, b

        # track mouse --- XXX  move to separate method?
        Qd.PenMode(QuickDraw.srcXor)
        Qd.PenPat(Qd.GetQDGlobalsGray())
        Qd.PaintRect(_intRect(rect))
        lastpos = None
        while Evt.Button():
            pos = orgpos - orgmouse + Evt.GetMouse()[self._direction]
            pos = max(pos, minpos)
            pos = min(pos, maxpos)
            if pos == lastpos:
                continue
            Qd.PenPat(Qd.GetQDGlobalsGray())
            Qd.PaintRect(_intRect(rect))
            if self._direction:
                rect = l, pos - 1, r, pos
            else:
                rect = pos - 1, t, pos, b
            Qd.PenPat(Qd.GetQDGlobalsGray())
            Qd.PaintRect(_intRect(rect))
            lastpos = pos
            self._parentwindow.wid.GetWindowPort().QDFlushPortBuffer(None)
            Evt.WaitNextEvent(0, 3)
        Qd.PaintRect(_intRect(rect))
        Qd.PenNormal()
        SetCursor("watch")

        newpos = (pos - begin) / float(end - begin)
        self._gutters[i] = newpos
        self._panesizes[i] = self._panesizes[i][0], newpos
        self._panesizes[i + 1] = newpos, self._panesizes[i + 1][1]
        self.makepanebounds()
        self.installbounds()
        self._calcbounds()