def play_movie(self, movie_file, movie_type): """play given movie file once, then exit""" if gst_media_imported: try: self.drwVideo = gst_media.VideoWidget() self.video_enabled = True except: self.video_enabled = False self.WinMain.log_msg( 'Warning: ScrSaver: Failed to create Video gstreamer objects', '0') if self.video_enabled: self.video_player = gst_media.GstVideo(self.drwVideo) self.video_player.set_volume(self.WinMain.movievol) self.WinMain.stop_video() self.running = False if movie_type in ('intro', 'exit'): if self.WinMain.music_enabled: self.WinMain.gstMusic.stop() self.movie_type = movie_type self.WinMain.show_window('scrsaver') try: self.video_player.set_volume( self.WinMain.wahcade_ini.getint('movie_volume')) except: self.WinMain.log_msg( 'Warning: ScrSaver: Problem setting movie volume, system has muted as exception', '0') self.video_player.set_volume(0) #play new vid self.video_player.play(movie_file) self.video_playing = True
def __init__(self, WinMain): """init screen saver window""" global gst_media_imported #set main window self.WinMain = WinMain #build the window self.winScrSaver = gtk.Fixed() self.winScrSaver.set_has_window(True) #self.drwVideo = gtk.DrawingArea() self.imgArtwork1 = gtk.Image() self.imgArtwork2 = gtk.Image() self.imgArtwork3 = gtk.Image() self.imgArtwork4 = gtk.Image() self.imgArtwork5 = gtk.Image() self.imgArtwork6 = gtk.Image() self.imgArtwork7 = gtk.Image() self.imgArtwork8 = gtk.Image() self.imgArtwork9 = gtk.Image() self.imgArtwork10 = gtk.Image() self.lblGameDescription = gtk.Label() self.lblMP3Name = gtk.Label() self.winScrSaver.show() WinMain.fixd.add(self.winScrSaver) self.lblGameDescription.show() self.lblMP3Name.show() self._main_images = [ self.imgArtwork1, self.imgArtwork2, self.imgArtwork3, self.imgArtwork4, self.imgArtwork5, self.imgArtwork6, self.imgArtwork7, self.imgArtwork8, self.imgArtwork9, self.imgArtwork10 ] for widget in self._main_images: self.winScrSaver.add(widget) #video widget self.video_enabled = False self.video_playing = False if gst_media_imported: try: self.drwVideo = gst_media.VideoWidget() self.video_player = gst_media.GstVideo(self.drwVideo) self.video_player.set_volume(self.WinMain.movievol) self.video_enabled = True except: #gstreamer object creation failed self.video_enabled = False self.video_player.set_volume(0) self.WinMain.log_msg( 'Warning: ScrSaver: Failed to create Video gstreamer objects', '0') if not self.video_enabled: self.drwVideo = gtk.Image() self.video_player = None self.WinMain.log_msg( 'Warning: ScrSaver: video objects not created, reverting to images', '0') #self.drwVideo.connect_after('realize', self.on_drwVideo_realize) self.drwVideo.show() self.winScrSaver.put(self.drwVideo, 0, 0) self.winScrSaver.add(self.lblGameDescription) self.winScrSaver.add(self.lblMP3Name) self.drwVideo.set_property('visible', False) #interval self.slide_duration = 10 self.scr_timer_id = None self.running = False self.movie_type = '' #currently selected screen saver image / movie self.game_idx = 0