fix disc size unit confusion
[vuplus_dvbapp] / lib / python / Plugins / Extensions / DVDBurn / DVDProject.py
index b0b8197..8367246 100644 (file)
@@ -2,8 +2,8 @@ from Tools.Directories import fileExists
 from Components.config import config, ConfigSubsection, ConfigInteger, ConfigText, ConfigSelection, getConfigListEntry, ConfigSequence, ConfigSubList
 
 class ConfigColor(ConfigSequence):
-       def __init__(self):
-               ConfigSequence.__init__(self, seperator = "#", limits = [(0,255),(0,255),(0,255)])
+       def __init__(self, default = [128,128,128]):
+               ConfigSequence.__init__(self, seperator = "#", limits = [(0,255),(0,255),(0,255)], default = default)
 
 class ConfigFilename(ConfigText):
        def __init__(self):
@@ -18,6 +18,8 @@ class ConfigFilename(ConfigText):
                return ("mtext"[1-selected:], filename, mark)
        
 class DVDProject:
+       MAX_SL = 4480
+       MAX_DL = 8150
        def __init__(self):
                self.titles = [ ]
                self.target = None
@@ -41,8 +43,7 @@ class DVDProject:
                return title
 
        def saveProject(self, path):
-               import xml.dom.minidom
-               from Tools.XMLTools import elementsWithTag, mergeText, stringToXML
+               from Tools.XMLTools import stringToXML
                list = []
                list.append('<?xml version="1.0" encoding="utf-8" ?>\n')
                list.append('<DreamDVDBurnerProject>\n')
@@ -114,7 +115,7 @@ class DVDProject:
                          if project.nodeType == xml.dom.minidom.Element.nodeType:
                            if project.tagName == 'settings':
                                i = 0
-                               if project.attributes.length < len(self.settings.dict()):
+                               if project.attributes.length < len(self.settings.dict())-1:
                                        self.error = "project attributes missing"
                                        raise AttributeError
                                while i < project.attributes.length:
@@ -141,6 +142,14 @@ class DVDProject:
                        return False
                return True
 
+       def getSize(self):
+               totalsize = 0
+               for title in self.titles:
+                       totalsize += title.estimatedDiskspace
+               return totalsize
+
+       size = property(getSize)
+
 class MenuTemplate(DVDProject):
        def __init__(self):
                self.settings = ConfigSubsection()
@@ -176,6 +185,8 @@ class MenuTemplate(DVDProject):
                self.settings.thumb_size = ConfigSequence(seperator = ',', default = [200,158], limits = [(0,576),(-1,720)])
                self.settings.thumb_border = ConfigInteger(default = 2, limits = (0, 20))
                self.filekeys = ["menubg", "menuaudio", "fontface_headline", "fontface_title", "fontface_subtitle"]
+               from TitleProperties import languageChoices
+               self.settings.menulang = ConfigSelection(choices = languageChoices.choices, default=languageChoices.choices[1][0])
 
        def loadTemplate(self, filename):
                ret = DVDProject.loadProject(self, filename)