+class SoftwareManagerSetup(Screen, ConfigListScreen):
+
+ skin = """
+ <screen name="SoftwareManagerSetup" position="center,center" size="560,440" title="SoftwareManager setup">
+ <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" />
+ <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="420,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="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
+ <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
+ <widget name="config" position="5,50" size="550,350" scrollbarMode="showOnDemand" />
+ <ePixmap pixmap="skin_default/div-h.png" position="0,400" zPosition="1" size="560,2" />
+ <widget source="introduction" render="Label" position="5,410" size="550,30" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
+ </screen>"""
+
+ def __init__(self, session, skin_path = None):
+ Screen.__init__(self, session)
+ self.session = session
+ self.skin_path = skin_path
+ if self.skin_path == 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"],
+ {
+ "cancel": self.keyCancel,
+ "save": self.apply,
+ }, -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)
+
+ def layoutFinished(self):
+ self.setTitle(self.setup_title)
+
+ def createSetup(self):
+ self.list = [ ]
+ self.overwriteConfigfilesEntry = getConfigListEntry(_("Overwrite configuration files ?"), config.plugins.softwaremanager.overwriteConfigFiles)
+ self.list.append(self.overwriteConfigfilesEntry)
+ 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()
+
+ def selectionChanged(self):
+ if self["config"].getCurrent() == self.overwriteConfigfilesEntry:
+ self["introduction"].setText(_("Overwrite configuration files during software upgrade?"))
+ else:
+ self["introduction"].setText("")
+
+ def newConfig(self):
+ pass
+
+ def keyLeft(self):
+ ConfigListScreen.keyLeft(self)
+
+ def keyRight(self):
+ ConfigListScreen.keyRight(self)
+
+ def confirm(self, confirmed):
+ if not confirmed:
+ print "not confirmed"
+ return
+ else:
+ self.keySave()
+
+ def apply(self):
+ self.session.openWithCallback(self.confirm, MessageBox, _("Use this settings?"), MessageBox.TYPE_YESNO, timeout = 20, default = True)
+
+ def cancelConfirm(self, result):
+ if not result:
+ return
+ for x in self["config"].list:
+ x[1].cancel()
+ self.close()
+
+ 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()
+
+ # for summary:
+ def changedEntry(self):
+ for x in self.onChangedEntry:
+ x()
+ self.selectionChanged()
+
+ def getCurrentEntry(self):
+ return self["config"].getCurrent()[0]
+
+ def getCurrentValue(self):
+ return str(self["config"].getCurrent()[1].value)
+
+ def createSummary(self):
+ from Screens.Setup import SetupSummary
+ return SetupSummary
+
+
+class SoftwareManagerInfo(Screen):
+ skin = """
+ <screen name="SoftwareManagerInfo" position="center,center" size="560,440" title="SoftwareManager 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" />
+ <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
+ <ePixmap pixmap="skin_default/buttons/blue.png" position="420,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="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
+ <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
+ <widget source="list" render="Listbox" position="5,50" size="550,340" scrollbarMode="showOnDemand" selectionDisabled="0">
+ <convert type="TemplatedMultiContent">
+ {"template": [
+ MultiContentEntryText(pos = (5, 0), size = (540, 26), font=0, flags = RT_HALIGN_LEFT | RT_HALIGN_CENTER, text = 0), # index 0 is the name
+ ],
+ "fonts": [gFont("Regular", 24),gFont("Regular", 22)],
+ "itemHeight": 26
+ }
+ </convert>
+ </widget>
+ <ePixmap pixmap="skin_default/div-h.png" position="0,400" zPosition="1" size="560,2" />
+ <widget source="introduction" render="Label" position="5,410" size="550,30" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
+ </screen>"""
+
+ 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 == 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)
+
+ def layoutFinished(self):
+ self.setTitle(_("Softwaremanager information"))
+ if self.mode is not None:
+ self.showInfos()
+
+ 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)
+