from Components.Sources.Progress import Progress
from Components.Task import Task, Job, job_manager, Condition
from Components.ScrollLabel import ScrollLabel
+from Components.Harddisk import harddiskmanager
class DVDToolbox(Screen):
skin = """
<widget source="space_label" render="Label" position="20,414" size="520,22" zPosition="2" font="Regular;18" halign="center" transparent="1" foregroundColor="#000000" />
</screen>"""
- def __init__(self, session, project = None):
+ def __init__(self, session):
Screen.__init__(self, session)
- self.project = project
self["key_red"] = StaticText(_("Exit"))
self["key_green"] = StaticText(_("Update"))
job = DVDinfoJob(self)
job_manager.AddJob(job)
- def infoJobCB(self):
+ def infoJobCB(self, in_background=False):
capacity = 1
used = 0
infotext = ""
print "[Disc status] capacity=%d, used=0" % (capacity)
capacity = used
used = 0
+ elif line.find("Free Blocks:") > -1:
+ try:
+ size = eval(line[14:].replace("KB","*1024"))
+ except:
+ size = 0
+ if size > 0:
+ capacity = size
+ used = capacity-used
+ print "[free blocks] capacity=%d, used=%d" % (capacity, used)
infotext += line
self["details"].setText(infotext)
if self.formattable:
self["key_yellow"].text = _("Format")
else:
self["key_yellow"].text = ""
- percent = 100 * used / capacity
+ percent = 100 * used / (capacity or 1)
if capacity > 4600:
self["space_label"].text = "%d / %d MB" % (used, capacity) + " (%.2f%% " % percent + _("of a DUAL layer medium used.") + ")"
self["space_bar"].value = int(percent)
self.toolbox = job.toolbox
self.postconditions.append(DVDformatTaskPostcondition())
self.setTool("/bin/dvd+rw-format")
- self.args += [ "/dev/cdroms/cdrom0" ]
+ self.args += [ "/dev/" + harddiskmanager.getCD() ]
self.end = 1100
def prepare(self):
self.toolbox = job.toolbox
self.postconditions.append(DVDinfoTaskPostcondition())
self.setTool("/bin/dvd+rw-mediainfo")
- self.args += [ "/dev/cdroms/cdrom0" ]
+ self.args += [ "/dev/" + harddiskmanager.getCD() ]
def prepare(self):
self.error = None