[Python-checkins] python/dist/src/Mac/Demo/quicktime
MovieInWindow.py, 1.8, 1.9 VerySimplePlayer.py, 1.7, 1.8
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Sun Jul 18 07:58:38 CEST 2004
Update of /cvsroot/python/python/dist/src/Mac/Demo/quicktime
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29056/Demo/quicktime
Modified Files:
MovieInWindow.py VerySimplePlayer.py
Log Message:
Whitespace normalization, via reindent.py.
Index: MovieInWindow.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Demo/quicktime/MovieInWindow.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** MovieInWindow.py 26 Mar 2003 14:36:25 -0000 1.8
--- MovieInWindow.py 18 Jul 2004 05:58:05 -0000 1.9
***************
*** 19,71 ****
def main():
! # skip the toolbox initializations, already done
! # XXXX Should use gestalt here to check for quicktime version
! Qt.EnterMovies()
!
! # Get the movie file
! if len(sys.argv) > 1:
! filename = sys.argv[1]
! else:
! filename = EasyDialogs.AskFileForOpen() # Was: QuickTime.MovieFileType
! if not filename:
! sys.exit(0)
!
! # Open the window
! bounds = (175, 75, 175+160, 75+120)
! theWindow = Win.NewCWindow(bounds, os.path.split(filename)[1], 1, 0, -1, 0, 0)
! Qd.SetPort(theWindow)
! # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
!
! playMovieInWindow(theWindow, filename, theWindow.GetWindowPort().GetPortBounds())
!
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)
!
def loadMovie(theFile):
! """Load a movie given an fsspec. Return the movie object"""
! movieResRef = Qt.OpenMovieFile(theFile, 1)
! movie, d1, d2 = Qt.NewMovieFromFile(movieResRef, 0, QuickTime.newMovieActive)
! return movie
!
if __name__ == '__main__':
! main()
!
--- 19,70 ----
def main():
! # skip the toolbox initializations, already done
! # XXXX Should use gestalt here to check for quicktime version
! Qt.EnterMovies()
!
! # Get the movie file
! if len(sys.argv) > 1:
! filename = sys.argv[1]
! else:
! filename = EasyDialogs.AskFileForOpen() # Was: QuickTime.MovieFileType
! if not filename:
! sys.exit(0)
!
! # Open the window
! bounds = (175, 75, 175+160, 75+120)
! theWindow = Win.NewCWindow(bounds, os.path.split(filename)[1], 1, 0, -1, 0, 0)
! Qd.SetPort(theWindow)
! # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
!
! playMovieInWindow(theWindow, filename, theWindow.GetWindowPort().GetPortBounds())
!
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)
!
def loadMovie(theFile):
! """Load a movie given an fsspec. Return the movie object"""
! movieResRef = Qt.OpenMovieFile(theFile, 1)
! movie, d1, d2 = Qt.NewMovieFromFile(movieResRef, 0, QuickTime.newMovieActive)
! return movie
!
if __name__ == '__main__':
! main()
Index: VerySimplePlayer.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Demo/quicktime/VerySimplePlayer.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** VerySimplePlayer.py 26 Jan 2003 21:36:06 -0000 1.7
--- VerySimplePlayer.py 18 Jul 2004 05:58:05 -0000 1.8
***************
*** 19,93 ****
def main():
! print 'hello world' # XXXX
! # skip the toolbox initializations, already done
! # XXXX Should use gestalt here to check for quicktime version
! Qt.EnterMovies()
!
! # Get the movie file
! fss = EasyDialogs.AskFileForOpen(wanted=File.FSSpec) # Was: QuickTime.MovieFileType
! if not fss:
! sys.exit(0)
!
! # Open the window
! bounds = (175, 75, 175+160, 75+120)
! theWindow = Win.NewCWindow(bounds, fss.as_tuple()[2], 0, 0, -1, 1, 0)
! # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
! Qd.SetPort(theWindow)
!
! # Get the movie
! theMovie = loadMovie(fss)
!
! # Relocate to (0, 0)
! bounds = theMovie.GetMovieBox()
! bounds = 0, 0, bounds[2]-bounds[0], bounds[3]-bounds[1]
! theMovie.SetMovieBox(bounds)
!
! # Create a controller
! theController = theMovie.NewMovieController(bounds, QuickTime.mcTopLeftMovie)
!
! # Get movie size and update window parameters
! rv, bounds = theController.MCGetControllerBoundsRect()
! theWindow.SizeWindow(bounds[2], bounds[3], 0) # XXXX or [3] [2]?
! Qt.AlignWindow(theWindow, 0)
! theWindow.ShowWindow()
!
! # XXXX MCDoAction(theController, mcActionSetGrowBoxBounds, &maxBounds)
! theController.MCDoAction(QuickTime.mcActionSetKeysEnabled, '1')
!
! # XXXX MCSetActionFilterWithRefCon(theController, movieControllerEventFilter, (long)theWindow)
!
! done = 0
! while not done:
! gotone, evt = Evt.WaitNextEvent(0xffff, 0)
! (what, message, when, where, modifiers) = evt
! ## print what, message, when, where, modifiers # XXXX
!
! if theController.MCIsPlayerEvent(evt):
! continue
!
! if what == Events.mouseDown:
! part, whichWindow = Win.FindWindow(where)
! if part == Windows.inGoAway:
! done = whichWindow.TrackGoAway(where)
! elif part == Windows.inDrag:
! Qt.DragAlignedWindow(whichWindow, where, (0, 0, 4000, 4000))
! elif what == Events.updateEvt:
! whichWindow = Win.WhichWindow(message)
! if not whichWindow:
! # Probably the console window. Print something, hope it helps.
! print 'update'
! else:
! Qd.SetPort(whichWindow)
! whichWindow.BeginUpdate()
! Qd.EraseRect(whichWindow.GetWindowPort().GetPortBounds())
! whichWindow.EndUpdate()
!
def loadMovie(theFile):
! """Load a movie given an fsspec. Return the movie object"""
! movieResRef = Qt.OpenMovieFile(theFile, 1)
! movie, d1, d2 = Qt.NewMovieFromFile(movieResRef, 0, QuickTime.newMovieActive)
! return movie
!
if __name__ == '__main__':
! main()
!
--- 19,92 ----
def main():
! print 'hello world' # XXXX
! # skip the toolbox initializations, already done
! # XXXX Should use gestalt here to check for quicktime version
! Qt.EnterMovies()
!
! # Get the movie file
! fss = EasyDialogs.AskFileForOpen(wanted=File.FSSpec) # Was: QuickTime.MovieFileType
! if not fss:
! sys.exit(0)
!
! # Open the window
! bounds = (175, 75, 175+160, 75+120)
! theWindow = Win.NewCWindow(bounds, fss.as_tuple()[2], 0, 0, -1, 1, 0)
! # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
! Qd.SetPort(theWindow)
!
! # Get the movie
! theMovie = loadMovie(fss)
!
! # Relocate to (0, 0)
! bounds = theMovie.GetMovieBox()
! bounds = 0, 0, bounds[2]-bounds[0], bounds[3]-bounds[1]
! theMovie.SetMovieBox(bounds)
!
! # Create a controller
! theController = theMovie.NewMovieController(bounds, QuickTime.mcTopLeftMovie)
!
! # Get movie size and update window parameters
! rv, bounds = theController.MCGetControllerBoundsRect()
! theWindow.SizeWindow(bounds[2], bounds[3], 0) # XXXX or [3] [2]?
! Qt.AlignWindow(theWindow, 0)
! theWindow.ShowWindow()
!
! # XXXX MCDoAction(theController, mcActionSetGrowBoxBounds, &maxBounds)
! theController.MCDoAction(QuickTime.mcActionSetKeysEnabled, '1')
!
! # XXXX MCSetActionFilterWithRefCon(theController, movieControllerEventFilter, (long)theWindow)
!
! done = 0
! while not done:
! gotone, evt = Evt.WaitNextEvent(0xffff, 0)
! (what, message, when, where, modifiers) = evt
! ## print what, message, when, where, modifiers # XXXX
!
! if theController.MCIsPlayerEvent(evt):
! continue
!
! if what == Events.mouseDown:
! part, whichWindow = Win.FindWindow(where)
! if part == Windows.inGoAway:
! done = whichWindow.TrackGoAway(where)
! elif part == Windows.inDrag:
! Qt.DragAlignedWindow(whichWindow, where, (0, 0, 4000, 4000))
! elif what == Events.updateEvt:
! whichWindow = Win.WhichWindow(message)
! if not whichWindow:
! # Probably the console window. Print something, hope it helps.
! print 'update'
! else:
! Qd.SetPort(whichWindow)
! whichWindow.BeginUpdate()
! Qd.EraseRect(whichWindow.GetWindowPort().GetPortBounds())
! whichWindow.EndUpdate()
!
def loadMovie(theFile):
! """Load a movie given an fsspec. Return the movie object"""
! movieResRef = Qt.OpenMovieFile(theFile, 1)
! movie, d1, d2 = Qt.NewMovieFromFile(movieResRef, 0, QuickTime.newMovieActive)
! return movie
!
if __name__ == '__main__':
! main()
More information about the Python-checkins
mailing list