def play(self,end_callback,show_ready_callback,parent_kickback_signal,level,controls_list): """ starts the hyperlink show at start-track end_callback - function to be called when the show exits show_ready_callback - callback to get the previous track level is 0 when the show is top level (run from [start] or from show control) parent_kickback_signal - not used other than it being passed to a show """ # need to instantiate the medialist here as in gapshow done in derived class self.medialist=MediaList('ordered') Show.base_play(self,end_callback,show_ready_callback, parent_kickback_signal,level,controls_list) self.mon.trace(self,self.show_params['show-ref']) #parse the show and track timeouts reason,message,self.show_timeout=Show.calculate_duration(self,self.show_params['show-timeout']) if reason =='error': self.mon.err(self,'Show Timeout has bad time: '+self.show_params['show-timeout']) self.end('error','show timeout, bad time: '+self.show_params['show-timeout']) reason,message,self.track_timeout=Show.calculate_duration(self,self.show_params['track-timeout']) if reason=='error': self.mon.err(self,'Track Timeout has bad time: '+self.show_params['track-timeout']) self.end('error','track timeout, bad time: '+self.show_params['track-timeout']) # and delete eggtimer if self.previous_shower is not None: self.previous_shower.delete_eggtimer() self.do_first_track()
def play(self, end_callback, ready_callback=None, top=False, command='nil'): """ displays the mediashow end_callback - function to be called when the menu exits ready_callback - callback when menu is ready to display (not used) top is True when the show is top level (run from [start]) """ #instantiate the arguments self._end_callback = end_callback self._ready_callback = ready_callback self.top = top self.command = command self.mon.log(self, "Starting show: " + self.show['show-ref']) # check data files are available. self.media_file = self.pp_profile + "/" + self.show['medialist'] if not os.path.exists(self.media_file): self.mon.err(self, "Medialist file not found: " + self.media_file) self._end('error', "Medialist file not found") #create a medialist for the mediashow and read it. self.medialist = MediaList() if self.medialist.open_list(self.media_file, self.showlist.sissue()) == False: self.mon.err(self, "Version of medialist different to Pi Presents") self._end('error', "Version of medialist different to Pi Presents") self._wait_for_trigger()
def play(self,end_callback,ready_callback=None,top=False,command='nil'): """ displays the menu end_callback - function to be called when the menu exits ready_callback - callback when menu is ready to display (not used) top is True when the show is top level (run from [start]) """ #instantiate arguments self.end_callback=end_callback self.ready_callback=ready_callback self.top=top self.command=command # check data files are available. self.menu_file = self.pp_profile + "/" + self.show['medialist'] if not os.path.exists(self.menu_file): self.mon.err(self,"Medialist file not found: "+ self.menu_file) self._end('error',"Medialist file not found") #create a medialist for the menu and read it. self.medialist=MediaList() if self.medialist.open_list(self.menu_file,self.showlist.sissue()) == False: self.mon.err(self,"Version of medialist different to Pi Presents") self._end('error',"Version of medialist different to Pi Presents") if self.show['has-background']=="yes": background_index=self.medialist.index_of_track ('pp-menu-background') if background_index>=0: self.menu_img_file = self.complete_path(self.medialist.track(background_index)) if not os.path.exists(self.menu_img_file): self.mon.err(self,"Menu background file not found: "+ self.menu_img_file) self._end('error',"Menu background file not found") else: self.mon.err(self,"Menu background not found in medialist") self._end('error',"Menu background not found") #start timeout alarm if required if int(self.show['timeout'])<>0: self.menu_timeout_running=self.canvas.after(int(self.show['timeout'])*1000,self._timeout_menu) if self.ready_callback<>None: self.ready_callback() self.canvas.delete(ALL) # display background image if self.show['has-background']=="yes": self._display_background() #display the list of video titles self._display_video_titles() # display instructions (hint) self.canvas.create_text(int(self.canvas['width'])/2, int(self.canvas['height']) - int(self.show['hint-y']), text=self.show['hint-text'], fill=self.show['hint-colour'], font=self.show['hint-font']) self.canvas.update( )
def play(self,show_id,end_callback,show_ready_callback, top=False,command='nil'): """ displays the mediashow end_callback - function to be called when the menu exits ready_callback - callback when menu is ready to display (not used) top is True when the show is top level (run from [start]) """ #instantiate the arguments self.show_id=show_id self.end_callback=end_callback self.show_ready_callback=show_ready_callback self.top=top self.command=command self.mon.log(self,self.show_params['show-ref']+ ' '+ str(self.show_id)+ ": Starting show") # check data files are available. self.media_file = self.pp_profile + "/" + self.show_params['medialist'] if not os.path.exists(self.media_file): self.mon.err(self,"Medialist file not found: "+ self.media_file) self.end('error',"Medialist file not found") #create a medialist for the mediashow and read it. self.medialist=MediaList() if self.medialist.open_list(self.media_file,self.showlist.sissue())==False: self.mon.err(self,"Version of medialist different to Pi Presents") self.end('error',"Version of medialist different to Pi Presents") #get controls for this show if top level controlsmanager=ControlsManager() if self.top==True: self.controls_list=controlsmanager.default_controls() # and merge in controls from profile self.controls_list=controlsmanager.merge_show_controls(self.controls_list,self.show_params['controls']) #set up the time of day triggers for the show if self.show_params['trigger']in('time','time-quiet'): error_text=self.tod.add_times(self.show_params['trigger-input'],id(self),self.tod_start_callback,self.show_params['trigger']) if error_text<>'': self.mon.err(self,error_text) self.end('error',error_text) if self.show_params['trigger-end']=='time': # print self.show_params['trigger-end-time'] error_text=self.tod.add_times(self.show_params['trigger-end-time'],id(self),self.tod_end_callback,'n/a') if error_text<>'': self.mon.err(self,error_text) self.end('error',error_text) if self.show_params['trigger-end']=='duration': error_text=self.calculate_duration(self.show_params['trigger-end-time']) if error_text<>'': self.mon.err(self,error_text) self.end('error',error_text) self.state='closed' self.egg_timer=None self.wait_for_trigger()
def play(self, end_callback, show_ready_callback, direction_command, level, controls_list): # use the appropriate medialist self.medialist = MediaList(self.show_params['sequence']) ArtShow.play(self, end_callback, show_ready_callback, direction_command, level, controls_list)
def select_medialist(self,event): """ user clicks on a medialst in a profile so try and select it. """ # needs forgiving int for possible tkinter upgrade if len(self.medialists)>0: self.current_medialists_index=int(event.widget.curselection()[0]) self.current_medialist=MediaList('ordered') if not self.current_medialist.open_list(self.pp_profile_dir+ os.sep + self.medialists[self.current_medialists_index],self.current_showlist.sissue()): self.mon.err(self,"medialist is a different version to showlist: "+ self.medialists[self.current_medialists_index]) self.app_exit() self.refresh_tracks_display() self.refresh_medialists_display()
def play(self, end_callback, ready_callback=None, top=False, command='nil'): """ displays the liveshow end_callback - function to be called when the liveshow exits ready_callback - callback when liveshow is ready to display top is True when the show is top level (i.e. run from start show) """ #instantiate the arguments self._end_callback = end_callback self._ready_callback = ready_callback self.top = top self.mon.log(self, "Starting show: " + self.show['show-ref']) # check data files are available. self.media_file = self.pp_profile + os.sep + self.show['medialist'] if not os.path.exists(self.media_file): self.mon.err(self, "Medialist file not found: " + self.media_file) self._stop("Medialist file not found") self.options = command_options() self._pp_live_dir1 = self.pp_home + os.sep + 'pp_live_tracks' if not os.path.exists(self._pp_live_dir1): os.mkdir(self._pp_live_dir1) self._pp_live_dir2 = '' if self.options['liveshow'] <> "": self._pp_live_dir2 = self.options['liveshow'] if not os.path.exists(self._pp_live_dir2): self.mon.err( self, "live tracks directory not found " + self._pp_live_dir2) self._end('error', "live tracks directory not found") #create a medialist for the liveshow and read it. # it should be empty of anonymous tracks but read it to check its version. self.medialist = MediaList() if self.medialist.open_list(self.media_file, self.showlist.sissue()) == False: self.mon.err(self, "Version of medialist different to Pi Presents") self._end('error', "Version of medialist different to Pi Presents") if self.ready_callback <> None: self.ready_callback() self._play_first_track()
def play(self, end_callback, show_ready_callback, parent_kickback_signal, level, controls_list): """ starts the hyperlink show at start-track end_callback - function to be called when the show exits show_ready_callback - callback to get previous show and track level is 0 when the show is top level (run from [start] or from show control) parent_kickback_signal is not used passed to subshow by base class as parent_kickback_signal """ # need to instantiate the medialist here as in gapshow done in derived class self.medialist = MediaList('ordered') Show.base_play(self, end_callback, show_ready_callback, parent_kickback_signal, level, controls_list) #dummy as it gets passed down to subshow, however it isn't actuallly used. self.controls_list = [] self.mon.trace(self, self.show_params['show-ref']) # read show destinations self.first_track_ref = self.show_params['first-track-ref'] self.home_track_ref = self.show_params['home-track-ref'] self.timeout_track_ref = self.show_params['timeout-track-ref'] #parse the show and track timeouts reason, message, self.show_timeout = Show.calculate_duration( self, self.show_params['show-timeout']) if reason == 'error': self.mon.err( self, 'Show Timeout has bad time: ' + self.show_params['show-timeout']) self.end( 'error', 'show timeout, bad time: ' + self.show_params['show-timeout']) reason, message, self.track_timeout = Show.calculate_duration( self, self.show_params['track-timeout']) if reason == 'error': self.mon.err( self, 'Track Timeout has bad time: ' + self.show_params['track-timeout']) self.end( 'error', 'track timeout, bad time: ' + self.show_params['track-timeout']) # and delete eggtimer if self.previous_shower is not None: self.previous_shower.delete_eggtimer() self.do_first_track()
def medialist_selected(self,key): """ user clicks on a medialst in a profile so try and select it. """ # print 'selected',type(self.medialists_display.get_key()),self.medialists_display.get_key() if len(self.medialists)>0: self.current_medialists_index=self.medialists_display.get_key() self.current_medialist=MediaList('ordered') if not self.current_medialist.open_list(self.pp_profile_dir+ os.sep + self.medialists[self.current_medialists_index],self.current_showlist.sissue()): OKDialog(self,"medialist is a different version to showlist: "+ self.medialists[self.current_medialists_index]).show(self) #self.app_exit() return self.refresh_tracks_display() self.refresh_medialists_display()
def play(self, end_callback, show_ready_callback, parent_kickback_signal, level, controls_list): # use the appropriate medialist self.medialist = MediaList(self.show_params['sequence']) self.mon.newline(3) self.mon.trace(self, self.show_params['show-ref']) Show.base_play(self, end_callback, show_ready_callback, parent_kickback_signal, level, controls_list) # unpack show parameters reason, message, self.show_timeout = Show.calculate_duration( self, self.show_params['show-timeout']) if reason == 'error': self.mon.err( self, 'ShowTimeout has bad time: ' + self.show_params['show-timeout']) self.end( 'error', 'ShowTimeout has bad time: ' + self.show_params['show-timeout']) self.track_count_limit = int(self.show_params['track-count-limit']) reason, message, self.interval = Show.calculate_duration( self, self.show_params['interval']) if reason == 'error': self.mon.err( self, 'Interval has bad time: ' + self.show_params['interval']) self.end('error', 'Interval has bad time: ' + self.show_params['interval']) # delete eggtimer started by the parent if self.previous_shower is not None: self.previous_shower.delete_eggtimer() self.start_show()
def play(self, show_id, end_callback, ready_callback, top=False, command='nil'): """ starts the hyperlink show at start-track end_callback - function to be called when the show exits ready_callback - callback when event-show is ready to display its forst track (not used?) top is True when the show is top level (run from [start] or from show control) command is not used """ #instantiate arguments self.show_id = show_id self.end_callback = end_callback self.ready_callback = ready_callback self.top = top self.command = command # check data files are available. self.medialist_file = self.pp_profile + "/" + self.show_params[ 'medialist'] if not os.path.exists(self.medialist_file): self.mon.err(self, "Medialist file not found: " + self.medialist_file) self.end('error', "Medialist file not found") #create a medialist object for the hyperlinkshow and read the file into it. self.medialist = MediaList() if self.medialist.open_list(self.medialist_file, self.showlist.sissue()) == False: self.mon.err(self, "Version of medialist different to Pi Presents") self.end('error', "Version of medialist different to Pi Presents") #get controls for this show if top level controlsmanager = ControlsManager() if self.top == True: self.controls_list = controlsmanager.default_controls() # and merge in controls from profile self.controls_list = controlsmanager.merge_show_controls( self.controls_list, self.show_params['controls']) # read show links and destinations self.first_track_ref = self.show_params['first-track-ref'] self.home_track_ref = self.show_params['home-track-ref'] self.timeout_track_ref = self.show_params['timeout-track-ref'] # state variables and signals self.end_hyperlinkshow_signal = False self.egg_timer = None self.next_track_signal = False self.next_track_ref = '' self.current_track_ref = '' self.current_track_type = '' # ready callback for show if self.ready_callback <> None: self.ready_callback() self.canvas.delete('pp-content') self.canvas.config(bg='black') self.do_first_track()
def play(self, show_id, end_callback, ready_callback, top=False, command='nil'): #instantiate the arguments self.show_id = show_id self.end_callback = end_callback self.ready_callback = ready_callback self.top = top self.mon.log(self, "Starting show: " + self.show_params['show-ref']) # check data files are available. self.media_file = self.pp_profile + os.sep + self.show_params[ 'medialist'] if not os.path.exists(self.media_file): self.mon.err(self, "Medialist file not found: " + self.media_file) self.end_liveshow_signal = True self.options = command_options() self.pp_live_dir1 = self.pp_home + os.sep + 'pp_live_tracks' if not os.path.exists(self.pp_live_dir1): os.mkdir(self.pp_live_dir1) self.pp_live_dir2 = '' if self.options['liveshow'] <> "": self.pp_live_dir2 = self.options['liveshow'] if not os.path.exists(self.pp_live_dir2): self.mon.err( self, "live tracks directory not found " + self.pp_live_dir2) self.end('error', "live tracks directory not found") #create a medialist for the liveshow and read it. # it should be empty of anonymous tracks but read it to check its version. self.medialist = MediaList() if self.medialist.open_list(self.media_file, self.showlist.sissue()) == False: self.mon.err(self, "Version of medialist different to Pi Presents") self.end('error', "Version of medialist different to Pi Presents") #get control bindings for this show if top level controlsmanager = ControlsManager() if self.top == True: self.controls_list = controlsmanager.default_controls() # and merge in controls from profile self.controls_list = controlsmanager.merge_show_controls( self.controls_list, self.show_params['controls']) #set up the time of day triggers for the show if self.show_params['trigger-start'] in ('time', 'time-quiet'): error_text = self.tod.add_times( self.show_params['trigger-start-time'], id(self), self.tod_start_callback, self.show_params['trigger-start']) if error_text <> '': self.mon.err(self, error_text) self.end('error', error_text) if self.show_params['trigger-end'] == 'time': error_text = self.tod.add_times( self.show_params['trigger-end-time'], id(self), self.tod_end_callback, 'n/a') if error_text <> '': self.mon.err(self, error_text) self.end('error', error_text) if self.show_params['trigger-end'] == 'duration': error_text = self.calculate_duration( self.show_params['trigger-end-time']) if error_text <> '': self.mon.err(self, error_text) self.end('error', error_text) self.wait_for_trigger()