add tagging to possible dream info handler prerequisites
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 27 May 2008 11:47:56 +0000 (11:47 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Tue, 27 May 2008 11:47:56 +0000 (11:47 +0000)
lib/python/Components/DreamInfoHandler.py
lib/python/Screens/DefaultWizard.py

index 9878761..8e9a8a2 100644 (file)
@@ -31,7 +31,7 @@ class InfoHandler(xml.sax.ContentHandler):
        def startElement(self, name, attrs):
                print name, ":", attrs.items()
                self.elements.append(name)
        def startElement(self, name, attrs):
                print name, ":", attrs.items()
                self.elements.append(name)
-               if name in ["hardware", "bcastsystem", "satellite"]:
+               if name in ["hardware", "bcastsystem", "satellite", "tag"]:
                        if not attrs.has_key("type"):
                                        self.printError(str(name) + " tag with no type attribute")
                        if self.elements[-3] == "default":
                        if not attrs.has_key("type"):
                                        self.printError(str(name) + " tag with no type attribute")
                        if self.elements[-3] == "default":
@@ -97,9 +97,11 @@ class DreamInfoHandler:
        STATUS_ERROR = 2
        STATUS_INIT = 4
        
        STATUS_ERROR = 2
        STATUS_INIT = 4
        
-       def __init__(self, statusCallback, blocking = False):
+       def __init__(self, statusCallback, blocking = False, neededTag = None):
                self.directory = "/"
                
                self.directory = "/"
                
+               self.neededTag = neededTag
+               
                # caution: blocking should only be used, if further execution in enigma2 depends on the outcome of
                # the installer!
                self.blocking = blocking
                # caution: blocking should only be used, if further execution in enigma2 depends on the outcome of
                # the installer!
                self.blocking = blocking
@@ -142,6 +144,14 @@ class DreamInfoHandler:
                # TODO: we need to implement a hardware detection here...
                print "prerequisites:", prerequisites
                met = True
                # TODO: we need to implement a hardware detection here...
                print "prerequisites:", prerequisites
                met = True
+               if self.neededTag is None:
+                       if prerequisites.has_key("tag"):
+                               return False
+               else:
+                       if prerequisites.has_key("tag"):
+                               if self.neededTag in prerequisites["tag"]:
+                                       return True
+                       return False
                if prerequisites.has_key("bcastsystem"):
                        for bcastsystem in prerequisites["bcastsystem"]:
                                if nimmanager.hasNimType(bcastsystem):
                if prerequisites.has_key("bcastsystem"):
                        for bcastsystem in prerequisites["bcastsystem"]:
                                if nimmanager.hasNimType(bcastsystem):
@@ -271,11 +281,11 @@ class DreamInfoHandler:
 
        def mergeServices(self, directory, name, merge = False):
                print "merging services:", directory, " - ", name
 
        def mergeServices(self, directory, name, merge = False):
                print "merging services:", directory, " - ", name
-               
-               db = eDVBDB.getInstance()
-               db.reloadServicelist()
-               db.loadServicelist(directory + name)
-               db.saveServicelist()
+               if os.path.isfile(directory + name):
+                       db = eDVBDB.getInstance()
+                       db.reloadServicelist()
+                       db.loadServicelist(directory + name)
+                       db.saveServicelist()
                self.installNext()
 
        def installFavourites(self, directory, name):
                self.installNext()
 
        def installFavourites(self, directory, name):
index 33a3d20..c74e586 100644 (file)
@@ -14,8 +14,8 @@ config.misc.defaultchosen = ConfigBoolean(default = True)
 import xml.sax
 
 class DefaultWizard(WizardLanguage, DreamInfoHandler):
 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()
         
                self.silent = silent
                self.setDirectory()