1 """VerySimplePlayer converted to python
3 Jack Jansen, CWI, December 1995
17 # XXXX maxbounds = (40, 40, 1000, 1000)
20 print 'hello world' # XXXX
21 # skip the toolbox initializations, already done
22 # XXXX Should use gestalt here to check for quicktime version
26 fss
, ok
= macfs
.StandardGetFile(QuickTime
.MovieFileType
)
31 bounds
= (175, 75, 175+160, 75+120)
32 theWindow
= Win
.NewCWindow(bounds
, fss
.as_tuple()[2], 0, 0, -1, 1, 0)
33 # XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
37 theMovie
= loadMovie(fss
)
40 bounds
= theMovie
.GetMovieBox()
41 bounds
= 0, 0, bounds
[2]-bounds
[0], bounds
[3]-bounds
[1]
42 theMovie
.SetMovieBox(bounds
)
45 theController
= theMovie
.NewMovieController(bounds
, QuickTime
.mcTopLeftMovie
)
47 # Get movie size and update window parameters
48 rv
, bounds
= theController
.MCGetControllerBoundsRect()
49 theWindow
.SizeWindow(bounds
[2], bounds
[3], 0) # XXXX or [3] [2]?
50 Qt
.AlignWindow(theWindow
, 0)
51 theWindow
.ShowWindow()
53 # XXXX MCDoAction(theController, mcActionSetGrowBoxBounds, &maxBounds)
54 theController
.MCDoAction(QuickTime
.mcActionSetKeysEnabled
, '1')
56 # XXXX MCSetActionFilterWithRefCon(theController, movieControllerEventFilter, (long)theWindow)
60 gotone
, evt
= Evt
.WaitNextEvent(-1, 0)
61 (what
, message
, when
, where
, modifiers
) = evt
62 ## print what, message, when, where, modifiers # XXXX
64 if theController
.MCIsPlayerEvent(evt
):
67 if what
== Events
.mouseDown
:
68 part
, whichWindow
= Win
.FindWindow(where
)
69 if part
== Windows
.inGoAway
:
70 done
= whichWindow
.TrackGoAway(where
)
71 elif part
== Windows
.inDrag
:
72 Qt
.DragAlignedWindow(whichWindow
, where
, (0, 0, 4000, 4000))
73 elif what
== Events
.updateEvt
:
74 whichWindow
= Win
.WhichWindow(message
)
76 # Probably the console window. Print something, hope it helps.
79 Qd
.SetPort(whichWindow
)
80 whichWindow
.BeginUpdate()
81 Qd
.EraseRect(whichWindow
.GetWindowPort().portRect
)
82 whichWindow
.EndUpdate()
84 def loadMovie(theFile
):
85 """Load a movie given an fsspec. Return the movie object"""
86 movieResRef
= Qt
.OpenMovieFile(theFile
, 1)
87 movie
, d1
, d2
= Qt
.NewMovieFromFile(movieResRef
, 0, QuickTime
.newMovieActive
)
90 if __name__
== '__main__':