diff options
| author | Andreas Frisch <andreas.frisch@multimedia-labs.de> | 2008-10-13 18:29:57 +0000 |
|---|---|---|
| committer | Andreas Frisch <andreas.frisch@multimedia-labs.de> | 2008-10-13 18:29:57 +0000 |
| commit | e713bd3d222127573350eddb3f71941fda771054 (patch) | |
| tree | 8ee0785da50ba83a2f937d1d4bc610ab17a44853 /lib/python/Screens/TaskView.py | |
| parent | cac4af3cc304626c6c600d0dfb7fce8fe7b5f7b1 (diff) | |
| download | enigma2-e713bd3d222127573350eddb3f71941fda771054.tar.gz enigma2-e713bd3d222127573350eddb3f71941fda771054.zip | |
allow DVD burning in background. to view progress of jobs, press extensions key (blue) in TV mode
Diffstat (limited to 'lib/python/Screens/TaskView.py')
| -rw-r--r-- | lib/python/Screens/TaskView.py | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/lib/python/Screens/TaskView.py b/lib/python/Screens/TaskView.py index 790e9bc6..48961f61 100644 --- a/lib/python/Screens/TaskView.py +++ b/lib/python/Screens/TaskView.py @@ -2,22 +2,27 @@ from Screen import Screen from InfoBarGenerics import InfoBarNotifications class JobView(InfoBarNotifications, Screen): - def __init__(self, session, job, cancelable = True, close_on_finish = False): + def __init__(self, session, job, parent=None, cancelable = True, backgroundable = True, close_on_finish = False): from Components.Sources.StaticText import StaticText from Components.Sources.Progress import Progress from Components.Sources.Boolean import Boolean from Components.ActionMap import ActionMap - Screen.__init__(self, session) + Screen.__init__(self, session, parent) InfoBarNotifications.__init__(self) + self.parent = parent self.job = job + self.job.taskview = self self.close_on_finish = close_on_finish - self.cancelable = cancelable self["job_name"] = StaticText(job.name) self["job_progress"] = Progress() self["job_status"] = StaticText() self["job_task"] = StaticText() self["finished"] = Boolean() + self["cancelable"] = Boolean(cancelable) + self["backgroundable"] = Boolean(backgroundable) + + self["key_blue"] = StaticText(_("Background")) self.onShow.append(self.windowShow) self.onHide.append(self.windowHide) @@ -25,7 +30,13 @@ class JobView(InfoBarNotifications, Screen): self["actions"] = ActionMap(["OkCancelActions"], { "ok": self.ok, - "cancel": self.abort + "cancel": self.ok + }) + self["ColorActions"] = ActionMap(["ColorActions"], + { + "red": self.abort, + "green": self.ok, + "blue": self.background, }) def windowShow(self): @@ -40,7 +51,7 @@ class JobView(InfoBarNotifications, Screen): j = self.job self["job_progress"].range = j.end self["job_progress"].value = j.progress - print "JobView::state_changed:", j.end, j.progress + #print "JobView::state_changed:", j.end, j.progress self["job_status"].text = {j.NOT_STARTED: _("Waiting"), j.IN_PROGRESS: _("In Progress"), j.FINISHED: _("Finished"), j.FAILED: _("Failed")}[j.status] if j.status == j.IN_PROGRESS: self["job_task"].text = j.tasks[j.current_task].name @@ -49,15 +60,24 @@ class JobView(InfoBarNotifications, Screen): if j.status in [j.FINISHED, j.FAILED]: if self.close_on_finish: self.close() - else: + self["backgroundable"].boolean = False + if j.status == j.FINISHED: self["finished"].boolean = True + self["cancelable"].boolean = False + elif j.status == j.FAILED: + self["cancelable"].boolean = True + + def background(self): + print "[background]" + if self["backgroundable"].boolean == True: + self.close(True) def ok(self): if self.job.status in [self.job.FINISHED, self.job.FAILED]: - self.close() + self.close(False) def abort(self): if self.job.status in [self.job.FINISHED, self.job.FAILED]: - self.close() - if self.cancelable: + self.close(False) + if self["cancelable"].boolean == True: self.job.cancel() |
