+ entry = ConfigYesNo()
+ self.packagesConfig.append(entry)
+ configList.append(getConfigListEntry(self.packageslist[x][0]["attributes"]["name"], entry))
+ return configList
+
+ def selectionMade(self):
+ print "selection made"
+ #self.installPackage(int(index))
+ self.indexList = []
+ for x in range(len(self.packagesConfig)):
+ if self.packagesConfig[x].value:
+ self.indexList.append(x)
+
+class DreamPackageWizard(DefaultWizard):
+ def __init__(self, session, packagefile, silent = False):
+ if not pathExists("/tmp/package"):
+ mkdir("/tmp/package")
+ os_system("tar xpzf %s -C /tmp/package" % packagefile)
+ self.packagefile = packagefile
+ DefaultWizard.__init__(self, session, silent)
+
+ def setDirectory(self):
+ self.directory = "/tmp/package"
+ self.xmlfile = "dreampackagewizard.xml"
+
+class ImageDefaultInstaller(DreamInfoHandler):
+ def __init__(self):
+ DreamInfoHandler.__init__(self, self.statusCallback, blocking = True)
+ self.directory = resolveFilename(SCOPE_DEFAULTDIR)
+ self.fillPackagesList()
+ self.installPackage(0)
+
+ def statusCallback(self, status, progress):
+ pass
+
+def install(choice):
+ if choice is not None:
+ #os_system("mkdir /tmp/package && tar xpzf %s ")
+ choice[2].open(DreamPackageWizard, choice[1])
+
+def filescan_open(list, session, **kwargs):
+ from Screens.ChoiceBox import ChoiceBox
+ print "open default wizard"
+ filelist = [(os_path.split(x.path)[1], x.path, session) for x in list]
+ print filelist
+ session.openWithCallback(install, ChoiceBox, title = _("Please choose he package..."), list=filelist)
+
+def filescan(**kwargs):
+ from Components.Scanner import Scanner, ScanPath
+ from mimetypes import add_type
+ add_type("application/x-dream-package", "dmpkg")
+ return \
+ Scanner(mimetypes = ["application/x-dream-package"],
+ paths_to_scan =
+ [
+ ScanPath(path = "dmpkg", with_subdirs = True),
+ ScanPath(path = "", with_subdirs = False),
+ ],
+ name = "Dream-Package",
+ description = "Install settings, skins, software...",
+ openfnc = filescan_open, )
+
+print "add dreampackage scanner plugin"
+plugins.addPlugin(PluginDescriptor(name="Dream-Package", where = PluginDescriptor.WHERE_FILESCAN, fnc = filescan, internal = True))
+print "added"
+
+wizardManager.registerWizard(DefaultWizard, config.misc.defaultchosen.value, priority = 6)
+
+if config.misc.defaultchosen.value:
+ print "Installing image defaults"
+ installer = ImageDefaultInstaller()
+ print "installing done!"