def __init__(self, grid): Menu.__init__(self, name='EPG Control Window', choices=[], type='epg_control_window', universe='tv') self.eventhandler = EpgControlWindowEventHandler(self) self._getitems_keywords.update({ 'date': self.get_date, 'time_slice': self.get_time_slice, 'favorite_list': self.get_favorite_list }) self.grid = grid self.favorites = HiddenRoot().get_child('TV Favorites', self.grid).browse() self.acl = TVRootItem().get_acl(self.grid) if self.grid.channel_list['index'] is None: self.selected_favorite_pos = -1 else: self.selected_favorite_pos = int(self.grid.channel_list['index']) self.field_dispatch = [ self.select_date, self.select_visible_time_slice, self.select_favorite_list ] self.selected_field = 0 self.start_time, self.end_time = grid.start_time, grid.end_time self.commit_task = Task(self._commit_changes) return None
def __init__(self, **kw): global glob_led_signal_list main_items = [] self._init_etree('/etc/led_policy.xml') self._save_led_policy() for i in range(len(glob_led_signal_list)): main_items.append( LedSignalSetupItem(name=glob_led_signal_list[i].attrib["name"], type_='setupitem', menu=self, signal_num=i)) self.eventhandler = LedPolicyMenuEventHandler(self) Menu.__init__(self, name=_('Led Policy'), choices=main_items, type='ledsetup', **kw) self.available_choices = [ 'main_list', 'led_list', 'property_list', 'option0_list', 'option1_list' ] self._getitems_keywords.update( dict(led_list=(lambda: self.get_item_list('led_list')), property_list=(lambda: self.get_item_list('property_list')), option0_list=(lambda: self.get_item_list('option0_list')), option1_list=(lambda: self.get_item_list('option1_list')))) self._browse_main() self.active_list = 'main_list'
def __init__(self, **kw): self.eventhandler = CpuTempMenuEventHandler(self) self._get_setpoint_temp() Menu.__init__(self, name=_('Cpu Setpoint Temperature'), choices=[TempSetupItem(type_='setupitem', menu=self)], type='cputempsetup', **kw)
def __init__(self, name=_('Playlist editor'), playlist=None, type='playlist_editor', **kw): self.playlist = playlist try: playlist = playlist.browse() except BrowseError: playlist = [] self.eventhandler = PlaylistEditorEventHandler(self) Menu.__init__(self, name=name, choices=playlist, type=type, **kw) return None
def __init__(self, player, channel_list, universe='tv', selected_chan=0): Menu.__init__(self, name='EPG Grid', choices=[], type='epg_grid', universe=universe) self.eventhandler = EpgGridEventHandler(self) self.player = player self.start_time, self.end_time = ts.current_timeslice() self.lower_limit = ts.get_epg_day(self.start_time) self.upper_limit = self.start_time + datetime.timedelta(days=7) self.displayed_programs = [] self.selected_program = 0 self._summarized_info = dict() self._getitems_keywords.update({ 'clock': (lambda: None), 'channel_list': (lambda: self.get_item_list('channel_list')), 'channel_list_name': (lambda: self.channel_list.name), 'info_press': (lambda: self._summarized_info['info_press']), 'info_icon': (lambda: self._summarized_info['info_icon']), 'selected_program_name': (lambda: self._summarized_info['program_name']), 'selected_program_duration': (lambda: self._summarized_info['program_duration']), 'selected_program_date': (lambda: self._summarized_info['program_date']), 'selected_program_start_time': (lambda: self._summarized_info['program_start']), 'selected_program_maturity_rating': (lambda: self._summarized_info['program_maturity_rating']), 'selected_program_duration_caption': (lambda: _('Duration')), 'epg_control_window_caption': (lambda: _('EPG Control Window')) }) self.update_channels_timer = Task(self.update_channels) self.refresh_timer = Task(self.refresh) self.set_channel_list(channel_list) self.select(selected_chan, 'main_list') self.select(selected_chan, 'channel_list') self.update_programs() now = time() for i, prog in enumerate(self.displayed_programs): if prog.start_time <= now and prog.end_time >= now: self.selected_program = i self.select_program(0) break self.tick_timer = Task(self.tick_callback) self.tick_timer.start(5, loop=True) self.refresh_timer.start(AUTO_REFRESH_DELAY, loop=True, consider_idle=True) return None
def __init__(self, *args, **kw): if 'type' not in kw: kw['type'] = 'scroller' filename = kw.pop('filename') self.fd = file(filename) Menu.__init__(self, *args, **kw) self._getitems_keywords['full_text'] = (lambda: '') default_evt = self.eventhandler.event_home for evt in 'wheel_rwd wheel_fwd right up down select toggle_menu action_menu record stop info marker'.split( ): setattr(self.eventhandler, 'event_' + evt, default_evt) self.eventhandler.event_down = (lambda ev: self._next_item()) Task(self._next_item).start(0.29999999999999999) return None
def __init__(self, name=_('Scheduled recordings'), type='scheduled_navigator'): self.eventhandler = ScheduledRecordMenuEventHandler(self) Menu.__init__(self, name=name, choices=ScheduledRecordRootItem(self).browse(), type=type) self._program = None self._getitems_keywords.update( dict(universe_name=(lambda: UNIVERSE_NAME_DICT[self.type]), parent_icon_name=(lambda: 'parentfolder-%s.png' % self.type), parent_item_name=(lambda: self.name), record_description=self.get_record_description, record_date=( lambda: (seconds_to_long_date(self.selected.record.start_time) if self.selected else '')), record_start_time=( lambda: (seconds_to_hhmm(self.selected.record.start_time) if self.selected else '')), record_stop_time=( lambda: (seconds_to_hhmm(self.selected.record.stop_time) if self.selected else '')), channel_name=(lambda: (self.selected.record.service_name if self.selected else '')), repetition_type=( lambda: (_(self.selected.periodic_rule.extern_rule_name. capitalize()) if (isinstance(self.selected, PeriodicScheduledRecordItem) and _(self.selected.periodic_rule.extern_rule_name. capitalize())) else '')), repetition_number=( lambda: (self.selected.periodic_rule.limit if (isinstance(self.selected, PeriodicScheduledRecordItem) and self.selected.periodic_rule.limit) else '')))) return None
def __init__(self): self.eventHandler = EventDispatcher(self) self._navigator = None Menu.__init__(self, 'root', type='root') self._getitems_keywords['message'] = ( lambda: _('Press Home to switch universe')) import wymedia.wmplus as w w.register_plug_callback( (lambda obj: Task(self.device_plugged, obj, True).start(0))) w.register_unplug_callback( (lambda obj: Task(self.device_plugged, obj, False).start(0))) self._controlmode_popup = None usb_mode = self._get_usb_mode() if usb_mode == 'MTP': from peewee.controlmode import ControlModeManager ctrl = ControlModeManager() ctrl.register_observer(self.control_changed) pygui_globs['controlmodemanager'] = ctrl elif usb_mode == 'PS3': self.control_changed('mtp_off', True, True) self.active_univ = None return None
def __init__(self, program): Menu.__init__(self, name='EPG Info Banner', choices=[], type='epg_info_banner') self.eventhandler = EpgInfoBannerEventHandler(self) self._getitems_keywords.update({ 'name': self.get_name, 'start_time': self.get_start_time, 'end_time': self.get_end_time, 'duration': self.get_duration, 'content_type': self.get_content_type, 'description': self.get_description }) self.program = program description = self.program.short_description + '\n' + program.description if description: self.pages = [ description[start:start + self.PAGE_SIZE] for start in xrange(0, len(description), self.PAGE_SIZE) ] else: self.pages = [] self.selected_page = 0 extra_info = [ Item(name=title, type_=key.lower(), menu=self) for key, title in program.EXTRA_INFO_FIELDS if int(program[key]) ] maturity_key = program['maturityRating'] if maturity_key is not None: maturity = 'maturityrating_%i.png' % int(maturity_key) else: maturity = 'maturityrating_unknown.png' extra_info.append(Item(name='maturity', type_=maturity, menu=self)) self.set_items(extra_info, 'main_list', -1) return None
def __init__(self, focus=False): self._navigator = None if 'universe_switcher' in plugins: type_ = 'switcher' else: type_ = 'main' self.eventhandler = HomeEventHandler(self) Menu.__init__(self, type_, self.get_universes_items(), type=type_) self._getitems_keywords['item_name'] = (lambda: self._get_item_name()) self._getitems_keywords['parental_rating'] = ( lambda: self._get_parental_rating()) self._getitems_keywords['help'] = (lambda: _('Enter Setup universe')) self.get_item_list('main_list').cyclic = True try: if focus: self.select(self._HomeMenu__get_named(focus)) elif home_order: for name in home_order: if name[0] == '*': self.select(self._HomeMenu__get_named( name.lstrip('*'))) break except Exception, e: log.error('Select failed: %s' % str(e))