Merge branch 'bug_747_cancel_waiting_tasks'
authorghost <andreas.monzner@multimedia-labs.de>
Wed, 14 Sep 2011 20:58:53 +0000 (22:58 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Wed, 14 Sep 2011 20:58:53 +0000 (22:58 +0200)
lib/python/Components/Task.py
lib/python/Screens/TaskView.py

index 3a755405e5a0bc73e270c5f6d1e3b3028d90f0aa..867692330ca39f41a4f9660198df93b77e223cf2 100644 (file)
@@ -108,7 +108,6 @@ class Job(object):
                        self.tasks[i].abort()
 
        def cancel(self):
-               # some Jobs might have a better idea of how to cancel a job
                self.abort()
 
 class Task(object):
@@ -305,6 +304,7 @@ class JobManager:
                        list.append(self.active_job)
                list += self.active_jobs
                return list
+
 # some examples:
 #class PartitionExistsPostcondition:
 #      def __init__(self, device):
index 6e1b752dc57a2b9a6aabac18c524fce764d6c144..5dd744fac69e9c96bc3917bdbbb84798041ec2c2 100644 (file)
@@ -2,6 +2,7 @@ from Screen import Screen
 from Components.ConfigList import ConfigListScreen
 from Components.config import config, ConfigSubsection, ConfigSelection, getConfigListEntry
 from Components.SystemInfo import SystemInfo
+from Components.Task import job_manager
 from InfoBarGenerics import InfoBarNotifications
 import Screens.Standby
 from Tools import Notifications
@@ -108,7 +109,10 @@ class JobView(InfoBarNotifications, Screen, ConfigListScreen):
                        self.close(False)
 
        def abort(self):
-               if self.job.status == self.job.IN_PROGRESS and self["cancelable"].boolean == True:
+               if self.job.status == self.job.NOT_STARTED:
+                       job_manager.active_jobs.remove(self.job)
+                       self.close(False)
+               elif self.job.status == self.job.IN_PROGRESS and self["cancelable"].boolean == True:
                        self.job.cancel()
                else:
                        self.close(False)