fix for unused buttons on bottom row
[enigma2.git] / lib / python / Screens / DefaultWizard.py
index 33a3d20efa819124b0cadfbadf8fea05c8175829..73b07acf5b07c72caa136fee76e2068ffd297c7d 100644 (file)
@@ -1,21 +1,19 @@
 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
+from Components.DreamInfoHandler import DreamInfoHandler
 from Components.PluginComponent import plugins
 from Plugins.Plugin import PluginDescriptor
-import os
+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
                self.setDirectory()
         
@@ -27,7 +25,7 @@ class DefaultWizard(WizardLanguage, DreamInfoHandler):
                self["arrowup2"] = MovingPixmap()
        
        def setDirectory(self):
-               os.system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)))
+               os_system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)))
                self.directory = resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)
                self.xmlfile = "defaultwizard.xml"
         
@@ -57,16 +55,16 @@ 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):
-               os.system("mkdir /tmp/package")
-               os.system("tar xpzf %s -C /tmp/package" % packagefile)
+               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)
                
@@ -86,20 +84,18 @@ class ImageDefaultInstaller(DreamInfoHandler):
 
 def install(choice):
        if choice is not None:
-               #os.system("mkdir /tmp/package && tar xpzf %s ")
+               #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]
+       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 = 
@@ -108,7 +104,7 @@ def filescan(**kwargs):
                                        ScanPath(path = "", with_subdirs = False), 
                                ], 
                        name = "Dream-Package", 
-                       description = "Install settings, skins, software..."
+                       description = _("Install settings, skins, software...")
                        openfnc = filescan_open, )
 
 print "add dreampackage scanner plugin"