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 | |
| 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')
| -rw-r--r-- | lib/python/Screens/InfoBar.py | 8 | ||||
| -rw-r--r-- | lib/python/Screens/InfoBarGenerics.py | 24 | ||||
| -rw-r--r-- | lib/python/Screens/TaskView.py | 38 |
3 files changed, 57 insertions, 13 deletions
diff --git a/lib/python/Screens/InfoBar.py b/lib/python/Screens/InfoBar.py index 92510141..a6b2516e 100644 --- a/lib/python/Screens/InfoBar.py +++ b/lib/python/Screens/InfoBar.py @@ -20,7 +20,7 @@ from Screens.InfoBarGenerics import InfoBarShowHide, \ InfoBarSubserviceSelection, InfoBarShowMovies, InfoBarTimeshift, \ InfoBarServiceNotifications, InfoBarPVRState, InfoBarCueSheetSupport, InfoBarSimpleEventView, \ InfoBarSummarySupport, InfoBarMoviePlayerSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, \ - InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport + InfoBarSubtitleSupport, InfoBarPiP, InfoBarPlugins, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport, InfoBarJobman profile("LOAD:InitBar_Components") from Components.ActionMap import HelpableActionMap @@ -36,7 +36,7 @@ class InfoBar(InfoBarBase, InfoBarShowHide, HelpableScreen, InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, InfoBarTeletextPlugin, InfoBarExtensions, - InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport, + InfoBarPiP, InfoBarPlugins, InfoBarSubtitleSupport, InfoBarSleepTimer, InfoBarServiceErrorPopupSupport, InfoBarJobman, Screen): ALLOW_SUSPEND = True @@ -57,8 +57,8 @@ class InfoBar(InfoBarBase, InfoBarShowHide, InfoBarInstantRecord, InfoBarAudioSelection, \ InfoBarAdditionalInfo, InfoBarNotifications, InfoBarDish, InfoBarSubserviceSelection, \ InfoBarTimeshift, InfoBarSeek, InfoBarSummarySupport, InfoBarTimeshiftState, \ - InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarSleepTimer, \ - InfoBarPlugins, InfoBarServiceErrorPopupSupport: + InfoBarTeletextPlugin, InfoBarExtensions, InfoBarPiP, InfoBarSubtitleSupport, InfoBarJobman, \ + InfoBarSleepTimer, InfoBarPlugins, InfoBarServiceErrorPopupSupport: x.__init__(self) self.helpList.append((self["actions"], "InfobarActions", [("showMovies", _("view recordings..."))])) diff --git a/lib/python/Screens/InfoBarGenerics.py b/lib/python/Screens/InfoBarGenerics.py index f0130fc7..6cd310be 100644 --- a/lib/python/Screens/InfoBarGenerics.py +++ b/lib/python/Screens/InfoBarGenerics.py @@ -1274,6 +1274,30 @@ class InfoBarPlugins: def runPlugin(self, plugin): plugin(session = self.session, servicelist = self.servicelist) +from Components.Task import job_manager +class InfoBarJobman: + def __init__(self): + self.addExtension(extension = self.getJobList, type = InfoBarExtensions.EXTENSION_LIST) + + def getJobList(self): + list = [] + for job in job_manager.getPendingJobs(): + list.append(((boundFunction(self.getJobName, job), boundFunction(self.showJobView, job), lambda: True), None)) + return list + + def getJobName(self, job): + statustext = {job.NOT_STARTED: _("Waiting"), job.IN_PROGRESS: _("In Progress"), job.FINISHED: _("Finished"), job.FAILED: _("Failed")}[job.status] + return "%s: %s (%d%%)" % (statustext, job.name, int(100*job.progress/float(job.end))) + + def showJobView(self, job): + from Screens.TaskView import JobView + job_manager.in_background = False + self.session.openWithCallback(self.JobViewCB, JobView, job) + + def JobViewCB(self, in_background): + from Screens.TaskView import JobView + job_manager.in_background = in_background + # depends on InfoBarExtensions class InfoBarSleepTimer: def __init__(self): 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() |
