#NEWLINE# def __init__( self , parent , file = None , source = None , playing = False , x = 0 , y = 0 , z = 0 , width = None , height = None , scale = True , **kw ) : #NEWLINE# #INDENT# self . parent = parent #NEWLINE# self . scale = scale #NEWLINE# if ( file is not None ) : #NEWLINE# #INDENT# source = self . source = media . load ( file , streaming = True ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert ( source is not None ) , 'one of file or source is required' #NEWLINE# #UNINDENT# self . player = media . Player ( ) #NEWLINE# self . player . eos_action = self . player . EOS_PAUSE #NEWLINE# self . player . on_eos = self . on_eos #NEWLINE# if ( not source . video_format ) : #NEWLINE# #INDENT# raise ValueError ( "Movie file doesn't contain video" ) #NEWLINE# #UNINDENT# video_format = source . video_format #NEWLINE# if ( width is None ) : #NEWLINE# #INDENT# width = video_format . width #NEWLINE# if ( video_format . sample_aspect > 1 ) : #NEWLINE# #INDENT# width *= video_format . sample_aspect #NEWLINE# #UNINDENT# #UNINDENT# if ( c is None ) : #NEWLINE# #INDENT# height = video_format . height #NEWLINE# if ( video_format . sample_aspect < 1 ) : #NEWLINE# #INDENT# height /= video_format . sample_aspect #NEWLINE# #UNINDENT# #UNINDENT# super ( Movie , self ) . __init__ ( parent , x , y , z , width , height , ** kw ) #NEWLINE# c = self . control = Frame ( self , bgcolor = ( 1 , 1 , 1 , 0.5 ) , is_visible = False , width = '100%' , height = 64 ) #NEWLINE# f = Frame ( c , is_transparent = True , width = '100%' , height = '100%' ) #NEWLINE# f . layout = layouts . Horizontal ( f , valign = 'center' , halign = 'center' , padding = 10 ) #NEWLINE# c . play = Image ( f , data . load_gui_image ( 'media-play.png' ) , classes = ( '-play-button' , ) , is_visible = ( not playing ) ) #NEWLINE# c . pause = Image ( f , data . load_gui_image ( 'media-pause.png' ) , bgcolor = None , classes = ( '-pause-button' , ) , is_visible = playing ) #NEWLINE# fi = Frame ( f , is_transparent = True ) #NEWLINE# c . range = Image ( fi , data . load_gui_image ( 'media-range.png' ) ) #NEWLINE# im = data . load_gui_image ( 'media-position.png' ) #NEWLINE# c . position = Image ( fi , im , x = 0 , y = ( - 2 ) , classes = ( '-position' , ) ) #NEWLINE# c . time = Label ( f , '00:00' , font_size = 20 ) #NEWLINE# c . anim = None #NEWLINE# self . player . queue ( source ) #NEWLINE# clock . schedule ( self . update ) #NEWLINE# self . playing = False #NEWLINE# if playing : #NEWLINE# #INDENT# self . play ( )