+class PluginManagerInfo(Screen):
+ skin = """
+ <screen position="80,80" size="560,450" title="Plugin manager job information..." >
+ <widget name="status" position="5,5" zPosition="10" size="540,30" halign="center" valign="center" font="Regular;22" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
+ <ePixmap pixmap="skin_default/div-h.png" position="0,35" zPosition="10" size="550,2" transparent="1" alphatest="on" />
+ <widget source="list" render="Listbox" position="5,45" size="550,360" 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/buttons/red.png" position="0,410" zPosition="2" size="140,40" transparent="1" alphatest="on" />
+ <widget name="closetext" position="0,410" zPosition="10" size="140,40" halign="center" valign="center" font="Regular;22" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
+ <ePixmap pixmap="skin_default/buttons/green.png" position="140,410" zPosition="2" size="140,40" transparent="1" alphatest="on" />
+ <widget name="continuetext" position="140,410" zPosition="10" size="140,40" 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["closetext"] = Label(_("Cancel"))
+ self["continuetext"] = Label(_("Continue"))
+ self["status"] = Label(_("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 process information..."))
+
+ def rebuildList(self):
+ self.list = []
+ if self.cmdlist is not None:
+ for entry in self.cmdlist:
+ 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_SKIN_IMAGE, "skin_default/div-h.png"))
+ upgradepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/upgrade.png"))
+ installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/install.png"))
+ removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/remove.png"))
+ if action == 'install':
+ return(( _('Installing'), info, installpng, divpng))
+ elif action == 'remove':
+ return(( _('Remove'), info, removepng, divpng))
+ else:
+ return(( _('Upgrade'), info, upgradepng, divpng))
+
+ def exit(self):
+ self.close(False)
+
+ def process(self):
+ self.close(True)
+
+
+class PluginManagerHelp(Screen):
+ skin = """
+ <screen position="80,80" size="560,450" title="Plugin manager help..." >
+ <widget name="status" position="5,5" zPosition="10" size="540,30" halign="center" valign="center" font="Regular;22" transparent="1" shadowColor="black" shadowOffset="-1,-1" />
+ <ePixmap pixmap="skin_default/div-h.png" position="0,35" zPosition="10" size="550,2" transparent="1" alphatest="on" />
+ <widget source="list" render="Listbox" position="5,45" size="550,360" 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/buttons/red.png" position="0,410" zPosition="2" size="140,40" transparent="1" alphatest="on" />
+ <widget name="closetext" position="0,410" zPosition="10" size="140,40" 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["closetext"] = Label(_("Close"))
+ self["status"] = Label(_("Here is a small overview of the available icon states."))
+
+ 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_SKIN_IMAGE, "skin_default/div-h.png"))
+ installedpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installed.png"))
+ installablepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/installable.png"))
+ removepng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SoftwareManager/remove.png"))
+ installpng = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "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()
+
+