本文整理汇总了Python中pp_show.Show类的典型用法代码示例。如果您正苦于以下问题:Python Show类的具体用法?Python Show怎么用?Python Show使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Show类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: play
def play(self,end_callback,show_ready_callback, parent_kickback_signal,level,controls_list):
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'])
if self.medialist.anon_length()==0 and self.show_params['type'] not in ('liveshow','artliveshow'):
self.mon.err(self,'No anonymous tracks in medialist ')
self.end('error','No anonymous tracks in medialist ')
# delete eggtimer started by the parent
if self.previous_shower is not None:
self.previous_shower.delete_eggtimer()
self.start_show()
示例2: handle_input_event_this_show
def handle_input_event_this_show(self,symbol):
self.mon.trace(self, "Handling input event in this show: " + symbol + " State:" + self.state)
# check symbol against mediashow triggers
if self.state == 'waiting' and self.show_params['trigger-start-type'] in ('input','input-persist') and symbol == self.show_params['trigger-start-param']:
self.mon.stats(self.show_params['type'],self.show_params['show-ref'],self.show_params['title'],'start trigger',
'','','')
Show.delete_admin_message(self)
self.start_list()
elif self.state == 'playing' and self.show_params['trigger-end-type'] == 'input' and symbol == self.show_params['trigger-end-param']:
self.end_trigger_signal=True
if self.shower is not None:
self.shower.do_operation('stop')
elif self.current_player is not None:
self.current_player.input_pressed('stop')
elif self.state == 'playing' and self.show_params['trigger-next-type'] == 'input' and symbol == self.show_params['trigger-next-param']:
self.mon.stats(self.show_params['type'],self.show_params['show-ref'],self.show_params['title'],'next trigger',
'','','')
self.mon.trace(self, "trigger-next-type detected; Calling next()")
self.next()
else:
# event is not a trigger so must be internal operation
operation=self.base_lookup_control(symbol,self.controls_list)
if operation != '':
self.do_operation(operation)
else:
self.mon.trace(self, "No operation found for event")
示例3: end
def end(self,reason,message):
Show.delete_admin_message(self)
self.base_withdraw_show_background()
self.base_delete_show_background()
self.mon.log(self,"Ending Artshow: "+ self.show_params['show-ref'])
self.end_callback(self.show_id,reason,message)
self=None
示例4: end_shower
def end_shower(self,show_id,reason,message):
self.mon.log(self,self.show_params['show-ref']+ ' '+ str(self.show_id)+ ': Returned from shower with ' + reason +' ' + message)
self.sr.hide_click_areas(self.links)
self.req_next=reason
Show.base_end_shower(self)
# print 'end shower - wha-next'
self.what_next_after_showing()
示例5: track_ready_callback
def track_ready_callback(self,enable_show_background):
self.delete_eggtimer()
# get control bindings for this show
# needs to be done for each track as track can override the show controls
if self.show_params['disable-controls'] == 'yes':
self.controls_list=[]
else:
reason,message,self.controls_list= self.controlsmanager.get_controls(self.show_params['controls'])
if reason=='error':
self.mon.err(self,message)
self.end('error',"error in controls: " + message)
return
# print 'controls',reason,self.show_params['controls'],self.controls_list
#merge controls from the track
controls_text=self.current_player.get_links()
reason,message,track_controls=self.controlsmanager.parse_controls(controls_text)
if reason == 'error':
self.mon.err(self,message + " in track: "+ self.current_player.track_params['track-ref'])
self.error_signal=True
self.what_next_after_showing()
self.controlsmanager.merge_controls(self.controls_list,track_controls)
# enable the click-area that are in the list of controls
self.sr.enable_click_areas(self.controls_list)
Show.base_track_ready_callback(self,enable_show_background)
示例6: __init__
def __init__(self, show_id, show_params, root, canvas, showlist, pp_dir, pp_home, pp_profile, command_callback):
"""
show_id - index of the top level show caling this (for debug only)
show_params - dictionary section for the menu
canvas - the canvas that the menu is to be written on
showlist - the showlist
pp_dir - Pi Presents directory
pp_home - Pi presents data_home directory
pp_profile - Pi presents profile directory
"""
# init the common bits
Show.base__init__(
self, show_id, show_params, root, canvas, showlist, pp_dir, pp_home, pp_profile, command_callback
)
# instatiatate the screen driver - used only to access enable and hide click areas
self.sr = ScreenDriver()
self.controlsmanager = ControlsManager()
# init variables
self.show_timeout_timer = None
self.track_timeout_timer = None
self.next_track_signal = False
self.next_track = None
self.menu_index = 0
self.menu_showing = True
self.req_next = ""
示例7: load_first_track
def load_first_track(self):
self.mon.trace(self,'')
if self.medialist.start() is False:
# list is empty - display a message for 5 secs and then retry
Show.display_admin_message(self,self.show_params['empty-text'])
self.canvas.after(5000,self.remove_list_empty_message)
else:
# otherwise load the first track
# print "!!!!! artshow init first"
self.next_player=Show.base_init_selected_player(self,self.medialist.selected_track())
if self.next_player is None:
self.mon.err(self,"Track Type cannot be played by this show: "+self.medialist.selected_track()['type'])
self.req_next='error'
self.what_next()
else:
# messageplayer passes the text not a file name
if self.medialist.selected_track()['type'] == 'message':
track_file=self.medialist.selected_track()['text']
else:
track_file=Show.base_complete_path(self,self.medialist.selected_track()['location'])
# print "!!!!! artshow load first ",track_file
self.next_player.load(track_file,
self.loaded_callback,
enable_menu=False)
self.wait_for_load()
示例8: play
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()
示例9: __init__
def __init__(self,
show_id,
show_params,
root,
canvas,
showlist,
pp_dir,
pp_home,
pp_profile,
command_callback):
# init the common bits
Show.base__init__(self,
show_id,
show_params,
root,
canvas,
showlist,
pp_dir,
pp_home,
pp_profile,
command_callback)
# delay in mS before next track is loaded after showing a track.
# can be reduced if animation is not required
self.load_delay = 2000
# Init variables for this show
self.end_medialist_signal=False
self.end_medialist_warning=False
self.next_track_signal=False
self.state='closed'
self.req_next=''
示例10: play
def play(self, end_callback, show_ready_callback, parent_kickback_signal, level, controls_list):
""" displays the menu
end_callback - function to be called when the menu exits
show_ready_callback - callback when menu is ready to display (not used)
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 not using gapshow
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")
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")
# and delete eggtimer
if self.previous_shower is not None:
self.previous_shower.delete_eggtimer()
# and display the menu
self.do_menu_track()
示例11: start_load_show_loop
def start_load_show_loop(self,selected_track):
# shuffle players
Show.base_shuffle(self)
# print '\nSHUFFLED previous is', self.mon.id(self.previous_player)
self.mon.trace(self,'')
self.display_eggtimer()
if self.track_timeout_timer is not None:
self.canvas.after_cancel(self.track_timeout_timer)
self.track_timeout_timer=None
# start timeout for the track if required
if self.current_track_ref != self.first_track_ref and self.track_timeout != 0:
self.track_timeout_timer=self.canvas.after(self.track_timeout*1000,self.track_timeout_callback)
# read the show links. Track links will be added by ready_callback
# needs to be done in show loop as each track adds different links to the show links
if self.show_params['disable-controls'] == 'yes':
self.links=[]
else:
reason,message,self.links=self.path.parse_links(self.show_params['links'],self.allowed_links)
if reason == 'error':
self.mon.err(self,message + " in show")
self.end('error',message + " in show")
# load the track or show
# params - track,, track loaded callback, end eshoer callback,enable_menu
Show.base_load_track_or_show(self,selected_track,self.what_next_after_load,self.end_shower,False)
示例12: __init__
def __init__(self,
show_id,
show_params,
root,
canvas,
showlist,
pp_dir,
pp_home,
pp_profile,
command_callback):
"""
show_id - index of the top level show caling this (for debug only)
show_params - dictionary section for the menu
canvas - the canvas that the menu is to be written on
showlist - the showlist
pp_dir - Pi Presents directory
pp_home - Pi presents data_home directory
pp_profile - Pi presents profile directory
"""
# init the common bits
Show.base__init__(self,
show_id,
show_params,
root,
canvas,
showlist,
pp_dir,
pp_home,
pp_profile,
command_callback)
# instatiatate the screen driver - used only to access enable and hide click areas
self.sr=ScreenDriver()
# create a path stack and control path debugging
if self.show_params['debug-path']=='yes':
self.debug=True
else:
self.debug=False
self.path = PathManager()
self.allowed_links=('return','home','call','null','exit','goto','play','jump','repeat','pause','no-command','stop','pause-on','pause-off','mute','unmute','go')
# init variables
self.track_timeout_timer=None
self.show_timeout_timer=None
self.next_track_signal=False
self.next_track_ref=''
self.current_track_ref=''
self.current_track_type=''
self.req_next=''
示例13: what_next_after_showing
def what_next_after_showing(self):
self.mon.trace(self, '')
# print 'WHAT NEXT AFTER SHOWING'
# print 'current is',self.mon.id(self.current_player), ' next track signal ',self.next_track_signal
# need to terminate
if self.terminate_signal is True:
self.terminate_signal=False
# what to do when closed or unloaded
self.ending_reason='killed'
Show.base_close_or_unload(self)
elif self.req_next== 'error':
self.req_next=''
# set what to do after closed or unloaded
self.ending_reason='error'
Show.base_close_or_unload(self)
# show timeout
elif self.show_timeout_signal is True:
self.show_timeout_signal=False
# what to do when closed or unloaded
self.ending_reason='show-timeout'
Show.base_close_or_unload(self)
# used by exit for stopping show from other shows.
elif self.exit_signal is True:
self.exit_signal=False
self.ending_reason='exit'
Show.base_close_or_unload(self)
# user wants to stop
elif self.user_stop_signal is True:
self.user_stop_signal=False
self.ending_reason='user-stop'
Show.base_close_or_unload(self)
# user has selected another track
elif self.next_track_signal is True:
self.next_track_signal=False
self.current_track_ref=self.next_track_arg
# print 'what next - next track signal is True so load ', self.current_track_ref
index = self.medialist.index_of_track(self.current_track_ref)
if index >=0:
# don't use select the track as not using selected_track in radiobuttonshow
# and load it
self.start_load_show_loop(self.medialist.track(index))
else:
self.mon.err(self,"next track not found in medialist: "+ self.current_track_ref)
self.end('error',"next track not found in medialist")
else:
# track ends naturally or is quit so go back to first track
# print 'what next - natural end so do first track'
self.do_first_track()
示例14: end_shower
def end_shower(self,show_id,reason,message):
self.mon.log(self,self.show_params['show-ref']+ ' '+ str(self.show_id)+ ': Returned from shower with ' + reason +' ' + message)
self.sr.hide_click_areas(self.links)
if reason == 'error':
self.req_next='error'
self.what_next_after_showing()
else:
Show.base_end_shower(self)
self.next_track_signal=True
self.next_track_op='return-by'
self.next_track_arg='1'
self.what_next_after_showing()
示例15: do_operation
def do_operation(self,operation):
# print 'do_operation ',operation
self.mon.trace(self, operation)
if operation == 'exit':
self.exit()
elif operation == 'stop':
if self.level != 0 :
# not at top so stop the show
self.user_stop_signal=True
# and stop the track first
if self.current_player is not None:
self.current_player.input_pressed('stop')
else:
# at top, just stop track if running
if self.current_player is not None:
self.current_player.input_pressed('stop')
elif operation == 'up' and self.state == 'playing':
# print '\nUP'
self.previous()
elif operation == 'down' and self.state == 'playing':
self.next()
elif operation == 'play':
# use 'play' to start child if state=playing or to trigger the show if waiting for trigger
if self.state == 'playing':
if self.show_params['child-track-ref'] != '':
# set a signal because must stop current track before running child show
self.play_child_signal=True
self.child_track_ref=self.show_params['child-track-ref']
# and stop the current track if its running
if self.current_player is not None:
self.current_player.input_pressed('stop')
else:
if self.state == 'waiting':
self.mon.stats(self.show_params['type'],self.show_params['show-ref'],self.show_params['title'],'start trigger',
'','','')
Show.delete_admin_message(self)
self.start_list()
elif operation in ('pause','pause-on','pause-off','mute','unmute','go'):
if self.current_player is not None:
self.current_player.input_pressed(operation)
elif operation in ('no-command','null'):
return
# if the operation is omxplayer mplayer or uzbl runtime control then pass it to player if running
elif operation[0:4] == 'omx-' or operation[0:6] == 'mplay-'or operation[0:5] == 'uzbl-':
if self.current_player is not None:
self.current_player.input_pressed(operation)