def executeRequestPackages(self): api = SAPCL() if self.categoryid == -2: self.packages = api.getTopTen("rank") elif self.categoryid == -3: self.packages = api.getTopTen("downloads") else: self.packages = api.getPackages(self.categoryid, config.sifteam.addons_packages_sort.value)
def executeRequestPackages(self): api = SAPCL() if self.index == -1: return api.getTopTen("rank") elif self.index == -2: return api.getTopTen("downloads") else: return api.getPackages(self.categories["categories"][self.index]["id"], config.sifteam.addons_packages_sort.value, self.showall == False)
def executeRequestPackages(self): api = SAPCL() if self.categoryid == -2: self.packages = api.getTopTen("rank") elif self.categoryid == -3: self.packages = api.getTopTen("downloads") else: self.packages = api.getPackages( self.categoryid, config.sifteam.addons_packages_sort.value, self.showall == False)
def executeRequestPackages(self): api = SAPCL() if self.index == -1: return api.getTopTen("rank") elif self.index == -2: return api.getTopTen("downloads") else: return api.getPackages( self.categories["categories"][self.index]["id"], config.sifteam.addons_packages_sort.value, self.showall == False)
def startAutomaticSettingsUpdates(session, id, arg): if config.sifteam.cloud.settingsupdates.value and config.sifteam.settings.currentsettings.value != -1: api = SAPCL() settings = api.getChannelsSettings() for setting in settings["settings"]: if setting["id"] == config.sifteam.settings.currentsettings.value: if setting["published"] != config.sifteam.settings.currentsettingsdate.value: config.sifteam.settings.currentsettingsdate.value = setting["published"] installSettings(config.sifteam.settings.currentsettings.value) break
def __init__(self, session, categories): Screen.__init__(self, session) self.session = session self.sifapi = SAPCL() self.categories = categories self.upgrades = [] self.updating = True self.showall = False self.cachelist = [] self.listindex = 0 self['list'] = List([]) self["list"].onSelectionChanged.append(self.selectionChanged) self["key_green"] = Button(_("Feeds")) self["key_red"] = Button("") self["key_blue"] = Button(_("Status")) self["key_yellow"] = Button(_("All")) self["actions"] = ActionMap( ["OkCancelActions", "ColorActions"], { "blue": self.status, "cancel": self.quit, "ok": self.ok, "yellow": self.toggleShowAll, "green": self.feeds, "red": self.upgrade }, -2) self.renderList() smstack.add(SMStack.UPDATE, "", self.updateCallback)
def processNextCommand(self): for item in self.stack: if item["status"] == self.WAIT: self.current = item break if not self.current: self.processComplete() return self.app = eConsoleAppContainer() self.app.appClosed.append(self.cmdFinished) self.app.dataAvail.append(self.cmdData) self.current["status"] = self.PROGRESS if self.current["cmd"] == self.INSTALL or self.current["cmd"] == self.INSTALL_WITH_REBOOT: cmd = "opkg -V2 install " + self.current["package"] print "Installing package %s (%s)" % (self.current["package"], cmd) self.current["message"] = "Installing " + self.current["package"] # it's useless notify custom packages if self.current["package"][-4:] != ".ipk": api = SAPCL() api.installByPackageName(self.current["package"]) elif self.current["cmd"] == self.REMOVE: cmd = "opkg -V2 remove " + self.current["package"] print "Removing package %s (%s)" % (self.current["package"], cmd) self.current["message"] = "Removing " + self.current["package"] api = SAPCL() api.uninstallByPackageName(self.current["package"]) elif self.current["cmd"] == self.DOWNLOAD: cmd = "cd /tmp && opkg -V2 download " + self.current["package"] print "Downloading package %s (%s)" % (self.current["package"], cmd) self.current["message"] = "Downloading " + self.current["package"] api = SAPCL() api.downloadByPackageName(self.current["package"]) elif self.current["cmd"] == self.UPGRADE: cmd = "opkg -V2 upgrade" print "Upgrading (%s)" % cmd self.current["message"] = "Upgrading" elif self.current["cmd"] == self.UPDATE: cmd = "opkg -V2 update" print "Updating (%s)" % cmd self.current["message"] = "Updating" else: self.cmdFinished(-1) self.current["systemcmd"] = cmd if self.app.execute(cmd): self.cmdFinished(-1)
def installSettings(id): try: shutil.rmtree(TMP_IMPORT_PWD) except: pass api = SAPCL() result = api.getChannelsSetting(id) if not result["result"]: return False STDeflate().deflate(result["filename"]) settings = SettingsLoader() settings.apply() try: shutil.rmtree(TMP_SETTINGS_PWD) except Exception, e: pass
class SMRank(Screen): def __init__(self, session, package): Screen.__init__(self, session) self.session = session self.package = package self.cachelist = [] self['list'] = List([]) self["text"] = Label("Rank the application %s" % package["name"]) self["key_green"] = Button() self["key_red"] = Button("") self["key_blue"] = Button("") self["key_yellow"] = Button() self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], { "cancel": self.quit, "ok": self.ok }, -2) self.renderList() self.onLayoutFinish.append(self.layoutFinished) def layoutFinished(self): self.setTitle("Software Manager - Rank - %s" % self.package["name"]) def renderList(self): self.cachelist = [] self.cachelist.append(RankEntry(0.0, "Really bad")) self.cachelist.append(RankEntry(1.0, "Can do better")) self.cachelist.append(RankEntry(2.0, "Sufficient")) self.cachelist.append(RankEntry(3.0, "Good")) self.cachelist.append(RankEntry(4.0, "Very good")) self.cachelist.append(RankEntry(5.0, "Excellent")) self["list"].setList(self.cachelist) def rank(self): id = -1 try: id = int(self.package["id"]) except Exception, e: pass api = SAPCL() return api.rank(id, self.index)
def executeRequest(self): api = SAPCL() return api.getAccount()
def executeRequest(self): api = SAPCL() return api.getCategories(0, not self.showall)
def executeRequestPackages(self): api = SAPCL() packages = api.getPackages(self.categoryid, config.sifteam.addons_packages_sort.value) for package in packages["packages"]: if package["package"] == self.package["package"]: self.package["rank"] = package["rank"]
def processNextCommand(self): for item in self.stack: if item["status"] == self.WAIT: self.current = item break if not self.current: self.processComplete() return self.app = eConsoleAppContainer() self.app.appClosed.append(self.cmdFinished) self.app.dataAvail.append(self.cmdData) self.current["status"] = self.PROGRESS if self.current["cmd"] == self.INSTALL or self.current[ "cmd"] == self.INSTALL_WITH_REBOOT: cmd = "opkg -V2 install " + self.current["package"] print "Installing package %s (%s)" % (self.current["package"], cmd) self.current["message"] = "Installing " + self.current["package"] # it's useless notify custom packages if self.current["package"][-4:] != ".ipk": api = SAPCL() api.installByPackageName(self.current["package"]) elif self.current["cmd"] == self.REMOVE: cmd = "opkg -V2 remove " + self.current["package"] print "Removing package %s (%s)" % (self.current["package"], cmd) self.current["message"] = "Removing " + self.current["package"] api = SAPCL() api.uninstallByPackageName(self.current["package"]) elif self.current["cmd"] == self.DOWNLOAD: cmd = "cd /tmp && opkg -V2 download " + self.current["package"] print "Downloading package %s (%s)" % (self.current["package"], cmd) self.current["message"] = "Downloading " + self.current["package"] api = SAPCL() api.downloadByPackageName(self.current["package"]) elif self.current["cmd"] == self.UPGRADE: cmd = "opkg -V2 upgrade" print "Upgrading (%s)" % cmd self.current["message"] = "Upgrading" elif self.current["cmd"] == self.UPDATE: cmd = "opkg -V2 update" print "Updating (%s)" % cmd self.current["message"] = "Updating" else: self.cmdFinished(-1) self.current["systemcmd"] = cmd if self.app.execute(cmd): self.cmdFinished(-1)