- 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_SKIN_IMAGE, "skin_default/div-h.png"))
- if status == 'update':
- statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgrade.png"))
- self.statuslist.append(( _("Package list update"), '', _("Trying to download a new packetlist. Please wait..." ),'', '', statuspng, divpng, None, '' ))
- self["list"].style = "default"
- self['list'].setList(self.statuslist)
- elif status == 'sync':
- statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgrade.png"))
- self.statuslist.append(( _("Package list update"), '', _("Searching for new installed or removed packages. Please wait..." ),'', '', statuspng, divpng, None, '' ))
- self["list"].style = "default"
- self['list'].setList(self.statuslist)
- elif status == 'error':
- statuspng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/remove.png"))
- self.statuslist.append(( _("Error"), '', _("There was an error downloading the packetlist. Please try again." ),'', '', statuspng, divpng, None, '' ))
- self["list"].style = "default"
- self['list'].setList(self.statuslist)
+ def process_all(self):
+ self.close((True,None))
+
+ 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))
+
+
+class PluginManagerHelp(Screen):
+ skin = """
+ <screen name="PluginManagerHelp" position="center,center" size="560,450" title="Plugin manager help" >
+ <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+ <widget source="list" render="Listbox" position="5,50" size="550,350" scrollbarMode="showOnDemand" selectionDisabled="1">
+ <convert type="TemplatedMultiContent">
+ {"template": [
+ MultiContentEntryText(pos = (50, 0), size = (540, 26), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name
+ MultiContentEntryText(pos = (50, 27), size = (540, 23), font=1, flags = RT_HALIGN_LEFT, text = 1), # index 1 is the state
+ MultiContentEntryPixmapAlphaTest(pos = (0, 1), size = (48, 48), png = 2), # index 2 is the status pixmap
+ MultiContentEntryPixmapAlphaTest(pos = (0, 48), size = (550, 2), png = 3), # index 3 is the div pixmap
+ ],
+ "fonts": [gFont("Regular", 24),gFont("Regular", 22)],
+ "itemHeight": 50
+ }
+ </convert>
+ </widget>
+ <ePixmap pixmap="skin_default/div-h.png" position="0,404" zPosition="10" size="560,2" transparent="1" alphatest="on" />
+ <widget source="status" render="Label" position="5,408" zPosition="10" size="550,44" halign="center" valign="center" font="Regular;22" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
+ </screen>"""
+
+ 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)
+
+ def setWindowTitle(self):
+ self.setTitle(_("Plugin manager help"))
+
+ 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)
+
+ def buildEntryComponent(self, state):
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
+ installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installed.png"))
+ installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/installable.png"))
+ removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png"))
+ installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png"))
+
+ if state == 'installed':
+ return(( _('This plugin is installed.'), _('You can remove this plugin.'), installedpng, divpng))
+ elif state == 'installable':
+ return(( _('This plugin is not installed.'), _('You can install this plugin.'), installablepng, divpng))
+ elif state == 'install':
+ return(( _('This plugin will be installed.'), _('You can cancel the installation.'), installpng, divpng))
+ elif state == 'remove':
+ return(( _('This plugin will be removed.'), _('You can cancel the removal.'), removepng, divpng))
+
+ def exit(self):
+ self.close()
+
+
+class PluginDetails(Screen, DreamInfoHandler):
+ skin = """
+ <screen name="PluginDetails" position="center,center" size="600,440" title="Plugin details" >
+ <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
+ <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
+ <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
+ <widget source="author" render="Label" position="10,50" size="500,25" zPosition="10" font="Regular;21" transparent="1" />
+ <widget name="statuspic" position="550,40" size="48,48" alphatest="on"/>
+ <widget name="divpic" position="0,80" size="600,2" alphatest="on"/>
+ <widget name="detailtext" position="10,90" size="270,330" zPosition="10" font="Regular;21" transparent="1" halign="left" valign="top"/>
+ <widget name="screenshot" position="290,90" size="300,330" alphatest="on"/>
+ </screen>"""
+ 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
+ self.translatedAttributes = None
+ DreamInfoHandler.__init__(self, self.statusCallback, blocking = False, language = self.language)
+ 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 self.package[0].has_key("attributes"):
+ self.attributes = self.package[0]["attributes"]
+ if self.package[0].has_key("translation"):
+ self.translatedAttributes = self.package[0]["translation"]
+
+ 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)
+
+ def setWindowTitle(self):
+ self.setTitle(_("Details for extension: " + self.pluginname))
+
+ def exit(self):
+ self.close(False)
+
+ def pageUp(self):
+ self["detailtext"].pageUp()
+
+ def pageDown(self):
+ self["detailtext"].pageDown()