本文整理汇总了Python中pp_medialist.MediaList.previous方法的典型用法代码示例。如果您正苦于以下问题:Python MediaList.previous方法的具体用法?Python MediaList.previous怎么用?Python MediaList.previous使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pp_medialist.MediaList
的用法示例。
在下文中一共展示了MediaList.previous方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import previous [as 别名]
class MediaShow:
# *******************
# External interface
# ********************
def __init__(self,
show,
canvas,
showlist,
pp_home,
pp_profile):
""" canvas - the canvas that the menu is to be written on
show - the dictionary fo the show to be played
pp_home - Pi presents data_home directory
pp_profile - Pi presents profile directory
"""
self.mon=Monitor()
self.mon.on()
#instantiate arguments
self.show =show
self.showlist=showlist
self.canvas=canvas
self.pp_home=pp_home
self.pp_profile=pp_profile
# open resources
self.rr=ResourceReader()
# Init variables
self.player=None
self.shower=None
self._poll_for_interval_timer=None
self._poll_for_continue_timer=None
self._waiting_for_interval=False
self._interval_timer=None
self.error=False
self._interval_timer_signal=False
self._end_mediashow_signal=False
self._next_track_signal=False
self._previous_track_signal=False
self._play_child_signal = False
self._req_next='nil'
self._state='closed'
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()
# respond to key presses.
def key_pressed(self,key_name):
self.mon.log(self,"received key: " + key_name)
if key_name=='':
pass
elif key_name=='escape':
# if next lower show is running pass down to stop the show and lower level
if self.shower<>None:
self.shower.key_pressed(key_name)
# if not at top stop the show
else:
if self.top == False:
self._end_mediashow_signal=True
# and if a track is running stop that first
if self.player<>None:
self.player.key_pressed(key_name)
#.........这里部分代码省略.........
示例2: MenuShow
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import previous [as 别名]
class MenuShow(Show):
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 = ""
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()
# ********************
# respond to inputs.
# ********************
# exit received from another concurrent show
def exit(self):
self.stop_timers()
Show.base_exit(self)
# show timeout happened
def show_timeout_stop(self):
self.stop_timers()
Show.base_show_timeout_stop(self)
# terminate Pi Presents
def terminate(self):
self.stop_timers()
Show.base_terminate(self)
def handle_input_event(self, symbol):
Show.base_handle_input_event(self, symbol)
def handle_input_event_this_show(self, symbol):
# menushow has only internal operation
operation = self.base_lookup_control(symbol, self.controls_list)
self.do_operation(operation)
def do_operation(self, operation):
# service the standard inputs for this show
self.mon.trace(self, operation)
if operation == "exit":
self.exit()
elif operation == "stop":
self.stop_timers()
#.........这里部分代码省略.........
示例3: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import previous [as 别名]
class MenuShow:
""" Displays a menu with optional hint below it. User can traverse the menu and
select a track using key or button presses.
Interface:
* play - displays the menu and selects the first entry
* input_pressed, - receives user events passes them to a Player if a track is playing,
otherwise actions them with _next, _previous, _play_selected_track, _end
Optional display of eggtimer by means of Players ready_callback
Supports imageplayer, videoplayer,messagplayer,audioplayer,menushow,mediashow
Destroys itself on exit
"""
# *********************
# external interface
# ********************
def __init__(self,
show_params,
root,
canvas,
showlist,
pp_dir,
pp_home,
pp_profile):
""" canvas - the canvas that the menu is to be written on
show - the name of the configuration dictionary section for the menu
showlist - the showlist
pp_home - Pi presents data_home directory
pp_profile - Pi presents profile directory"""
self.mon=Monitor()
self.mon.on()
self.display_guidelines_command=show_params['menu-guidelines']
self.display_guidelines=self.display_guidelines_command
#instantiate arguments
self.show_params=show_params
self.root=root
self.canvas=canvas
self.showlist=showlist
self.pp_dir=pp_dir
self.pp_home=pp_home
self.pp_profile=pp_profile
# open resources
self.rr=ResourceReader()
# init variables
self.drawn = None
self.player=None
self.shower=None
self.menu_timeout_running=None
self.error=False
def play(self,show_id,end_callback,ready_callback,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.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.menu_file = self.pp_profile + "/" + self.show_params['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")
#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'])
if self.show_params['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)['location'])
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")
#.........这里部分代码省略.........
示例4: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import previous [as 别名]
class MediaShow:
# *******************
# External interface
# ********************
def __init__(self,
show_params,
root,
canvas,
showlist,
pp_dir,
pp_home,
pp_profile):
""" canvas - the canvas that the menu is to be written on
show - the dictionary fo the show to be played
pp_home - Pi presents data_home directory
pp_profile - Pi presents profile directory
"""
self.mon=Monitor()
self.mon.on()
#instantiate arguments
self.show_params =show_params
self.showlist=showlist
self.root=root
self.canvas=canvas
self.pp_dir=pp_dir
self.pp_home=pp_home
self.pp_profile=pp_profile
# open resources
self.rr=ResourceReader()
# Init variables
self.player=None
self.shower=None
self.poll_for_interval_timer=None
self.poll_for_continue_timer=None
self.waiting_for_interval=False
self.interval_timer=None
self.duration_timer=None
self.error=False
self.interval_timer_signal=False
self.end_trigger_signal=False
self.end_mediashow_signal=False
self.next_track_signal=False
self.previous_track_signal=False
self.play_child_signal = False
self.req_next='nil'
#create and instance of TimeOfDay scheduler so we can add events
self.tod=TimeOfDay()
self.state='closed'
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(self.show_params['sequence'])
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'])
#.........这里部分代码省略.........
示例5: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import previous [as 别名]
class MenuShow:
""" Displays a menu with optional hint below it. User can traverse the menu and
select a track using key or button presses.
Interface:
* play - displays the menu and selects the first entry
* key_pressed, button_pressed - receives user events passes them to a Player if a track is playing,
otherwise actions them with _next, _previous, _play_selected_track, _end
Optional display of eggtimer by means of Players ready_callback
Supports imageplayer, videoplayer,messagplayer,audioplayer,menushow,mediashow
Destroys itself on exit
"""
# *********************
# external interface
# ********************
def __init__(self,
show_params,
canvas,
showlist,
pp_home,
pp_profile):
""" canvas - the canvas that the menu is to be written on
show - the name of the configuration dictionary section for the menu
showlist - the showlist
pp_home - Pi presents data_home directory
pp_profile - Pi presents profile directory"""
self.mon=Monitor()
self.mon.on()
#instantiate arguments
self.show_params=show_params
self.showlist=showlist
self.canvas=canvas
self.pp_home=pp_home
self.pp_profile=pp_profile
# open resources
self.rr=ResourceReader()
# init variables
self.drawn = None
self.player=None
self.shower=None
self.menu_timeout_running=None
self.error=False
def play(self,show_id,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.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.menu_file = self.pp_profile + "/" + self.show_params['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_params['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")
self.egg_timer=None
#start timeout alarm if required
if int(self.show_params['timeout'])<>0:
self.menu_timeout_running=self.canvas.after(int(self.show_params['timeout'])*1000,self._timeout_menu)
if self.ready_callback<>None:
self.ready_callback()
self.canvas.delete(ALL)
# display background image
if self.show_params['has-background']=="yes":
#.........这里部分代码省略.........
示例6: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import previous [as 别名]
class MediaShow:
# *******************
# External interface
# ********************
def __init__(self, show_params, canvas, showlist, pp_home, pp_profile):
""" canvas - the canvas that the menu is to be written on
show - the dictionary fo the show to be played
pp_home - Pi presents data_home directory
pp_profile - Pi presents profile directory
"""
self.mon = Monitor()
self.mon.on()
# instantiate arguments
self.show_params = show_params
self.showlist = showlist
self.canvas = canvas
self.pp_home = pp_home
self.pp_profile = pp_profile
# open resources
self.rr = ResourceReader()
# Init variables
self.player = None
self.shower = None
self._poll_for_interval_timer = None
self._poll_for_continue_timer = None
self._waiting_for_interval = False
self._interval_timer = None
self.duration_timer = None
self.error = False
self._interval_timer_signal = False
self._end_trigger_signal = False
self._end_mediashow_signal = False
self._next_track_signal = False
self._previous_track_signal = False
self._play_child_signal = False
self._req_next = "nil"
# create and instance of TimeOfDay scheduler so we can add events
self.tod = TimeOfDay()
self._state = "closed"
def play(self, show_id, 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.show_id = show_id
self._end_callback = end_callback
self._ready_callback = ready_callback
self.top = top
self.command = command
self.mon.log(self, "Starting show: Id= " + str(self.show_id) + " " + self.show_params["show-ref"])
# 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")
# 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)
#.........这里部分代码省略.........