+class PluginManagerInfo(Screen):
+ skin = """
+ <screen name="PluginManagerInfo" position="center,center" size="560,440" title="Plugin manager activity information" >
+ <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="list" render="Listbox" position="5,50" size="550,350" scrollbarMode="showOnDemand" selectionDisabled="1">
+ <convert type="TemplatedMultiContent">
+ {"template": [
+ MultiContentEntryText(pos = (50, 1), size = (150, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name
+ MultiContentEntryText(pos = (50, 25), size = (540, 24), 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, 49), size = (550, 2), png = 3), # index 3 is the div pixmap
+ ],
+ "fonts": [gFont("Regular", 22),gFont("Regular", 18)],
+ "itemHeight": 52
+ }
+ </convert>
+ </widget>
+ <ePixmap pixmap="skin_default/div-h.png" position="0,410" zPosition="10" size="560,2" transparent="1" alphatest="on" />
+ <widget source="status" render="Label" position="5,420" zPosition="10" size="550,30" halign="center" valign="center" font="Regular;22" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
+ </screen>"""
+
+ 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,
+ "back": self.exit,
+ "red": self.exit,
+ "green": self.process,
+ }, -1)
+
+ self.list = []
+ self["list"] = List(self.list)
+ self["key_red"] = StaticText(_("Cancel"))
+ self["key_green"] = StaticText(_("Continue"))
+ self["status"] = StaticText(_("Following tasks will be done after you press continue!"))
+
+ self.onShown.append(self.setWindowTitle)
+ self.onLayoutFinish.append(self.rebuildList)
+
+ def setWindowTitle(self):
+ self.setTitle(_("Plugin manager activity information"))
+
+ 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 = _("Dreambox software because updates are available.")
+
+ self.list.append(self.buildEntryComponent(action,info))
+ self['list'].setList(self.list)
+ self['list'].updateList(self.list)
+
+ def buildEntryComponent(self, action,info):
+ divpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/div-h.png"))
+ upgradepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/upgrade.png"))
+ installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/install.png"))
+ removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_PLUGIN, "SystemPlugins/SoftwareManager/remove.png"))
+ if action == 'install':
+ return(( _('Installing'), info, installpng, divpng))
+ elif action == 'remove':
+ return(( _('Removing'), info, removepng, divpng))
+ else:
+ return(( _('Upgrading'), info, upgradepng, divpng))
+
+ def exit(self):
+ self.close(False)
+
+ def process(self):
+ self.close(True)
+
+
+class PluginManagerHelp(Screen):
+ skin = """
+ <screen name="PluginManagerHelp" position="center,center" size="560,440" 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, 1), size = (540, 24), font=0, flags = RT_HALIGN_LEFT, text = 0), # index 0 is the name
+ MultiContentEntryText(pos = (50, 25), size = (540, 24), 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, 49), size = (550, 2), png = 3), # index 3 is the div pixmap
+ ],
+ "fonts": [gFont("Regular", 22),gFont("Regular", 18)],
+ "itemHeight": 52
+ }
+ </convert>
+ </widget>
+ <ePixmap pixmap="skin_default/div-h.png" position="0,410" zPosition="10" size="550,2" transparent="1" alphatest="on" />
+ <widget source="status" render="Label" position="5,420" zPosition="10" size="550,30" 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()
+
+