function
stringlengths
11
56k
repo_name
stringlengths
5
60
features
list
def provides_biblio(self): return True
Impactstory/total-impact-core
[ 55, 7, 55, 20, 1330896831 ]
def biblio(self, aliases, provider_url_template=None, cache_enabled=True): linkedin_url = self.get_best_id(aliases) biblio_dict = {} biblio_dict["repository"] = "LinkedIn" biblio_dict["is_account"] = True # special key to tell webapp to render as genre heading biblio_dict["genre"] = "account" biblio_dict["account"] = linkedin_url try: r = requests.get(linkedin_url, timeout=20) except requests.exceptions.Timeout: return None soup = BeautifulSoup(r.text) try: bio = soup.find("p", {'class': "description"}).get_text() #because class is reserved biblio_dict["bio"] = bio except AttributeError: logger.warning("AttributeError in linkedin") logger.warning(r.text) return biblio_dict
Impactstory/total-impact-core
[ 55, 7, 55, 20, 1330896831 ]
def create(kernel): result = Intangible() result.template = "object/draft_schematic/armor/shared_armor_segment_ubese_advanced.iff" result.attribute_template_id = -1 result.stfName("string_id_table","")
anhstudios/swganh
[ 62, 37, 62, 37, 1297996365 ]
def test_job_statuses_for_jobs(started_conversion_job, failed_conversion_job, finished_conversion_job): assert started_conversion_job.status == status.STARTED assert failed_conversion_job.status == status.FAILED assert finished_conversion_job.status == status.FINISHED
geometalab/osmaxx
[ 27, 4, 27, 84, 1420751134 ]
def test_job_removes_file_when_deleted(finished_conversion_job): assert finished_conversion_job.status == status.FINISHED file_path = finished_conversion_job.resulting_file.path assert file_path is not None assert os.path.exists(file_path) finished_conversion_job.delete() assert not os.path.exists(file_path)
geometalab/osmaxx
[ 27, 4, 27, 84, 1420751134 ]
def test_job_get_absolute_file_path_is_available_when_file_is_available(finished_conversion_job): assert finished_conversion_job.get_absolute_file_path.startswith('/') assert finished_conversion_job.resulting_file.path == finished_conversion_job.get_absolute_file_path
geometalab/osmaxx
[ 27, 4, 27, 84, 1420751134 ]
def __new__(meta, name, bases, dct): klass = type.__new__(meta, name, bases, dct) # This class need to implement a real role to be load if klass.implement: # When creating the class, we need to look at the module where it is. It will be create like this (in modulemanager) # module___global___windows___collector_iis ==> level=global pack_name=windows, collector_name=collector_iis from_module = dct['__module__'] elts = from_module.split('___') # Let the klass know it klass.pack_level = elts[1] klass.pack_name = elts[2] meta.__inheritors__.add(klass) return klass
naparuba/kunai
[ 37, 6, 37, 56, 1424895275 ]
def get_sub_class(cls): return cls.__inheritors__
naparuba/kunai
[ 37, 6, 37, 56, 1424895275 ]
def __init__(self): ParameterBasedType.__init__(self)
naparuba/kunai
[ 37, 6, 37, 56, 1424895275 ]
def get_info(self): return {'configuration': self.get_config(), 'state': 'DISABLED', 'log': ''}
naparuba/kunai
[ 37, 6, 37, 56, 1424895275 ]
def prepare(self): return
naparuba/kunai
[ 37, 6, 37, 56, 1424895275 ]
def launch(self): return
naparuba/kunai
[ 37, 6, 37, 56, 1424895275 ]
def export_http(self): return
naparuba/kunai
[ 37, 6, 37, 56, 1424895275 ]
def stopping_agent(self): pass
naparuba/kunai
[ 37, 6, 37, 56, 1424895275 ]
def setUp(self): # Construct with mocked _send_restyle_msg method self.figure = go.Figure( data=[ go.Scatter(), go.Bar(), go.Parcoords(dimensions=[{}, {"label": "dim 2"}, {}]), ] ) # Mock out the message method self.figure._send_restyle_msg = MagicMock()
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def test_property_assignment_nested(self): # Set scatter marker color self.figure.data[0].marker.color = "green" self.figure._send_restyle_msg.assert_called_once_with( {"marker.color": ["green"]}, trace_indexes=0 )
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def test_plotly_restyle_toplevel(self): # Set bar marker self.figure.plotly_restyle({"marker": {"color": "green"}}, trace_indexes=1) self.figure._send_restyle_msg.assert_called_once_with( {"marker": {"color": "green"}}, trace_indexes=[1] )
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def test_plotly_restyle_nested_array(self): # Set parcoords dimension self.figure.plotly_restyle({"dimensions[0].label": "dim 1"}, trace_indexes=2) self.figure._send_restyle_msg.assert_called_once_with( {"dimensions[0].label": "dim 1"}, trace_indexes=[2] )
plotly/python-api
[ 13052, 2308, 13052, 1319, 1385013188 ]
def __init__(self, dispatcher, client, key): self.dispatcher = dispatcher self.client = client self.key = key
mochi/udplog
[ 9, 6, 9, 1, 1379967651 ]
def stopService(self): self.dispatcher.unregister(self.sendEvent) service.Service.stopService(self)
mochi/udplog
[ 9, 6, 9, 1, 1379967651 ]
def __init__(self, factories): """ Initialize. @param factories: Client factories. @type factories: C{list} of L{RedisClientFactory}. """ self.factories = set(factories)
mochi/udplog
[ 9, 6, 9, 1, 1379967651 ]
def _disconnected(self, factory): """ Called when the connection for this factory is gone. """ self.factories.remove(factory) factory.deferred.addCallback(lambda _: self._reconnected(factory))
mochi/udplog
[ 9, 6, 9, 1, 1379967651 ]
def eb(failure): failure.trap(RuntimeError) if failure.value.args == ("Not connected",): self._disconnected(factory) return self.lpush(key, *values, **kwargs) else: return failure
mochi/udplog
[ 9, 6, 9, 1, 1379967651 ]
def __init__(self, observer, observable): super(AnonymousSubject, self).__init__() self.observer = observer self.observable = observable
Sprytile/Sprytile
[ 955, 75, 955, 61, 1477734429 ]
def on_completed(self): self.observer.on_completed()
Sprytile/Sprytile
[ 955, 75, 955, 61, 1477734429 ]
def __init__(self, _tagLst, _attrName, _attrVal, _data): self.tagList = _tagLst self.attrName = _attrName self.attrVal = _attrVal self.dataToCheck = _data self.status_baseline = False self.status_superior = False self.status_exemplary = False self.__assistant = JudgeAssistant.JudgeAssistant()
KhronosGroup/COLLADA-CTS
[ 30, 9, 30, 11, 1336571488 ]
def JudgeBaseline(self, context): # No step should not crash self.__assistant.CheckCrashes(context)
KhronosGroup/COLLADA-CTS
[ 30, 9, 30, 11, 1336571488 ]
def JudgeSuperior(self, context): # if baseline fails, no point in further checking if (self.status_baseline == False): self.status_superior = self.status_baseline return self.status_superior
KhronosGroup/COLLADA-CTS
[ 30, 9, 30, 11, 1336571488 ]
def JudgeExemplary(self, context): self.status_exemplary = self.status_superior return self.status_exemplary
KhronosGroup/COLLADA-CTS
[ 30, 9, 30, 11, 1336571488 ]
def __init__(self): super().__init__() self.num_nodes = 1
xieta/mincoin
[ 4, 2, 4, 1, 1505610830 ]
def get_tests(self): if self.tip is None: self.tip = int("0x" + self.nodes[0].getbestblockhash(), 0) self.block_time = int(time.time())+1 ''' Create a new block with an anyone-can-spend coinbase ''' height = 1 block = create_block(self.tip, create_coinbase(height), self.block_time) self.block_time += 1 block.solve() # Save the coinbase for later self.block1 = block self.tip = block.sha256 height += 1 yield TestInstance([[block, True]]) ''' Now we need that block to mature so we can spend the coinbase. ''' test = TestInstance(sync_every_block=False) for i in range(100): block = create_block(self.tip, create_coinbase(height), self.block_time) block.solve() self.tip = block.sha256 self.block_time += 1 test.blocks_and_transactions.append([block, True]) height += 1 yield test ''' Now we use merkle-root malleability to generate an invalid block with same blockheader. Manufacture a block with 3 transactions (coinbase, spend of prior coinbase, spend of that spend). Duplicate the 3rd transaction to leave merkle root and blockheader unchanged but invalidate the block. ''' block2 = create_block(self.tip, create_coinbase(height), self.block_time) self.block_time += 1 # b'0x51' is OP_TRUE tx1 = create_transaction(self.block1.vtx[0], 0, b'\x51', 50 * COIN) tx2 = create_transaction(tx1, 0, b'\x51', 50 * COIN) block2.vtx.extend([tx1, tx2]) block2.hashMerkleRoot = block2.calc_merkle_root() block2.rehash() block2.solve() orig_hash = block2.sha256 block2_orig = copy.deepcopy(block2) # Mutate block 2 block2.vtx.append(tx2) assert_equal(block2.hashMerkleRoot, block2.calc_merkle_root()) assert_equal(orig_hash, block2.rehash()) assert(block2_orig.vtx != block2.vtx) self.tip = block2.sha256 yield TestInstance([[block2, RejectResult(16, b'bad-txns-duplicate')], [block2_orig, True]]) height += 1 ''' Make sure that a totally screwed up block is not valid. ''' block3 = create_block(self.tip, create_coinbase(height), self.block_time) self.block_time += 1 block3.vtx[0].vout[0].nValue = 1000 * COIN # Too high! block3.vtx[0].sha256=None block3.vtx[0].calc_sha256() block3.hashMerkleRoot = block3.calc_merkle_root() block3.rehash() block3.solve() yield TestInstance([[block3, RejectResult(16, b'bad-cb-amount')]])
xieta/mincoin
[ 4, 2, 4, 1, 1505610830 ]
def __init__(self): super(BandcampPlugin, self).__init__() self.config.add({ 'source_weight': 0.5, 'min_candidates': 5, 'lyrics': False, 'art': False, 'split_artist_title': False }) self.import_stages = [self.imported] self.register_listener('pluginload', self.loaded)
ageorge/beets-bandcamp
[ 56, 17, 56, 4, 1434935409 ]
def album_distance(self, items, album_info, mapping): """Returns the album distance. """ dist = Distance() if hasattr(album_info, 'data_source') and album_info.data_source == 'bandcamp': dist.add('source', self.config['source_weight'].as_number()) return dist
ageorge/beets-bandcamp
[ 56, 17, 56, 4, 1434935409 ]
def album_for_id(self, album_id): """Fetches an album by its bandcamp ID and returns an AlbumInfo object or None if the album is not found. """ # We use album url as id, so we just need to fetch and parse the # album page. url = album_id return self.get_album_info(url)
ageorge/beets-bandcamp
[ 56, 17, 56, 4, 1434935409 ]
def track_for_id(self, track_id): """Fetches a track by its bandcamp ID and returns a TrackInfo object or None if the track is not found. """ url = track_id return self.get_track_info(url)
ageorge/beets-bandcamp
[ 56, 17, 56, 4, 1434935409 ]
def get_albums(self, query): """Returns a list of AlbumInfo objects for a bandcamp search query. """ albums = [] for url in self._search(query, BANDCAMP_ALBUM): album = self.get_album_info(url) if album is not None: albums.append(album) return albums
ageorge/beets-bandcamp
[ 56, 17, 56, 4, 1434935409 ]
def get_tracks(self, query): """Returns a list of TrackInfo objects for a bandcamp search query. """ track_urls = self._search(query, BANDCAMP_TRACK) return [self.get_track_info(url) for url in track_urls]
ageorge/beets-bandcamp
[ 56, 17, 56, 4, 1434935409 ]
def add_lyrics(self, item, write = False): """Fetch and store lyrics for a single item. If ``write``, then the lyrics will also be written to the file itself.""" # Skip if the item already has lyrics. if item.lyrics: self._log.info('lyrics already present: {0}', item) return lyrics = self.get_item_lyrics(item) if lyrics: self._log.info('fetched lyrics: {0}', item) else: self._log.info('lyrics not found: {0}', item) return item.lyrics = lyrics if write: item.try_write() item.store()
ageorge/beets-bandcamp
[ 56, 17, 56, 4, 1434935409 ]
def _search(self, query, search_type=BANDCAMP_ALBUM, page=1): """Returns a list of bandcamp urls for items of type search_type matching the query. """ if search_type not in [BANDCAMP_ARTIST, BANDCAMP_ALBUM, BANDCAMP_TRACK]: self._log.debug('Invalid type for search: {0}'.format(search_type)) return None try: urls = [] # Search bandcamp until min_candidates results have been found or # we hit the last page in the results. while len(urls) < self.config['min_candidates'].as_number(): self._log.debug('Searching {}, page {}'.format(search_type, page)) results = self._get(BANDCAMP_SEARCH.format(query=query, page=page)) clazz = 'searchresult {0}'.format(search_type) for result in results.find_all('li', attrs={'class': clazz}): a = result.find(attrs={'class': 'heading'}).a if a is not None: urls.append(a['href'].split('?')[0]) # Stop searching if we are on the last page. if not results.find('a', attrs={'class': 'next'}): break page += 1 return urls except requests.exceptions.RequestException as e: self._log.debug("Communication error while searching page {0} for {1!r}: " "{2}".format(page, query, e)) return []
ageorge/beets-bandcamp
[ 56, 17, 56, 4, 1434935409 ]
def _parse_album_track(self, track_html): """Returns a TrackInfo derived from the html describing a track in a bandcamp album page. """ track_num = track_html['rel'].split('=')[1] track_num = int(track_num) title_html = track_html.find(attrs={'class': 'title-col'}) title = title_html.find(attrs={'itemprop': 'name'}).text.strip() artist = None if self.config['split_artist_title']: artist, title = self._split_artist_title(title) track_url = title_html.find(attrs={'itemprop': 'url'}) if track_url is None: raise BandcampException('No track url (id) for track {0} - {1}'.format(track_num, title)) track_id = track_url['href'] try: duration = title_html.find('meta', attrs={'itemprop': 'duration'})['content'] duration = duration.replace('P', 'PT') track_length = isodate.parse_duration(duration).total_seconds() except TypeError: track_length = None return TrackInfo(title, track_id, index=track_num, length=track_length, artist=artist)
ageorge/beets-bandcamp
[ 56, 17, 56, 4, 1434935409 ]
def get(self, album, plugin, paths): """Return the url for the cover from the bandcamp album page. This only returns cover art urls for bandcamp albums (by id). """ if isinstance(album.mb_albumid, six.string_types) and 'bandcamp' in album.mb_albumid: try: headers = {'User-Agent': USER_AGENT} r = requests.get(album.mb_albumid, headers=headers) r.raise_for_status() album_html = BeautifulSoup(r.text, 'html.parser').find(id='tralbumArt') image_url = album_html.find('a', attrs={'class': 'popupImage'})['href'] yield self._candidate(url=image_url, match=fetchart.Candidate.MATCH_EXACT) except requests.exceptions.RequestException as e: self._log.debug("Communication error getting art for {0}: {1}" .format(album, e)) except ValueError: pass
ageorge/beets-bandcamp
[ 56, 17, 56, 4, 1434935409 ]
def create(kernel): result = Static() result.template = "object/static/structure/general/shared_prp_junk_s4.iff" result.attribute_template_id = -1 result.stfName("obj_n","unknown_object")
anhstudios/swganh
[ 62, 37, 62, 37, 1297996365 ]
def __init__(self, mainFrame): super(AboutDialog, self).__init__(mainFrame) self._mainFrame = mainFrame self.setWindowTitle(self._mainFrame._("About {name}").format(name=self._mainFrame.NAME)) self._setupUI()
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def _setupUI(self): label = ClickableQLabel() label.setPixmap(QtGui.QPixmap(":/images/snakefire-big.png")) label.setAlignment(QtCore.Qt.AlignCenter) self.connect(label, QtCore.SIGNAL("clicked()"), self._website) urlLabel = QtGui.QLabel("<a href=\"http://{url}\">{name}</a>".format( url=self._mainFrame.DOMAIN, name=self._mainFrame.DOMAIN )) urlLabel.setOpenExternalLinks(True) websiteBox = QtGui.QHBoxLayout() websiteBox.addWidget(QtGui.QLabel(self._mainFrame._("Website:"))) websiteBox.addWidget(urlLabel) websiteBox.addStretch(1) twitterLabel = QtGui.QLabel("<a href=\"http://twitter.com/snakefirelinux\">@snakefirelinux</a>") twitterLabel.setOpenExternalLinks(True) twitterBox = QtGui.QHBoxLayout() twitterBox.addWidget(QtGui.QLabel(self._mainFrame._("Twitter:"))) twitterBox.addWidget(twitterLabel) twitterBox.addStretch(1) layout = QtGui.QVBoxLayout() layout.addWidget(label) layout.addStretch(0.5) layout.addWidget(QtGui.QLabel("<strong>{name} v{version}</strong>".format( name=self._mainFrame.NAME, version=self._mainFrame.VERSION ))) layout.addStretch(0.5) layout.addLayout(websiteBox) layout.addLayout(twitterBox) # Buttons self._okButton = QtGui.QPushButton(self._mainFrame._("&OK"), self) self.connect(self._okButton, QtCore.SIGNAL('clicked()'), self.close) # Main layout hbox = QtGui.QHBoxLayout() hbox.addStretch(1) hbox.addWidget(self._okButton) vbox = QtGui.QVBoxLayout() vbox.addLayout(layout) vbox.addLayout(hbox) self.setLayout(vbox)
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def __init__(self, mainFrame): super(AlertsDialog, self).__init__(mainFrame) self._mainFrame = mainFrame self.setWindowTitle(self._mainFrame._("Alerts")) self._setupUI()
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def cancel(self): self.close()
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def delete(self, row): self._table.removeRow(row) self.validate()
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def _save(self): matches = [] for i in range(self._table.rowCount()): matches.append({ 'match': str(self._table.item(i, 0).text().trimmed()), 'regex': self._table.cellWidget(i, 1).isChecked() }) self._mainFrame.setSettings("matches", matches) alertsSettings = { "notify_ping": self._notifyOnPingField.isChecked(), "notify_inactive_tab": self._notifyOnInactiveTabField.isChecked(), "notify_blink": self._notifyBlinkField.isChecked(), "notify_notify": self._notifyNotifyField.isChecked() } self._mainFrame.setSettings("alerts", alertsSettings)
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def __init__(self, mainFrame): super(OptionsDialog, self).__init__(mainFrame) self._mainFrame = mainFrame self.setWindowTitle(self._mainFrame._("Settings")) self._setupUI()
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def cancel(self): self.close()
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def _save(self): (themeSize, themeSizeOk) = self._themeSizeField.itemData(self._themeSizeField.currentIndex()).toInt() (awayTime, awayTimeOk) = self._awayTimeField.itemData(self._awayTimeField.currentIndex()).toInt() (awayTimeBetweenMessages, awayTimeBetweenMessagesOk) = self._awayTimeBetweenMessagesField.itemData(self._awayTimeBetweenMessagesField.currentIndex()).toInt() connectionSettings = { "subdomain": str(self._subdomainField.text().trimmed()), "user": str(self._usernameField.text().trimmed()), "password": str(self._passwordField.text()), "ssl": self._sslField.isChecked(), "connect": self._connectField.isChecked(), "join": self._joinField.isChecked() } programSettings = { "minimize": self._minimizeField.isChecked(), "spell_language": self._spellLanguageField.itemData(self._spellLanguageField.currentIndex()).toString(), "away": self._awayField.isChecked(), "away_time": awayTime if awayTimeOk else 10, "away_time_between_messages": awayTimeBetweenMessages if awayTimeBetweenMessagesOk else 5, "away_message": str(self._awayMessageField.text().trimmed()) } displaySettings = { "theme": self._themeField.itemData(self._themeField.currentIndex()).toString(), "size": themeSize if themeSizeOk else 100, "show_join_message": self._showJoinMessageField.isChecked(), "show_part_message": self._showPartMessageField.isChecked(), "show_message_timestamps": self._showMessageTimestampsField.isChecked(), } self._mainFrame.setSettings("connection", connectionSettings) self._mainFrame.setSettings("program", programSettings) self._mainFrame.setSettings("display", displaySettings)
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def _themeSizeSelected(self): (value, ok) = self._themeSizeField.itemData(self._themeSizeField.currentIndex()).toInt() if ok: self._themePreview.setTextSizeMultiplier(round(float(value) / 100, 1))
mariano/snakefire
[ 100, 24, 100, 28, 1283111981 ]
def create(kernel): result = Creature() result.template = "object/mobile/shared_dressed_rebel_brigadier_general_rodian_female_01.iff" result.attribute_template_id = 9 result.stfName("npc_name","rodian_base_female")
anhstudios/swganh
[ 62, 37, 62, 37, 1297996365 ]
def create(kernel): result = Tangible() result.template = "object/tangible/wearables/backpack/shared_backpack_s01.iff" result.attribute_template_id = 11 result.stfName("wearables_name","backpack_s01")
anhstudios/swganh
[ 62, 37, 62, 37, 1297996365 ]
def test_isidentifier(): assert isidentifier('abc') assert not isidentifier('<') assert not isidentifier('') if IS_PY2: # Py3 accepts unicode identifiers assert not isidentifier('áéíóú') else: assert isidentifier('áéíóú')
fabioz/PyDev.Debugger
[ 362, 102, 362, 75, 1405447272 ]
def start(address): global _running if _running: raise RuntimeError('trying to start reporter while running') logging.info("Starting hawkular reporter") concurrent.thread(_run, name='hawkular', args=(address,)).start() _running = True
oVirt/vdsm
[ 129, 183, 129, 68, 1351274855 ]
def send(report): metrics_list = [_get_gauge_metric(name, value) for name, value in six.iteritems(report)] _queue.append(metrics_list) with _cond: _cond.notify()
oVirt/vdsm
[ 129, 183, 129, 68, 1351274855 ]
def write_cache(cache_file, cache_data): try: path = os.path.dirname(cache_file) if not os.path.isdir(path): os.mkdir(path) cPickle.dump(cache_data, open(cache_file, 'w'), -1) except Exception, ex: print "Failed to write cache data to %s:" % cache_file, ex
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def load_cache(cache_file): return cPickle.load(open(cache_file))
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, args = 0): Screen.__init__(self, session) self.skin_path = plugin_path self.menu = args self.list = [] self.oktext = _("\nPress OK on your remote control to continue.") self.menutext = _("Press MENU on your remote control for additional options.") self.infotext = _("Press INFO on your remote control for additional information.") self.text = "" self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) if self.menu == 0: print "building menu entries" self.list.append(("install-extensions", _("Manage extensions"), _("\nManage extensions or plugins for your receiver" ) + self.oktext, None)) self.list.append(("software-update", _("Software update"), _("\nOnline update of your receiver software." ) + self.oktext, None)) self.list.append(("software-restore", _("Software restore"), _("\nRestore your receiver with a new firmware." ) + self.oktext, None)) self.list.append(("system-backup", _("Backup system settings"), _("\nBackup your receiver settings." ) + self.oktext + "\n\n" + self.infotext, None)) self.list.append(("system-restore",_("Restore system settings"), _("\nRestore your receiver settings." ) + self.oktext, None)) self.list.append(("ipkg-install", _("Install local extension"), _("\nScan for local extensions and install them." ) + self.oktext, None)) for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): if "SoftwareSupported" in p.__call__: callFnc = p.__call__["SoftwareSupported"](None) if callFnc is not None: if "menuEntryName" in p.__call__: menuEntryName = p.__call__["menuEntryName"](None) else: menuEntryName = _('Extended Software') if "menuEntryDescription" in p.__call__: menuEntryDescription = p.__call__["menuEntryDescription"](None) else: menuEntryDescription = _('Extended Software Plugin') self.list.append(('default-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) if config.usage.setup_level.index >= 2: # expert+ self.list.append(("advanced", _("Advanced options"), _("\nAdvanced options and settings." ) + self.oktext, None)) elif self.menu == 1: self.list.append(("advancedrestore", _("Advanced restore"), _("\nRestore your backups by date." ) + self.oktext, None)) self.list.append(("backuplocation", _("Select backup location"), _("\nSelect your backup device.\nCurrent device: " ) + config.plugins.configurationbackup.backuplocation.value + self.oktext, None)) self.list.append(("backupfiles", _("Select backup files"), _("Select files for backup.") + self.oktext + "\n\n" + self.infotext, None)) if config.usage.setup_level.index >= 2: # expert+ self.list.append(("ipkg-manager", _("Packet management"), _("\nView, install and remove available or installed packages." ) + self.oktext, None)) self.list.append(("ipkg-source",_("Select upgrade source"), _("\nEdit the upgrade source address." ) + self.oktext, None)) for p in plugins.getPlugins(PluginDescriptor.WHERE_SOFTWAREMANAGER): if "AdvancedSoftwareSupported" in p.__call__: callFnc = p.__call__["AdvancedSoftwareSupported"](None) if callFnc is not None: if "menuEntryName" in p.__call__: menuEntryName = p.__call__["menuEntryName"](None) else: menuEntryName = _('Advanced software') if "menuEntryDescription" in p.__call__: menuEntryDescription = p.__call__["menuEntryDescription"](None) else: menuEntryDescription = _('Advanced software plugin') self.list.append(('advanced-plugin', menuEntryName, menuEntryDescription + self.oktext, callFnc)) self["menu"] = List(self.list) self["key_red"] = StaticText(_("Close")) self["status"] = StaticText(self.menutext) self["shortcuts"] = NumberActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "MenuActions", "NumberActions"], { "ok": self.go, "back": self.close, "red": self.close, "menu": self.handleMenu, "showEventInfo": self.handleInfo, "1": self.go, "2": self.go, "3": self.go, "4": self.go, "5": self.go, "6": self.go, "7": self.go, "8": self.go, "9": self.go, }, -1) self.onLayoutFinish.append(self.layoutFinished) self.backuppath = getBackupPath() self.backupfile = getBackupFilename() self.fullbackupfilename = self.backuppath + "/" + self.backupfile self.onShown.append(self.setWindowTitle) self.onChangedEntry = [] self["menu"].onSelectionChanged.append(self.selectionChanged)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def selectionChanged(self): item = self["menu"].getCurrent() if item: name = item[1] desc = item[2] else: name = "-" desc = "" for cb in self.onChangedEntry: cb(name, desc)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def setWindowTitle(self): self.setTitle(_("Software management"))
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def getUpdateInfos(self): if iSoftwareTools.NetworkConnectionAvailable is True: if iSoftwareTools.available_updates is not 0: self.text = _("There are at least %s updates available.") % (str(iSoftwareTools.available_updates)) else: self.text = "" #_("There are no updates available.") if iSoftwareTools.list_updating is True: self.text += "\n" + _("A search for available updates is currently in progress.") else: self.text = _("No network connection available.") self["status"].setText(self.text)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def handleInfo(self): current = self["menu"].getCurrent() if current: currentEntry = current[0] if currentEntry in ("system-backup","backupfiles"): self.session.open(SoftwareManagerInfo, mode = "backupinfo")
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def backupfiles_choosen(self, ret): self.backupdirs = ' '.join( config.plugins.configurationbackup.backupdirs.value ) config.plugins.configurationbackup.backupdirs.save() config.plugins.configurationbackup.save() config.save()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def createBackupfolders(self): print "Creating backup folder if not already there..." self.backuppath = getBackupPath() try: if (os.path.exists(self.backuppath) == False): os.makedirs(self.backuppath) except OSError: self.session.open(MessageBox, _("Sorry, your backup destination is not writeable.\nPlease select a different one."), MessageBox.TYPE_INFO, timeout = 10)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def startRestore(self, ret = False): if (ret == True): self.exe = True self.session.open(RestoreScreen, runRestore = True)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, skin_path = None): Screen.__init__(self, session) self.session = session self.skin_path = skin_path if self.skin_path is None: self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager") self.onChangedEntry = [ ] self.setup_title = _("Software manager setup") self.overwriteConfigfilesEntry = None self.list = [ ] ConfigListScreen.__init__(self, self.list, session = session, on_change = self.changedEntry) self["actions"] = ActionMap(["SetupActions", "MenuActions"], { "cancel": self.keyCancel, "save": self.apply, "menu": self.closeRecursive, }, -2) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_yellow"] = StaticText() self["key_blue"] = StaticText() self["introduction"] = StaticText() self.createSetup() self.onLayoutFinish.append(self.layoutFinished)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def createSetup(self): self.list = [ ] self.overwriteConfigfilesEntry = getConfigListEntry(_("Overwrite configuration files?"), config.plugins.softwaremanager.overwriteConfigFiles) self.list.append(self.overwriteConfigfilesEntry) self.list.append(getConfigListEntry(_("show softwaremanager in setup menu"), config.plugins.softwaremanager.onSetupMenu)) self.list.append(getConfigListEntry(_("show softwaremanager on blue button"), config.plugins.softwaremanager.onBlueButton)) self.list.append(getConfigListEntry(_("epg cache backup"), config.plugins.softwaremanager.epgcache)) self["config"].list = self.list self["config"].l.setSeperation(400) self["config"].l.setList(self.list) if not self.selectionChanged in self["config"].onSelectionChanged: self["config"].onSelectionChanged.append(self.selectionChanged) self.selectionChanged()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def newConfig(self): pass
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def keyRight(self): ConfigListScreen.keyRight(self)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def apply(self): self.session.openWithCallback(self.confirm, MessageBox, _("Use these settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def keyCancel(self): if self["config"].isChanged(): self.session.openWithCallback(self.cancelConfirm, MessageBox, _("Really close without saving settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True) else: self.close()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def changedEntry(self): for x in self.onChangedEntry: x() self.selectionChanged()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def getCurrentValue(self): return str(self["config"].getCurrent()[1].value)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, skin_path = None, mode = None): Screen.__init__(self, session) self.session = session self.mode = mode self.skin_path = skin_path if self.skin_path is None: self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager") self["actions"] = ActionMap(["ShortcutActions", "WizardActions"], { "back": self.close, "red": self.close, }, -2) self.list = [] self["list"] = List(self.list) self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText() self["key_yellow"] = StaticText() self["key_blue"] = StaticText() self["introduction"] = StaticText() self.onLayoutFinish.append(self.layoutFinished)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def showInfos(self): if self.mode == "backupinfo": self.list = [] backupfiles = config.plugins.configurationbackup.backupdirs.value for entry in backupfiles: self.list.append((entry,)) self['list'].setList(self.list)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, plugin_path = None, args = None): Screen.__init__(self, session) self.session = session self.skin_path = plugin_path if self.skin_path is None: self.skin_path = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager") self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions", "InfobarEPGActions", "HelpActions" ], { "ok": self.handleCurrent, "back": self.exit, "red": self.exit, "green": self.handleCurrent, "yellow": self.handleSelected, "showEventInfo": self.handleSelected, "displayHelp": self.handleHelp, }, -1) self.list = [] self.statuslist = [] self.selectedFiles = [] self.categoryList = [] self.packetlist = [] self["list"] = List(self.list) self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText("") self["key_yellow"] = StaticText("") self["key_blue"] = StaticText("") self["status"] = StaticText("") self.cmdList = [] self.oktext = _("\nAfter pressing OK, please wait!") if not self.selectionChanged in self["list"].onSelectionChanged: self["list"].onSelectionChanged.append(self.selectionChanged) self.currList = "" self.currentSelectedTag = None self.currentSelectedIndex = None self.currentSelectedPackage = None self.saved_currentSelectedPackage = None self.restartRequired = False self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.getUpdateInfos)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def exit(self): if self.currList == "packages": self.currList = "category" self.currentSelectedTag = None self["list"].style = "category" self['list'].setList(self.categoryList) self["list"].setIndex(self.currentSelectedIndex) self["list"].updateList(self.categoryList) self.selectionChanged() else: iSoftwareTools.cleanupSoftwareTools() self.prepareInstall() if len(self.cmdList): self.session.openWithCallback(self.runExecute, PluginManagerInfo, self.skin_path, self.cmdList) else: self.close()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def setState(self,status = None): if status: self.currList = "status" self.statuslist = [] self["key_green"].setText("") self["key_blue"].setText("") self["key_yellow"].setText("") divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) if status == 'update': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) self.statuslist.append(( _("Updating software catalog"), '', _("Searching for available updates. Please wait..." ),'', '', statuspng, divpng, None, '' )) elif status == 'sync': statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png")) self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' )) elif status == 'error': self["key_green"].setText(_("Continue")) statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png")) self.statuslist.append(( _("Error"), '', _("An error occurred while downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' )) self["list"].style = "default" self['list'].setList(self.statuslist)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def getUpdateInfosCB(self, retval = None): if retval is not None: if retval is True: if iSoftwareTools.available_updates is not 0: self["status"].setText(_("There are at least ") + str(iSoftwareTools.available_updates) + _(" updates available.")) else: self["status"].setText(_("There are no updates available.")) self.rebuildList() elif retval is False: if iSoftwareTools.lastDownloadDate is None: self.setState('error') if iSoftwareTools.NetworkConnectionAvailable: self["status"].setText(_("Updatefeed not available.")) else: self["status"].setText(_("No network connection available.")) else: iSoftwareTools.lastDownloadDate = time.time() iSoftwareTools.list_updating = True self.setState('update') iSoftwareTools.getUpdates(self.getUpdateInfosCB)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def selectionChanged(self): current = self["list"].getCurrent() self["status"].setText("") if current: if self.currList == "packages": self["key_red"].setText(_("Back")) if current[4] == 'installed': self["key_green"].setText(_("Uninstall")) elif current[4] == 'installable': self["key_green"].setText(_("Install")) if iSoftwareTools.NetworkConnectionAvailable is False: self["key_green"].setText("") elif current[4] == 'remove': self["key_green"].setText(_("Undo uninstall")) elif current[4] == 'install': self["key_green"].setText(_("Undo install")) if iSoftwareTools.NetworkConnectionAvailable is False: self["key_green"].setText("") self["key_yellow"].setText(_("View details")) self["key_blue"].setText("") if len(self.selectedFiles) == 0 and iSoftwareTools.available_updates is not 0: self["status"].setText(_("There are at least ") + str(iSoftwareTools.available_updates) + _(" updates available.")) elif len(self.selectedFiles) is not 0: self["status"].setText(str(len(self.selectedFiles)) + _(" packages selected.")) else: self["status"].setText(_("There are currently no outstanding actions.")) elif self.currList == "category": self["key_red"].setText(_("Close")) self["key_green"].setText("") self["key_yellow"].setText("") self["key_blue"].setText("") if len(self.selectedFiles) == 0 and iSoftwareTools.available_updates is not 0: self["status"].setText(_("There are at least ") + str(iSoftwareTools.available_updates) + _(" updates available.")) self["key_yellow"].setText(_("Update")) elif len(self.selectedFiles) is not 0: self["status"].setText(str(len(self.selectedFiles)) + _(" packages selected.")) self["key_yellow"].setText(_("Process")) else: self["status"].setText(_("There are currently no outstanding actions."))
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def handleCurrent(self): current = self["list"].getCurrent() if current: if self.currList == "category": self.currentSelectedIndex = self["list"].index selectedTag = current[2] self.buildPacketList(selectedTag) elif self.currList == "packages": if current[7] is not '': idx = self["list"].getIndex() detailsFile = self.list[idx][1] if self.list[idx][7] == True: for entry in self.selectedFiles: if entry[0] == detailsFile: self.selectedFiles.remove(entry) else: alreadyinList = False for entry in self.selectedFiles: if entry[0] == detailsFile: alreadyinList = True if not alreadyinList: if (iSoftwareTools.NetworkConnectionAvailable is False and current[4] in ('installable','install')): pass else: self.selectedFiles.append((detailsFile,current[4],current[3])) self.currentSelectedPackage = ((detailsFile,current[4],current[3])) if current[4] == 'installed': self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'remove', True) elif current[4] == 'installable': if iSoftwareTools.NetworkConnectionAvailable: self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'install', True) elif current[4] == 'remove': self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installed', False) elif current[4] == 'install': if iSoftwareTools.NetworkConnectionAvailable: self.list[idx] = self.buildEntryComponent(current[0], current[1], current[2], current[3], 'installable',False) self["list"].setList(self.list) self["list"].setIndex(idx) self["list"].updateList(self.list) self.selectionChanged() elif self.currList == "status": iSoftwareTools.lastDownloadDate = time.time() iSoftwareTools.list_updating = True self.setState('update') iSoftwareTools.getUpdates(self.getUpdateInfosCB)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def detailsClosed(self, result = None): if result is not None: if result is not False: self.setState('sync') iSoftwareTools.lastDownloadDate = time.time() for entry in self.selectedFiles: if entry == self.saved_currentSelectedPackage: self.selectedFiles.remove(entry) iSoftwareTools.startIpkgListInstalled(self.rebuildList)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def buildPacketList(self, categorytag = None): if categorytag is not None: self.currList = "packages" self.currentSelectedTag = categorytag self.packetlist = [] for package in iSoftwareTools.packagesIndexlist[:]: prerequisites = package[0]["prerequisites"] if "tag" in prerequisites: for foundtag in prerequisites["tag"]: if categorytag == foundtag: attributes = package[0]["attributes"] if "packagetype" in attributes: if attributes["packagetype"] == "internal": continue self.packetlist.append([attributes["name"], attributes["details"], attributes["shortdescription"], attributes["packagename"]]) else: self.packetlist.append([attributes["name"], attributes["details"], attributes["shortdescription"], attributes["packagename"]]) self.list = [] for x in self.packetlist: status = "" name = x[0].strip() details = x[1].strip() description = x[2].strip() if not description: description = "No description available." packagename = x[3].strip() selectState = self.getSelectionState(details) if packagename in iSoftwareTools.installed_packetlist: if selectState == True: status = "remove" else: status = "installed" self.list.append(self.buildEntryComponent(name, _(details), _(description), packagename, status, selected = selectState)) else: if selectState == True: status = "install" else: status = "installable" self.list.append(self.buildEntryComponent(name, _(details), _(description), packagename, status, selected = selectState)) if len(self.list): self.list.sort(key=lambda x: x[0]) self["list"].style = "default" self['list'].setList(self.list) self["list"].updateList(self.list) self.selectionChanged()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def buildCategoryComponent(self, tag = None): divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png")) if tag is not None: if tag == 'System': return(( _("System"), _("View list of available system extensions" ), tag, divpng )) elif tag == 'Skin': return(( _("Skins"), _("View list of available skins" ), tag, divpng )) elif tag == 'Recording': return(( _("Recordings"), _("View list of available recording extensions" ), tag, divpng )) elif tag == 'Network': return(( _("Network"), _("View list of available networking extensions" ), tag, divpng )) elif tag == 'CI': return(( _("Common Interface"), _("View list of available CommonInterface extensions" ), tag, divpng )) elif tag == 'Default': return(( _("Default settings"), _("View list of available default settings" ), tag, divpng )) elif tag == 'SAT': return(( _("Satellite equipment"), _("View list of available Satellite equipment extensions." ), tag, divpng )) elif tag == 'Software': return(( _("Software"), _("View list of available software extensions" ), tag, divpng )) elif tag == 'Multimedia': return(( _("Multimedia"), _("View list of available multimedia extensions." ), tag, divpng )) elif tag == 'Display': return(( _("Display and userinterface"), _("View list of available display and userinterface extensions." ), tag, divpng )) elif tag == 'EPG': return(( _("Electronic Program Guide"), _("View list of available EPG extensions." ), tag, divpng )) elif tag == 'Communication': return(( _("Communication"), _("View list of available communication extensions." ), tag, divpng )) else: # dynamically generate non existent tags return(( str(tag), _("View list of available ") + str(tag) + _(" extensions." ), tag, divpng ))
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def runExecute(self, result = None): if result is not None: if result[0] is True: self.session.openWithCallback(self.runExecuteFinished, Ipkg, cmdList = self.cmdList) elif result[0] is False: self.cmdList = result[1] self.session.openWithCallback(self.runExecuteFinished, Ipkg, cmdList = self.cmdList) else: self.close()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def ExecuteReboot(self, result): if result: self.session.open(TryQuitMainloop,retvalue=3) else: self.selectedFiles = [] self.restartRequired = False self.detailsClosed(True)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, plugin_path, cmdlist = None): Screen.__init__(self, session) self.session = session self.skin_path = plugin_path self.cmdlist = cmdlist self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], { "ok": self.process_all, "back": self.exit, "red": self.exit, "green": self.process_extensions, }, -1) self.list = [] self["list"] = List(self.list) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Only extensions.")) self["status"] = StaticText(_("Following tasks will be done after you press OK!")) self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.rebuildList)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def rebuildList(self): self.list = [] if self.cmdlist is not None: for entry in self.cmdlist: action = "" info = "" cmd = entry[0] if cmd == 0: action = 'install' elif cmd == 2: action = 'remove' else: action = 'upgrade' args = entry[1] if cmd == 0: info = args['package'] elif cmd == 2: info = args['package'] else: info = _("receiver software because updates are available.") self.list.append(self.buildEntryComponent(action,info)) self['list'].setList(self.list) self['list'].updateList(self.list)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def exit(self): self.close()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def process_extensions(self): self.list = [] if self.cmdlist is not None: for entry in self.cmdlist: cmd = entry[0] if entry[0] in (0,2): self.list.append((entry)) self.close((False,self.list))
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, plugin_path): Screen.__init__(self, session) self.session = session self.skin_path = plugin_path self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], { "back": self.exit, "red": self.exit, }, -1) self.list = [] self["list"] = List(self.list) self["key_red"] = StaticText(_("Close")) self["status"] = StaticText(_("A small overview of the available icon states and actions.")) self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.rebuildList)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def rebuildList(self): self.list = [] self.list.append(self.buildEntryComponent('install')) self.list.append(self.buildEntryComponent('installable')) self.list.append(self.buildEntryComponent('installed')) self.list.append(self.buildEntryComponent('remove')) self['list'].setList(self.list) self['list'].updateList(self.list)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def exit(self): self.close()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def __init__(self, session, plugin_path, packagedata = None): Screen.__init__(self, session) self.skin_path = plugin_path self.language = language.getLanguage()[:2] # getLanguage returns e.g. "fi_FI" for "language_country" self.attributes = None PackageInfoHandler.__init__(self, self.statusCallback) self.directory = resolveFilename(SCOPE_METADIR) if packagedata: self.pluginname = packagedata[0] self.details = packagedata[1] self.pluginstate = packagedata[4] self.statuspicinstance = packagedata[5] self.divpicinstance = packagedata[6] self.fillPackageDetails(self.details) self.thumbnail = "" self["shortcuts"] = ActionMap(["ShortcutActions", "WizardActions"], { "back": self.exit, "red": self.exit, "green": self.go, "up": self.pageUp, "down": self.pageDown, "left": self.pageUp, "right": self.pageDown, }, -1) self["key_red"] = StaticText(_("Close")) self["key_green"] = StaticText("") self["author"] = StaticText() self["statuspic"] = Pixmap() self["divpic"] = Pixmap() self["screenshot"] = Pixmap() self["detailtext"] = ScrollLabel() self["statuspic"].hide() self["screenshot"].hide() self["divpic"].hide() self.package = self.packageDetails[0] if "attributes" in self.package[0]: self.attributes = self.package[0]["attributes"] self.restartRequired = False self.cmdList = [] self.oktext = _("\nAfter pressing OK, please wait!") self.picload = ePicLoad() self.picload.PictureData.get().append(self.paintScreenshotPixmapCB) self.onShown.append(self.setWindowTitle) self.onLayoutFinish.append(self.setInfos)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def exit(self): self.close(False)
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def pageDown(self): self["detailtext"].pageDown()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def setInfos(self): if "screenshot" in self.attributes: self.loadThumbnail(self.attributes) if "name" in self.attributes: self.pluginname = self.attributes["name"] else: self.pluginname = _("unknown") if "author" in self.attributes: self.author = self.attributes["author"] else: self.author = _("unknown") if "description" in self.attributes: self.description = _(self.attributes["description"].replace("\\n", "\n")) else: self.description = _("No description available.") self["author"].setText(_("Author: ") + self.author) self["detailtext"].setText(_(self.description)) if self.pluginstate in ('installable', 'install'): if iSoftwareTools.NetworkConnectionAvailable: self["key_green"].setText(_("Install")) else: self["key_green"].setText("") else: self["key_green"].setText(_("Remove"))
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]
def setThumbnail(self, noScreenshot = False): if not noScreenshot: filename = self.thumbnail else: filename = resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/noprev.png") sc = AVSwitch().getFramebufferScale() self.picload.setPara((self["screenshot"].instance.size().width(), self["screenshot"].instance.size().height(), sc[0], sc[1], False, 1, "#00000000")) self.picload.startDecode(filename) if self.statuspicinstance is not None: self["statuspic"].instance.setPixmap(self.statuspicinstance.__deref__()) self["statuspic"].show() if self.divpicinstance is not None: self["divpic"].instance.setPixmap(self.divpicinstance.__deref__()) self["divpic"].show()
Taapat/enigma2-openpli-fulan
[ 5, 11, 5, 1, 1452283820 ]