def show(self, *args, **kw): Menu.show(self, *args, **kw) if self.is_only_this_time(): louie_send('frequency_only_this_time_on', sender=self) else: louie_send('frequency_only_this_time_off', sender=self) return None
def _apply_rotation(self): self.selected.media_update('rotation') rot = int( self.selected['rotation'] if self.selected['rotation'] else 0) log.info('rotation=%i', rot) louie_send('picture_%i' % pos[0], sender=self, rotate=rot) return None
def handler(self): if self._check and not self._sender.could_remove_banner(): return None self._timer.stop() louie_send(self.signals[1], sender=self._sender) self._sender.tasks['tick'].stop() return None
def _selection_changed(self, item): log.debug('%s changed, reloading InfoWindow', item) for info in self.get_item_list('main_list'): if isinstance(info, InfoItem): info.reload() louie_send('main_list', sender=self, action='reset', value=self['main_list']) return None
def stop(self, *args, **kw): global pos for i in pos: louie_send('picture_%d' % i, sender=self, value=None) pos = [1, 2] Player.stop(self, *args, **kw) return None
def _move(self, val): ret = self.player.select(val) if ret: if not(val < 0 and 'event_up'): pass louie_send('event_down', sender=self.player) return ret
def __delitem__(self, i): if isinstance(self._data, (list, tuple)): del self._data[i] else: self._data._fill_cache() if len(self._data): if i == self.selected_pos: try: sel = self._data[self.selected_pos] except IndexError: self.selected_pos = len(self._data) - 1 elif i < self.selected_pos: self.selected_pos -= 1 for owner in self._data._owners: owner = owner() if owner != self and i < owner.selected_pos: owner.selected_pos -= 1 else: self.selected_pos = -1 for owner in self._data._owners: owner = owner() louie_send(owner.list_name, sender=owner.menu, action='remove', value=owner, position=i) return None
def force_ending(self, mute=False): if self._timer.running: self._timer.stop() if not mute: louie_send(self.signals[1], sender=self._sender) self._sender.tasks['tick'].stop() return None
def reload_center_list(self, rebuild=False): menu = self.menu if rebuild: center_selected = menu.selected_center menu._browse_main() menu.selected_center = center_selected louie_send('center_list', sender=menu, action='reset', value=menu['center_list'])
def _do_updates(self, fn, *args, **args): ret = fn(self, *args, **kw) for it in names: try: res = self[it] except Exception, e: log.warning('Unable to update widget specified for %s with %s', it, res) louie_send(it, sender=self, value=res)
def set_boundaries(self, start_time, end_time): self.start_time = start_time self.end_time = end_time louie_send('set_boundaries', start_ts=self.start_ts, end_ts=self.end_ts) self.update_programs() return None
def get_info_icon(self): prog = self.displayed_programs[self.selected_program] info_key = prog['class'] if 'dummy' not in info_key: louie_send('info_icon', sender=self, value='info_icon.png') else: louie_send('info_icon', sender=self, value='none.png') return None
def select(self, item, list_name=None, force_select=False): ret = Menu.select(self, item, list_name) if (ret is not False and self.navigator) or force_select: louie_send('result_count', sender=self, value=self.get_result_count()) self.move_navigator() return None
def _set_paused(self, val): self._paused = val if val: self.tasks['select_next'].stop() else: self._select_next() louie_send('status_icon', sender=self, value=self._get_status_icon()) return None
def _set_active_list(self, val): dc = self._active_list if dc != val: louie_send('on_%s_blur' % dc, self) self._active_list = val louie_send('on_%s_focus' % val, self) self.choices.advertise() return None
def _display_picture(self): try: louie_send('picture_%d' % pos[0], sender=self, value=self.selected['uri'], callback=self.tasks['transition'].start) except IOError, e: from pygui.window import MessageWindow MessageWindow(_('Invalid picture'), button=None).show(timeout=5)
def _error_spawner(self, prefix=None): error_timeout = self.tasks['error_timeout'] if not error_timeout.running: txt = 'error_signal' if prefix is not None: txt = prefix + '_' + txt louie_send(txt, sender=self) error_timeout.start(HMI_BASE['error_signal_delay']) return None
def _fill_cache(self, fill_range=None): try: delta_range = fill_range - self._range except: delta_range = None if fill_range is None: fill_range = self._range self._update_browse_options() signal = None log.debug('MR: %s DR: %s FR: %s', self._range, delta_range, fill_range) log.debug('requesting %d items starting at %d', len(fill_range), fill_range.start) if delta_range and delta_range < fill_range: windowed_childrens = self._browse_fn(delta_range.start, len(delta_range), self._sort, self._browse_options) if len(windowed_childrens) < len(delta_range): self.end_reached = True if delta_range.start == self._range.stop: items = list( WMedia2MMIObjects(windowed_childrens, self.menu, self._si)) del self._cached[:fill_range.start - self._range.start] self._cached.extend(items) signal = 'scroll_down' elif delta_range.stop == self._range.start: items = list( WMedia2MMIObjects(windowed_childrens, self.menu, self._si)) signal = 'scroll_up' my_len = len(self) if fill_range.stop < my_len or (fill_range.start < my_len and fill_range.stop >= my_len): del self._cached[fill_range.stop - self._range.start:] self._cached[0:0] = items else: del self._cached[fill_range.stop:] self._cached[0:0] = items else: windowed_childrens = self._browse_fn(fill_range.start, len(fill_range), self._sort, self._browse_options) if len(windowed_childrens) < len(fill_range): self.end_reached = True items = list( WMedia2MMIObjects(windowed_childrens, self.menu, self._si)) self._cached[:] = items signal = 'everything' for it in self._cached: it.list_owned = [elt().list_name for elt in self._owners] self._range = fill_range if self._length in fill_range: self._length = self._range.start + len(self._cached) else: self._length = max(self._length, self._range.start + len(self._cached)) louie_send(signal, sender=self.menu.universe, items=items) return None
def rotate(self, angle): rot = 0 try: unref_link = 'refid' in self.selected.wymedia_resource rot = int(self.selected.wymedia_resource.get('rotation', '0')) self.selected.vfs_set_metas(_unref_link=unref_link, rotation=str(rot + angle)) finally: louie_send('picture_%d' % pos[1], sender=self, rotate=angle) return None
def select(self, item, list_name=None, force_pos=False): if isinstance(item, basestring): item = self._HomeMenu__get_named(item) has_changed = Menu.select(self, item, list_name, force_pos) if has_changed is not False: louie_send('item_name', sender=self, action='update', value=omnicode(self['item_name'])) return has_changed
def select(self, item, list_name=None): ret = Menu.select(self, item, list_name) if ret: louie_send('hide_preview', sender=self) if isinstance(self.selected, ProgramItem): self._program = self.selected else: self._program = None self.build_preview() return ret
def gui_updater(fn): def _do_updates(self, *args, **args): ret = None try: ret = fn(self, *args, **kw) except Exception, e: PRINT_EXCEPTION(e) for it in self._getitems_keywords.iterkeys(): louie_send(it, sender=self, value=self[it]) return ret
def set_edit(self, val): if val != self._edited: louie_send(self.list_name, sender=self.menu, action='edit', value=self, edit_mode=val) self._edited = val elif val and val == self._edited: louie_send('edit_list_not_editable', sender=self.menu) return None
def reload_options_list(self, rebuild=False): menu = self.menu browse_method = {'center_list': menu._browse_center, 'main_list': menu._browse_main} if rebuild: if menu['center_list']: pass list = 'main_list' options_selected = menu.selected_options browse_method[list]() menu.selected_options = options_selected louie_send('options_list', sender=menu, action='reset', value=menu['options_list'])
def update_day_list(self): d_list = self.date_list[self.day_index] d = days_in_month(self.date_list[self.year_index].selected.val, self.date_list[self.month_index].selected.val) if d != len(d_list): self.date_list[self.day_index].set_items( [IntegerItem(i, menu=self) for i in xrange(1, d + 1)], selected=min(d_list.selected_pos, d - 1)) louie_send('date_%d' % (self.day_index + 1), sender=self, value=self.date_list[self.day_index].selected.name) return None
def event_right(self, event): if self.player.active_list == 'main_list': list_name, self.player.active_list = self.player.selected.list_name, self.player.selected.list_name self.player.get_item_list(list_name).select(0, True) else: _list = self.player.get_item_list('main_list').selected _preview_list = _list.selected.list_name if _list.select(1): _new_list = _list.selected.list_name louie_send('on_%s_blur' % _preview_list, self.player) louie_send('on_%s_focus' % _new_list, self.player) return True
def _exec(*args, **kw): func(*args, **kw) self = args[0] louie_send('preview_list', sender=self.menu, action='reset', value=self.menu['preview_list']) louie_send('options_list', sender=self.menu, action='reset', value=self.menu['options_list']) return None
def select_date(self, _date, stop=None): struct_t = localtime(_date) self.date_list[self.year_index].select(IntegerItem(struct_t[0])) self.date_list[self.month_index].select(IntegerItem(struct_t[1])) self.date_list[self.day_index].select(IntegerItem(struct_t[2])) louie_send('date_weekday', sender=self, value=self['date_weekday']) self.start_hour_list.select(IntegerItem(struct_t[3])) self.start_minute_list.select(IntegerItem(struct_t[4])) if stop: struct_t = localtime(stop) self.stop_hour_list.select(IntegerItem(struct_t[3])) self.stop_minute_list.select(IntegerItem(struct_t[4])) return None
def _go_cvbs(self): resolution = config.cvbs_resolution[config.user_config['connections'] ['composite_output']] if self.previous_resolution != resolution: w, h, interlaced, freq = resolution log.debug('Setting resolution to %s', resolution) display = pygui_globs['display'] display.set_resolution((w, h), interlaced, freq) louie_send('connection_switched') else: log.debug('current_mode = wanted_mode = %s: nothing to do', resolution) return None
def record_selected(self): program = self.selected now = int(time()) if program.end_time > now: start_time = max(now, program.start_time) end_time = min(program.end_time, start_time + 21600) channel = program.parent chan_id = int(channel['serviceId']) favorite_name = channel.parent.name values = { 'channel': channel.name, 'title': program.name, 'date': strftime('%Y/%m/%d', localtime(start_time)), 'start_time': seconds_to_hhmm(start_time), 'end_time': seconds_to_hhmm(end_time) } record_name = EPG_RECORDING_NAME_PATTERN % values try: WyRecord().scheduler.ScheduleRecording(chan_id, start_time, end_time, record_name, program_id=program.id, favorite=favorite_name) louie_send('update_record') except SchedulerConflictWithInstantRecordError, e: louie_send('update_record', sender=None) conflicting_rec = e.conflict.getAllRecInConflict()[0] message_pattern = _( 'An instant recording on %(channel)s will be stopped when this recording starts.' ) message = message_pattern % { 'name': ellipsize(conflicting_rec.name, 40), 'start_time': seconds_to_hhmm(conflicting_rec.start_time), 'channel': conflicting_rec.service_name } title = _('Conflict with an instant recording') MessageWindow(message, title, button=None).show(timeout=5) except SchedulerConflictError, e: conflicting_rec = e.conflict.getAllRecInConflict()[0] message_pattern = _( 'The recording you are attempting to schedule conflicts with "%(name)s", starting at %(start_time)s on %(channel)s.' ) message = message_pattern % { 'name': ellipsize(conflicting_rec.name, 40), 'start_time': seconds_to_hhmm(conflicting_rec.start_time), 'channel': conflicting_rec.service_name } title = _('Recording scheduler error') MessageWindow(message, title, button=None).show(timeout=5)
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_left(self, event): if self.player.active_list == 'main_list': return True else: if self.player.get_item_list('main_list').selected.selected_pos == 0: self.player.get_item_list('main_list').selected.select(None, True) self.player.active_list = 'main_list' if self.player.selected_pos == len(self.player.get_item_list('main_list')) - 1: self.player.select(-1) else: _list = self.player.get_item_list('main_list').selected _preview_list = _list.selected.list_name if _list.select(-1): _new_list = _list.selected.list_name louie_send('on_%s_blur' % _preview_list, self.player) louie_send('on_%s_focus' % _new_list, self.player) return True
def _validate(self, win=None): if win is not None: if self.what_to_launch in (0, 2): self._password = win.text else: self._login = win.text win.hide() if self._login is not None: user_config['net']['login'] = self._login log.info("'user' param set for net services'") set_param('user', self._login) if self._password is not None: user_config['net']['password'] = self._password log.info("'pass' param set for net services'") set_param('pass', self._password) user_config.save() louie_send('refresh_root', sender='navigator') return None
def event_action_menu(self, event): w = LoadingWindow() w.show() 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='player', universe=self.player.universe) if s.get_item_list('main_list'): s.show() if not s.get_item_list('options_list'): louie_send('empty_options', sender=s) else: louie_send('not_empty_options', sender=s) w.hide() else: w.hide() self.player._error_spawner() return True
# Licenced under Academic Free License version 3.0 # Review WyGui README & LICENSE files for further details. nname: 68 n 68(None)[return ret ]: i: 51(), 67() o: nname: 67 n 67(None)[]: i: 0(f) o: 68() nname: 51 n 51(None)[louie_send('event_down', sender=self.player) ]: i: 24&40(t), 47() o: 68() nname: 47 n 47(None)[]: i: 24&40(f) o: 51() nname: 24&40 n 24&40(val < 0 and 'event_up')[]: i: 0(t) o: 47(f), 51(t) nname: 0
return GenericPlayerEventHandler.event_action_menu(self, event) ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb7622e6c>} nname: 0 n 0(None)[self.player.toggle_pause() return True ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb7622f4c>} nname: 0 n 0(None)[louie_send('event_up', self.player) self.player.select(-event.arg['count']) return True ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb762838c>} nname: 0 n 0(None)[louie_send('event_up', self.player) self.player.select(event.arg['count']) return True ]: i: o:
def event_down(self, event): louie_send('event_up', self.player)
# Review WyGui README & LICENSE files for further details. nname: 114 n 114(None)[return ret ]: i: 62(AL), 113() o: nname: 113 n 113(None)[]: i: 65(AF), 81() o: 114() nname: 81 n 81(None)[for it in self._getitems_keywords.iterkeys(): louie_send(it, sender=self, value=self[it]) ]: i: 65(for) o: 113() nname: 65 n 65(None)[]: i: 62(loop) o: 81(for), 113(AF) nname: 62 n 62(None)[]: i: 9(), 41(), 60(AE) o: 65(loop), 114(AL) nname: 60
o: 15(t), 25(f) nname: 0 n 0(None)[if self.what_to_launch == 2: pass _confirm_action = self._validate kbd = KeyboardWindow(title=_('Enter your login'), confirm_action=_confirm_action) kbd.show() ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb758e96c>} nname: 203 n 203(None)[user_config.save() louie_send('refresh_root', sender='navigator') return None ]: i: 152(), 202() o: nname: 202 n 202(None)[]: i: 137(f) o: 203() nname: 152 n 152(None)[user_config['net']['password'] = self._password log.info("'pass' param set for net services'") set_param('pass', self._password) ]:
nname: 269 n 269(None)[w.hide() self.player._error_spawner() ]: i: 112(f) o: 293() nname: 256 n 256(None)[w.hide() ]: i: 219(), 239() o: 293() nname: 239 n 239(None)[louie_send('not_empty_options', sender=s) ]: i: 193(t) o: 256() nname: 219 n 219(None)[louie_send('empty_options', sender=s) ]: i: 193(f) o: 256() nname: 193 n 193(s.get_item_list('options_list'))[s.show() ]: i: 112(t) o: 219(f), 239(t)
i: 49(JA), 62(), 168() o: nname: 168 n 168(None)[]: i: 0(f) o: 169() nname: 62 n 62(None)[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) ]: i: 24(f) o: 169() nname: 49 n 49(None)[el.edited = False ]: i: 24(t) o: 169(JA) nname: 24 n 24(el.edited)[el = play.get_item_list('edit_list') ]: i: 0(t) o: 49(t), 62(f)
nname: 0 n 0(None)[return False ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb7647c4c>} nname: 107 n 107(None)[return True ]: i: 51(), 94() o: nname: 94 n 94(None)[louie_send('rebound_down', sender=self.player) ]: i: 67&83(t), 90() o: 107() nname: 90 n 90(None)[]: i: 67&83(f) o: 94() nname: 67&83 n 67&83(val < 0 and 'rebound_up')[]: i: 0(f) o: 90(f), 94(t) nname: 51
def _exec(*args, **args): func(*args, **kw) self = args[0] louie_send('preview_list', sender=self.menu, action='reset', value=self.menu['preview_list']) louie_send('options_list', sender=self.menu, action='reset', value=self.menu['options_list'])
n 405(None)[return None ]: i: 270(), 404() o: nname: 404 n 404(None)[]: i: 151(f) o: 405() nname: 270 n 270(None)[pygui_globs['menustack'].back_one_menu() context['menu'].stop() transcode_client_set_file(output_file) item.execute() louie_send('on_user_idle', player) log.debug('transcode_start() output_file=%s' % output_file) transcode_client_start() stop_task = Task(_stop_transcode, transcode_client_stop, previous_resolution, context['selected'].player, output_file, psp_path) player.stop_transcode = stop_task.start ]: i: 255(), 269() o: 405() nname: 269 n 269(None)[]: i: 157(f) o: 270() nname: 255 n 255(None)[_set_resolution(transcode_resolution)
def refresh_net_content(context): free_cache() context['hand_menu'].hide() louie_send('refresh_root', sender='navigator')
self.nodes: {0: <unpyclib.structure.node instance at 0xb75ae6cc>} nname: 271 n 271(None)[return True ]: i: 18(), 141(JA), 161(), 214(), 270() o: nname: 270 n 270(None)[]: i: 165(f) o: 271() nname: 214 n 214(None)[_new_list = _list.selected.list_name louie_send('on_%s_blur' % _preview_list, self.player) louie_send('on_%s_focus' % _new_list, self.player) ]: i: 165(t) o: 271() nname: 165 n 165(_list.select(-1))[_list = self.player.get_item_list('main_list').selected _preview_list = _list.selected.list_name ]: i: 26(f) o: 214(t), 270(f) nname: 161 n 161(None)[]: i: 57(f)
# Changes: # # 2012-01-10 # Initial Commit # # # Copyright 2010-2012, WyDev Team. # Author: Polo35 ([email protected]) # # Licenced under Academic Free License version 3.0 # Review WyGui README & LICENSE files for further details. nname: 0 n 0(None)[func(*args, **kw) self = args[0] louie_send('preview_list', sender=self.menu, action='reset', value=self.menu['preview_list']) louie_send('options_list', sender=self.menu, action='reset', value=self.menu['options_list']) ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb75a586c>} nname: 0 n 0(None)[def _exec(*args, **args): func(*args, **kw) self = args[0] louie_send('preview_list', sender=self.menu, action='reset', value=self.menu['preview_list']) louie_send('options_list', sender=self.menu, action='reset', value=self.menu['options_list']) return _exec ]:
def reset_view(self): menu = self.menu if menu: for name in self.list_owned: louie_send(name, sender=menu, action='reset', value=menu[name])
def event_down(self, event): louie_send('event_up', self.player) self.player.select(event.arg['count']) return True
self.nodes: {0: <unpyclib.structure.node instance at 0xb76a168c>, 733: <unpyclib.structure.node instance at 0xb76a612c>, 387: <unpyclib.structure.node instance at 0xb76b070c>, 12: <unpyclib.structure.node instance at 0xb76a9f8c>, 400: <unpyclib.structure.node instance at 0xb76b078c>, 660: <unpyclib.structure.node instance at 0xb76b0e8c>, 156: <unpyclib.structure.node instance at 0xb76a1c8c>, 414: <unpyclib.structure.node instance at 0xb76b080c>, 673: <unpyclib.structure.node instance at 0xb76a9b4c>, 806: <unpyclib.structure.node instance at 0xb76a622c>, 169: <unpyclib.structure.node instance at 0xb76a906c>, 427: <unpyclib.structure.node instance at 0xb76b088c>, 307: <unpyclib.structure.node instance at 0xb76c118c>, 565: <unpyclib.structure.node instance at 0xb76b0c0c>, 823: <unpyclib.structure.node instance at 0xb76a62ac>, 60: <unpyclib.structure.node instance at 0xb76a190c>, 320: <unpyclib.structure.node instance at 0xb76a904c>, 833: <unpyclib.structure.node instance at 0xb76a908c>, 73: <unpyclib.structure.node instance at 0xb76a9cac>, '500&527': <unpyclib.structure.node instance at 0xb76a966c>, 221: <unpyclib.structure.node instance at 0xb76a1f0c>, 911: <unpyclib.structure.node instance at 0xb76a66ac>, 487: <unpyclib.structure.node instance at 0xb76b090c>, 234: <unpyclib.structure.node instance at 0xb76a9b0c>, '578&588': <unpyclib.structure.node instance at 0xb76a938c>, 746: <unpyclib.structure.node instance at 0xb76a61ac>} nname: 0 n 0(None)[Item.__init__(self, name=get_field(item, field), type_='info') self.item = item self.title = title self.field = field self.editable = editable ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb76a9fac>} nname: 126 n 126(None)[kbd.hide() louie_send('main_list', sender=self.menu, action='reset', value=self.menu['main_list'], position=self.menu.selected_pos) ]: i: 90(), 117() o: nname: 90 n 90(None)[log.debug('setting ParentalRating failed ') PRINT_EXCEPTION() ]: i: 0(except) o: 126() nname: 117 n 117(None)[self.name = new_value ]: i: 86(), 116(AE) o: 126()
i: 15(AL), 67(), 71() o: nname: 71 n 71(None)[]: i: 0(f) o: 72() nname: 67 n 67(None)[]: i: 19(AF), 29() o: 72() nname: 29 n 29(None)[for name in self.list_owned: louie_send(name, sender=menu, action='reset', value=menu[name]) ]: i: 19(for) o: 67() nname: 19 n 19(None)[]: i: 15(loop) o: 29(for), 67(AF) nname: 15 n 15(None)[]: i: 0(t) o: 19(loop), 72(AL) nname: 0