mirror of
https://github.com/python/cpython.git
synced 2025-11-27 13:45:25 +00:00
Modified to accept a command line argument too.
This commit is contained in:
parent
97951de77c
commit
a154262e44
1 changed files with 8 additions and 4 deletions
|
|
@ -14,6 +14,7 @@ from Carbon import Windows
|
||||||
from Carbon import File
|
from Carbon import File
|
||||||
import EasyDialogs
|
import EasyDialogs
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -22,17 +23,20 @@ def main():
|
||||||
Qt.EnterMovies()
|
Qt.EnterMovies()
|
||||||
|
|
||||||
# Get the movie file
|
# Get the movie file
|
||||||
fss = EasyDialogs.AskFileForOpen(wanted=File.FSSpec) # Was: QuickTime.MovieFileType
|
if len(sys.argv) > 1:
|
||||||
if not fss:
|
filename = sys.argv[1]
|
||||||
|
else:
|
||||||
|
filename = EasyDialogs.AskFileForOpen() # Was: QuickTime.MovieFileType
|
||||||
|
if not filename:
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# Open the window
|
# Open the window
|
||||||
bounds = (175, 75, 175+160, 75+120)
|
bounds = (175, 75, 175+160, 75+120)
|
||||||
theWindow = Win.NewCWindow(bounds, fss.as_tuple()[2], 1, 0, -1, 0, 0)
|
theWindow = Win.NewCWindow(bounds, os.path.split(filename)[1], 1, 0, -1, 0, 0)
|
||||||
Qd.SetPort(theWindow)
|
Qd.SetPort(theWindow)
|
||||||
# XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
|
# XXXX Needed? SetGWorld((CGrafPtr)theWindow, nil)
|
||||||
|
|
||||||
playMovieInWindow(theWindow, fss, theWindow.GetWindowPort().GetPortBounds())
|
playMovieInWindow(theWindow, filename, theWindow.GetWindowPort().GetPortBounds())
|
||||||
|
|
||||||
def playMovieInWindow(theWindow, theFile, movieBox):
|
def playMovieInWindow(theWindow, theFile, movieBox):
|
||||||
"""Play a movie in a window"""
|
"""Play a movie in a window"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue