コード例 #1
0
def playMovieInWindow(theWindow, theFile, movieBox):
    """Play a movie in a window"""
    # XXXX Needed?  SetGWorld((CGrafPtr)theWindow, nil);

    # Get the movie
    theMovie = loadMovie(theFile)

    # Set where we want it
    theMovie.SetMovieBox(movieBox)

    # Start at the beginning
    theMovie.GoToBeginningOfMovie()

    # Give a little time to preroll
    theMovie.MoviesTask(0)

    # Start playing
    theMovie.StartMovie()

    while not theMovie.IsMovieDone() and not Evt.Button():
        theMovie.MoviesTask(0)
コード例 #2
0
ファイル: PyBrowser.py プロジェクト: mmrvka/xbmc
 from Carbon import Qd, QuickDraw, Evt
 self.SetPort()
 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)
コード例 #3
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()
コード例 #4
0
ファイル: MovieInWindow.py プロジェクト: mcyril/ravel-ftn
"""MovieInWindow converted to python