class VideoEventHandler(AudioEventHandler): forward_steps = f_list(config.HMI_VIDEO['forward']) backward_steps = f_list(config.HMI_VIDEO['backward']) slow_motion = f_list(config.HMI_VIDEO['slow']) reverse_slow_motion = f_list(config.HMI_VIDEO['reverse_slow']) def event_action_menu(self, event): return GenericPlayerEventHandler.event_action_menu(self, event) def event_left(self, event): self.player.action_seek(-10) return True def event_right(self, event): self.player.action_seek(30) return True def event_wheel_rwd(self, event): actual_speed = self.player.speed if actual_speed == 0 or actual_speed in self.reverse_slow_motion + self.slow_motion: self._change_speed(self.reverse_slow_motion, self.slow_motion, 0) else: self._change_speed(self.backward_steps, self.forward_steps) return True def event_wheel_fwd(self, event): actual_speed = self.player.speed if actual_speed == 0 or actual_speed in self.reverse_slow_motion + self.slow_motion: self._change_speed(self.slow_motion, self.reverse_slow_motion, 0) else: self._change_speed(self.forward_steps, self.backward_steps) return True def event_toggle_menu(self, event): return GenericPlayerEventHandler.event_toggle_menu(self, event) def event_info(self, event): self.player.action_info() return True def event_up(self, event): if self.player.playmode != 'track': AudioEventHandler.event_up(self, event) return True def event_down(self, event): if self.player.playmode != 'track': AudioEventHandler.event_down(self, event) return True
class DVDEventHandler(VideoEventHandler): forward_steps = f_list([2, 4, 8, 16, 25, 50, 100, 400]) backward_steps = f_list([-2, -4, -8, -16, -25, -50, -100, -400]) slow_motion = f_list([0.25, 0.5]) reverse_slow_motion = f_list() def event_info(self, event): self.player.action_info() return True def event_up(self, event): self.player.action_up() return True def event_down(self, event): self.player.action_down() return True def event_left(self, event): self.player.action_left() return True def event_right(self, event): self.player.action_right() return True def event_select(self, event): self.player.action_select() return True def event_action_menu(self, event): from pygui.menu.menu import ActionMenu sel = self.player.selected parent = None if sel is None and self.player._history: parent = self.player._history[-1]['selected'] else: parent = sel.parent context = dict(menu=self.player, selected=sel, parent=parent) s = ActionMenu(context, type_='playeraction', category='dvdplayer', universe=self.player.universe) s.show() if not s.get_item_list('options_list'): louie_send('empty_options', sender=s) else: louie_send('not_empty_options', sender=s) return True
def _set_framerate(self): new_mode = None if config.user_config['connections']['auto_frame_rate']: if self.wpl.is_cinema(): new_mode = (1920, 1080, 0, 24) log.debug( 'wpl.is_cinema() returned True: new_mode = (1920, 1080, 0, 24)' ) else: log.debug('wpl.is_cinema() returned False') try: from peewee.ranges import f_list fuzzy_list = f_list([25.0], range=2) vlist = self.wpl.vlist() if vlist: framerate = vlist[0]['framerate'] log.debug('auto_framerate: wpl.framerate: %s', framerate) if 10 < framerate < 100: if framerate in fuzzy_list: framerate = 50 else: framerate = 59 else: raise IndexError else: framerate = config.user_config['connections'][ 'resolution'][3] except IndexError: pass else: new_mode = list( config.user_config['connections']['resolution']) new_mode[-1] = framerate new_mode = tuple(new_mode) if new_mode and self.status != 'playing' and self.last_video_resolution != new_mode: try: log.debug('auto_framerate: change mode %s -> %s', self.last_video_resolution, new_mode) vm = pygui_globs['videomodes'] if vm.hdmi_sink: self._clear_wpl() if vm.secure_set_resolution(new_mode): self.last_video_resolution = new_mode else: log.warn('auto_framerate failed. %s not supported', new_mode) except: PRINT_EXCEPTION() return None
class AudioEventHandler(GenericPlayerEventHandler): __doc__ = '\n Event manager for Music universe\n ' forward_steps = f_list(HMI_MUSIC['forward']) backward_steps = f_list(HMI_MUSIC['backward']) def event_action_menu(self, event): GenericPlayerEventHandler.event_action_menu(self, event) def event_up(self, event): al = self.player.active_list if al == 'main_list': if not self.player.random_mode: ret = self.player.select(-event.arg['count'], list_name=al) if self.player.repeat_mode == 'track': self.player.repeat_mode = False else: ret = self.player.select_random() else: ret = Menu.select(self.player, -event.arg['count'], list_name=al) return True def event_down(self, event): al = self.player.active_list if al == 'main_list': if not self.player.random_mode: ret = self.player.select(event.arg['count'], list_name=al) if self.player.repeat_mode == 'track': self.player.repeat_mode = False else: ret = self.player.select_random() else: ret = Menu.select(self.player, event.arg['count'], list_name=al) return True def event_stop(self, event): play = self.player if play.active_list == 'edit_list': if play.selected == play.get_item_list('main_list').selected: return True play.choices.edited = False play.selected.vfs_delete() del play.choices[play.selected_pos] play.song_changed() else: return GenericPlayerEventHandler.event_stop(self, event) def event_select(self, event): if self.player.active_list == 'edit_list': self.player.select(self.player.selected) else: self.player.action_play() return True def event_left(self, event): play = self.player if play.active_list == 'edit_list': el = play.get_item_list('edit_list') if el.edited: el.edited = False else: main_list = play.get_item_list('main_list') old_selection = main_list.selected main_list.set_items(el, old_selection) el.set_items([]) play.focus_previous() self.player.tasks['hide_help'].stop() louie_send('hide_help_playlist', sender=self.player) return True def event_right(self, event): play = self.player if play.active_list == 'main_list': main_list = play.get_item_list('main_list') edit_list = play.get_item_list('edit_list') edit_list.set_items(main_list) edit_list.select(play.selected) play.focus_next() self.player.show_help_playlist() else: play.get_item_list('edit_list').edited = True return True def _change_speed(self, wanted_speeds, mirror_speeds, reference_speed=1): sm = self.player.speed if abs(sm - reference_speed) < 0.01: self.player.speed = wanted_speeds[0] return True try: idx = wanted_speeds.index(sm) _idx = min(idx + 1, len(wanted_speeds) - 1) if not idx == _idx: self.player.speed = wanted_speeds[_idx] def event_wheel_rwd(self, event): play = self.player if play.active_list == 'edit_list': return Menu.select(play, -event.arg['count']) self.player.action_seek(HMI_MUSIC['left']) return True def event_wheel_fwd(self, event): play = self.player if play.active_list == 'edit_list': Menu.select(play, event.arg['count']) return True self.player.action_seek(HMI_MUSIC['right']) return True def event_toggle_menu(self, event): if self.player.get_item_list('edit_list'): return True return GenericPlayerEventHandler.event_toggle_menu(self, event)
n 0(self.player.get_item_list('edit_list'))[]: i: o: 18(t), 26(f) nname: 0 n 0(None)[if self.player.get_item_list('edit_list'): return True return GenericPlayerEventHandler.event_toggle_menu(self, event) ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb770108c>} nname: 6 n 6(None)[__doc__ = '\n Event manager for Music universe\n ' forward_steps = f_list(HMI_MUSIC['forward']) backward_steps = f_list(HMI_MUSIC['backward']) def event_action_menu(self, event): GenericPlayerEventHandler.event_action_menu(self, event) def event_up(self, event): al = self.player.active_list if al == 'main_list': if not self.player.random_mode: ret = self.player.select(-event.arg['count'], list_name=al) if self.player.repeat_mode == 'track': self.player.repeat_mode = False else: ret = self.player.select_random() else: ret = Menu.select(self.player, -event.arg['count'], list_name=al)
n 0(self.player.playmode != 'track')[]: i: o: 18(t), 38(f) nname: 0 n 0(None)[if self.player.playmode != 'track': AudioEventHandler.event_down(self, event) return True ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb761ee2c>} nname: 6 n 6(None)[__doc__ = '\n Event manager for Video universe\n ' forward_steps = f_list(config.HMI_VIDEO['forward']) backward_steps = f_list(config.HMI_VIDEO['backward']) slow_motion = f_list(config.HMI_VIDEO['slow']) reverse_slow_motion = f_list(config.HMI_VIDEO['reverse_slow']) def event_action_menu(self, event): return GenericPlayerEventHandler.event_action_menu(self, event) def event_left(self, event): self.player.action_seek(-10) return True def event_right(self, event): self.player.action_seek(30) return True def event_wheel_rwd(self, event):
class DVDEventHandler(VideoEventHandler): forward_steps = f_list([2, 4, 8, 16, 25, 50, 100, 400])
parent = sel.parent context = dict(menu=self.player, selected=sel, parent=parent) s = ActionMenu(context, type_='playeraction', category='dvdplayer', universe=self.player.universe) s.show() if not s.get_item_list('options_list'): louie_send('empty_options', sender=s) else: louie_send('not_empty_options', sender=s) return True ]: i: o: self.nodes: {'0&46': <unpyclib.structure.node instance at 0xb763dcac>} nname: 6 n 6(None)[forward_steps = f_list([2, 4, 8, 16, 25, 50, 100, 400]) backward_steps = f_list([-2, -4, -8, -16, -25, -50, -100, -400]) slow_motion = f_list([0.25, 0.5]) reverse_slow_motion = f_list() def event_info(self, event): self.player.action_info() return True def event_up(self, event): self.player.action_up() return True def event_down(self, event): self.player.action_down() return True