X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FScreens%2FDefaultWizard.py;h=fd2e54f6eb16ee8d3fb533a526c15fd9fe1b785e;hp=87f6816a50d816f47e160bf5c43b64b3f965deb2;hb=b72c9852440926ac82fd4ca3186278edd7167427;hpb=0e2adbdfe1aaa39c0b652a8839f512717bb48de8 diff --git a/lib/python/Screens/DefaultWizard.py b/lib/python/Screens/DefaultWizard.py old mode 100644 new mode 100755 index 87f6816..fd2e54f --- a/lib/python/Screens/DefaultWizard.py +++ b/lib/python/Screens/DefaultWizard.py @@ -1,23 +1,21 @@ from Wizard import wizardManager from Screens.WizardLanguage import WizardLanguage -from Tools.Directories import crawlDirectory, resolveFilename, SCOPE_DEFAULTDIR, SCOPE_DEFAULTPARTITIONMOUNTDIR, SCOPE_DEFAULTPARTITION +from Tools.Directories import pathExists, resolveFilename, SCOPE_DEFAULTDIR, SCOPE_DEFAULTPARTITIONMOUNTDIR, SCOPE_DEFAULTPARTITION from Components.Pixmap import Pixmap, MovingPixmap from Components.config import config, ConfigBoolean, configfile, ConfigYesNo, getConfigListEntry -from Components.DreamInfoHandler import DreamInfoHandler, InfoHandler, InfoHandlerParseError -import os +from Components.DreamInfoHandler import DreamInfoHandler +from Components.PluginComponent import plugins +from Plugins.Plugin import PluginDescriptor +from os import system as os_system, path as os_path, mkdir config.misc.defaultchosen = ConfigBoolean(default = True) -import xml.sax - class DefaultWizard(WizardLanguage, DreamInfoHandler): - def __init__(self, session, silent = True): - DreamInfoHandler.__init__(self, self.statusCallback) + def __init__(self, session, silent = True, showSteps = False, neededTag = None): + DreamInfoHandler.__init__(self, self.statusCallback, neededTag = neededTag) self.silent = silent - os.system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR))) - self.directory = resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR) - self.xmlfile = "defaultwizard.xml" + self.setDirectory() WizardLanguage.__init__(self, session, showSteps = False) self["wizard"] = Pixmap() @@ -25,6 +23,12 @@ class DefaultWizard(WizardLanguage, DreamInfoHandler): self["arrowdown"] = MovingPixmap() self["arrowup"] = MovingPixmap() self["arrowup2"] = MovingPixmap() + + def setDirectory(self): + self.directory = resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR) + self.xmlfile = "defaultwizard.xml" + if self.directory: + os_system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), self.directory)) def markDone(self): config.misc.defaultchosen.value = 0 @@ -34,7 +38,7 @@ class DefaultWizard(WizardLanguage, DreamInfoHandler): def statusCallback(self, status, progress): print "statusCallback:", status, progress if status == DreamInfoHandler.STATUS_DONE: - self["text"].setText(_("The installation of the default settings is finished. You can now continue configuring your Dreambox by pressing the OK button on the remote control.")) + self["text"].setText(_("The installation of the default settings is finished. You can now continue configuring your STB by pressing the OK button on the remote control.")) self.markDone() self.disableKeys = False @@ -52,11 +56,22 @@ class DefaultWizard(WizardLanguage, DreamInfoHandler): def selectionMade(self): print "selection made" #self.installPackage(int(index)) - indexList = [] + self.indexList = [] for x in range(len(self.packagesConfig)): if self.packagesConfig[x].value: - indexList.append(x) - self.installPackages(indexList) + 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): @@ -67,8 +82,38 @@ class ImageDefaultInstaller(DreamInfoHandler): 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 + return \ + Scanner(mimetypes = ["application/x-dream-package"], + paths_to_scan = + [ + ScanPath(path = "dmpkg", with_subdirs = True), + ScanPath(path = "", with_subdirs = False), + ], + name = "STB-Package", + description = _("Install settings, skins, software..."), + openfnc = filescan_open, ) + +print "add dreampackage scanner plugin" +plugins.addPlugin(PluginDescriptor(name="STB-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()