def browse(self, preview=False): win = LoadingWindow() win.show() try: self._content = [] userfeed = PicasaGData.GetUserFeed(user=self.username) for album in userfeed.entry: self._content.append( PicasaAlbumContainer( name=album.title.text, username=self.username, gphoto_id=album.gphoto_id.text, parent=self, menu=self.menu, thumbnail=album.media.thumbnail[0].url)) except: PRINT_EXCEPTION() win.hide() return self._content
def _next_item(self): send('on_scroll', sender=self) vals = [] l = None try: while True: l = self.fd.readline() if not l or l == '\\n\n': break vals.append(l) except: PRINT_EXCEPTION() self.hide() txt = ''.join(vals) if not txt: self.hide() else: Task(send, 'full_text', sender=self, value=txt).start(1) return None
def browse(self, preview=False): win = LoadingWindow() win.show() try: self._content = [] for photo in PicasaGData.GetFeed( '/data/feed/api/user/%s/albumid/%s?kind=photo' % (self.username, self.gphoto_id)).entry: self._content.append( ImageItem(photo.title.text, thumbnail=photo.media.thumbnail[0].url, uri=photo.content.src, backend='dummy', parent=self, menu=self.menu)) except: PRINT_EXCEPTION() win.hide() return self._content
def _InfoItem__do_update(kbd): new_value = kbd._text try: if self.item['refid']: kw = {self.field: new_value} self.item.vfs_set_metas(_unref_link=True, **kw) else: self.item[self.field] = new_value except: log.debug('setting ParentalRating failed ') PRINT_EXCEPTION() else: self.name = new_value kbd.hide() louie_send('main_list', sender=self.menu, action='reset', value=self.menu['main_list'], position=self.menu.selected_pos)
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] except ValueError: idx = mirror_speeds.index(sm) if idx == 0: self.player.speed = reference_speed else: _idx = max(idx - 1, 0) self.player.speed = mirror_speeds[_idx] except Exception, e: PRINT_EXCEPTION(e)
def __init__(self, periodic_rule, type_='periodic_schedule', menu=None, display_type=None): self.periodic_rule = periodic_rule self.period = PERIODICITY[periodic_rule.extern_rule_name] all_records = _wyrec.scheduler.recording_list.GetPeriodicRecordingListByRule( periodic_rule.id) now = time() self.remaining_records = [ i for i in all_records if i.start_time >= now ] try: ScheduledRecordItem.__init__(self, self.remaining_records[0], type_, menu, display_type) except: PRINT_EXCEPTION() return None
def browse(self, preview=False): if self._content is None or TF1Replay_Data.must_be_refresh(): win = LoadingWindow() win.show() self._content = [] try: product = TF1Replay_Data.get_products(self.web_path) if product is not None: self._content = [ TF1ReplayProduct(product['title'], product['url_path'], parent=self, menu=self.menu, **product) ] except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): win = LoadingWindow() win.show() try: self._content = [] PicasaGData.ClientLogin(self.email, self.password) for album in PicasaGData.GetUserFeed(user='******').entry: self._content.append( PicasaAlbumContainer( name=album.title.text, username='******', gphoto_id=album.gphoto_id.text, parent=self, menu=self.menu, thumbnail=album.media.thumbnail[0].url)) except: PRINT_EXCEPTION() win.hide() return self._content
def browse(self, preview=False): if self._content is None or Youtube_GData.must_be_refresh(): win = LoadingWindow() win.show() self._content = [] try: self._content = [ YouTubeSubContainer( playlist['title'], (lambda playlist_id=playlist['id']: Youtube_GData. parse_playlist(id=playlist_id)), parent=self, menu=self.menu, thumbnail=playlist['thumbnail']) for playlist in self.list_fn() ] except: PRINT_EXCEPTION() win.hide() return self._content
def _select_option(self, *args, **kw): get_it = self.menu.get_item_list result = [ str(get_it(choices).selected.kwargs.get('chosen_value', None)) for choices in self.menu.available_choices if hasattr(get_it(choices).selected, 'kwargs') and get_it(choices).selected is not None ] try: config.user_config[self.domain][self.key] = ''.join(result) config.user_config.save() except: pass if hasattr(self, 'execute_action'): try: self.execute_action(result) except: PRINT_EXCEPTION() self.menu._set_options_list(self, keep_selection=True) return None
def _root_getter(self): if not self.parameters_items: glob = globals() loc = locals() for pname in sorted(plugins.get('parameters')): pname = pname.split('.', 1)[1] try: _mod = __import__('pygui.item.parameters.' + pname, glob, loc, ['items'], level=0) item = _mod.getitem(self) if item is not None: menu, arg = _submenus_dict[pname]() menu.related_item = item self.parameters_menus.append(menu) self.parameters_items.append(item) self.parameters_args.append(arg) log.debug('pygui.item.parameters.%s loaded' % pname) except Exception, e: PRINT_EXCEPTION(e)
def get_active_configuration(self): try: for config in self.pynet.getConfigurations(): params = self.pynet.getConfiguration(config) if params[0]: if params[3] == 'upnp': infos = self._get_network_infos(params[1]) params[4] = infos['ip'] params[5] = infos['netmask'] params[6] = infos['gateway'] params[7] = infos['dns1'] params[8] = infos['dns2'] return { 'config': config, 'values': dict(((key, params[PY_RANK_PARAMS[key]]) for key in PY_RANK_PARAMS)) } except Exception, e: PRINT_EXCEPTION(e)
def create(self, node, menu, parent=None, animations=None): if not hasattr(self.objectFactory, node.tag): log.error('object %s does not appear in readable objects list', node.tag) return None creator = getattr(self.objectFactory, node.tag)(att=node.attrib) obj = creator.add_child(node, parent) if animations is None: animations = [] for subnode in node: if subnode.tag == 'animation': try: animation = ObjectCreator.animation_creator.create(subnode, obj) louie_connect(receiver=animation.play, signal=animation.event, sender=menu) animations.append(animation) except: PRINT_EXCEPTION() log.debug('animation %s : %s has no correspondance' % (subnode.tag, subnode.attrib)) else: self.create(subnode, menu, obj, animations) creator.specify(node, obj) if parent is None: obj._animations = animations return obj
def rate(self, age): self._update_checked(age) self.name = self.actions_dict[age]['caption'] self.menu._set_options_list(keep_selection=True) try: if isinstance(self.item, DirItem): w = LoadingWindow() w.show() ml = Markerlist(self.item.universe, 'rate') ml.add_item(self.item) ml['maturity_rating'] = age w.hide() ml.clear() else: if self.item['refid']: self.item.vfs_set_metas(_unref_link=True, maturity_rating=age) else: self.item['maturity_rating'] = age except: log.debug('setting %s[maturity_rating] failed ', self.item) PRINT_EXCEPTION() return None
def set_subs_size(self, size): # Try to find "subtitles" textblock widget if not already done if self.subtitles_textblock is None: self.subtitles_textblock = self.search_subtitles_widget() # "subtitles" textblock widget is located, update it if self.subtitles_textblock is not None: try: def sub_style(attr): return attr.group('start') + str(size) + attr.group('end') new_style = re.sub( r'(?P<start>.*font_size=)(?P<size>\d+)(?P<end>.*)', sub_style, self.subtitles_textblock._style) self.subtitles_textblock._style = new_style self.subtitles_textblock.resize(height='%i%%' % (19 + size / 3)) self.subtitles_textblock.refresh_text() except Exception, e: PRINT_EXCEPTION(e) else: config.user_config['video'][ 'subtitles_size'] = self.cur_subs_size Task(config.user_config.save).start(1)
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 n 60(None)[]: i: 31(f) o: 62(AE) nname: 41 n 41(None)[#, e PRINT_EXCEPTION(e) ]: i: 31(t) o: 62() nname: 31 n 31(<dummy_ex3> EXC_MATCH Exception)[]: i: 0(except) o: 41(t), 60(f) nname: 9 n 9(None)[ret = fn(self, *args, **kw) ]: i: 0(try) o: 62()
nname: 834 n 834(None)[from pygui.menu.players.image_viewer import ImageViewer ]: i: 745(), 788(), 832(AE) o: 853(try), 886(except) nname: 832 n 832(None)[]: i: 778(f) o: 834(AE) nname: 788 n 788(None)[#, e DVDPlayer = None PRINT_EXCEPTION() log.error('DVD Player loading error: %s', str(e)) ]: i: 778(t) o: 834() nname: 778 n 778(<dummy_ex3> EXC_MATCH Exception)[]: i: 742(except) o: 788(t), 832(f) nname: 745 n 745(None)[from pygui.menu.players.dvd_player import DVDPlayer log.debug('DVD Player loaded') ]: i: 742(try)
else: play.get_item_list('edit_list').edited = True return True ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0xb770132c>} nname: 254 n 254(None)[return True ]: i: 139(), 184(JA), 200(), 239(), 253(AE) o: nname: 239 n 239(None)[PRINT_EXCEPTION() ]: i: 143(f) o: 254() nname: 200 n 200(None)[_idx = max(idx - 1, 0) self.player.speed = mirror_speeds[_idx] ]: i: 153(f) o: 254() nname: 184 n 184(None)[self.player.speed = reference_speed ]: i: 153(t)
self.nodes: {0: <unpyclib.structure.node instance at 0x8faceec>} nname: 0 n 0(None)[return int(100 + (val - self.max_val) * 0.00152587890625) ]: i: o: self.nodes: {0: <unpyclib.structure.node instance at 0x8fac6ec>} nname: 409 n 409(None)[return None ]: i: 391(), 395(), 408(AE) o: nname: 395 n 395(None)[PRINT_EXCEPTION() ]: i: 0(except) o: 409() nname: 391 n 391(None)[]: i: 192(JA), 236(), 357(JA), 377(), 390() o: 409() nname: 390 n 390(None)[]: i: 334(f) o: 391() nname: 377
def execute(self): items = self.parent.browse() try: self.player.play(self, items) except Exception, e: PRINT_EXCEPTION(e)
def get_ip_address(self): try: ip = inet_ntoa(pack('!I', ntohl(call(self._getIP4Address)))) except Exception, e: PRINT_EXCEPTION(e) ip = None
def event_select(self, event): try: return MenuEventHandler.event_select(self, event, list_name=None) except Exception, e: PRINT_EXCEPTION(e)
def execute(self, delay=0): if self['backend'] != 'upnp': try: self.player.play(self, playlist=None, delay=delay) except Exception, e: PRINT_EXCEPTION(e)
nname: 570 n 570(None)[pygui_globs['screensaver'] = saver ]: i: 406(finally), 566() o: 581(AE) nname: 566 n 566(None)[]: i: 510(), 533(), 565(AE) o: 570() nname: 533 n 533(None)[saver = None log.error('Failed to load screensaver!') PRINT_EXCEPTION() ]: i: 409(except) o: 566() nname: 510 n 510(None)[saver = screensaver_dict[type](threshold=threshold) ]: i: 476(), 489(), 509(AE) o: 566() nname: 489 n 489(None)[threshold = user_config['power']['screensaver_threshold'] ]: i: 412(except) o: 510()
def set_configuration(self, config, new_params): config = PYNET_DEVICE[config] try: old_params = self.get_configuration_by_name(config) except Exception, e: PRINT_EXCEPTION(e)
o: 198() nname: 149 n 149(None)[self.hide() ]: i: 128(f) o: 198() nname: 128 n 128(txt)[txt = ''.join(vals) ]: i: 100(), 104(), 127(AE) o: 149(f), 163(t) nname: 104 n 104(None)[PRINT_EXCEPTION() self.hide() ]: i: 0(except) o: 128() nname: 100 n 100(None)[]: i: 31(AL), 98() o: 128() nname: 98 n 98(None)[]: i: 34(f), 82() o: 100()
def _do_updates(self, *args, **args): ret = None try: ret = fn(self, *args, **kw) except Exception, e: PRINT_EXCEPTION(e)
nname: 199 n 199(None)[MessageWindow(text=_('Operation not permitted'), title=_('Error')).show(timeout=5) ]: i: 124(f) o: 248() nname: 152 n 152(None)[BigMessageWindow(text=_('The way this disk was formatted does not allow this operation'), title=_('Error')).show(timeout=5) ]: i: 124(t) o: 248(JA) nname: 124 n 124(e.message == 'NOT_SUPPORTED_BY_FS')[#, e PRINT_EXCEPTION() ]: i: 113(t) o: 152(t), 199(f) nname: 113 n 113(<dummy_ex3> EXC_MATCH NotPermittedError)[]: i: 42(f) o: 124(t), 246(f) nname: 52 n 52(None)[PRINT_EXCEPTION() MessageWindow(text=_('Error removing %s') % 'markerlist', title=_('Error')).show(timeout=5) ]: i: 42(t) o: 248()
def execute(self): self['uri'] = self.parse_pls() try: self.player.play(self) except Exception, e: PRINT_EXCEPTION(e)
o: self.nodes: {6: <unpyclib.structure.node instance at 0xb76dad2c>} nname: 217 n 217(None)[]: i: 173(), 196(), 215(AE) o: nname: 215 n 215(None)[]: i: 186(f) o: 217(AE) nname: 196 n 196(None)[#, e PRINT_EXCEPTION(e) ]: i: 186(t) o: 217() nname: 186 n 186(<dummy_ex3> EXC_MATCH AttributeError)[]: i: 0(except) o: 196(t), 215(f) nname: 173 n 173(None)[del _[1] for self.preview_list in choices_list: ]: i: 49(AF), 142() o: 217()