Merge remote-tracking branch 'origin/bug_749_ethread_bugfix'
[enigma2.git] / lib / python / Screens / DefaultWizard.py
index ec45a28f80e87b52c57697bfe914f082e02882f6..54e241decef3e9a5553a090f963112e85dfde3ba 100644 (file)
@@ -1,13 +1,13 @@
 from Wizard import wizardManager
 from Screens.WizardLanguage import WizardLanguage
 from Wizard import wizardManager
 from Screens.WizardLanguage import WizardLanguage
-from Tools.Directories import 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
 from Components.PluginComponent import plugins
 from Plugins.Plugin import PluginDescriptor
 
 from Components.Pixmap import Pixmap, MovingPixmap
 from Components.config import config, ConfigBoolean, configfile, ConfigYesNo, getConfigListEntry
 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
+from os import system as os_system, path as os_path, mkdir
 
 config.misc.defaultchosen = ConfigBoolean(default = True)
 
 
 config.misc.defaultchosen = ConfigBoolean(default = True)
 
@@ -25,9 +25,10 @@ class DefaultWizard(WizardLanguage, DreamInfoHandler):
                self["arrowup2"] = MovingPixmap()
        
        def setDirectory(self):
                self["arrowup2"] = MovingPixmap()
        
        def setDirectory(self):
-               os_system("mount %s %s" % (resolveFilename(SCOPE_DEFAULTPARTITION), resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)))
                self.directory = resolveFilename(SCOPE_DEFAULTPARTITIONMOUNTDIR)
                self.xmlfile = "defaultwizard.xml"
                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
         
        def markDone(self):
                config.misc.defaultchosen.value = 0
@@ -59,10 +60,11 @@ class DefaultWizard(WizardLanguage, DreamInfoHandler):
                for x in range(len(self.packagesConfig)):
                        if self.packagesConfig[x].value:
                                self.indexList.append(x)
                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):
 class DreamPackageWizard(DefaultWizard):
        def __init__(self, session, packagefile, silent = False):
-               os_system("mkdir /tmp/package")
+               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)
                os_system("tar xpzf %s -C /tmp/package" % packagefile)
                self.packagefile = packagefile
                DefaultWizard.__init__(self, session, silent)
@@ -95,8 +97,6 @@ def filescan_open(list, session, **kwargs):
 
 def filescan(**kwargs):
        from Components.Scanner import Scanner, ScanPath
 
 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 = 
        return \
                Scanner(mimetypes = ["application/x-dream-package"], 
                        paths_to_scan = 
@@ -105,7 +105,7 @@ def filescan(**kwargs):
                                        ScanPath(path = "", with_subdirs = False), 
                                ], 
                        name = "Dream-Package", 
                                        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"
                        openfnc = filescan_open, )
 
 print "add dreampackage scanner plugin"