summaryrefslogtreecommitdiffstats
path: root/pyload/threads/AddonThread.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-11-26 21:50:02 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-11-26 21:50:02 +0100
commitd43b66838414e219b7ffecfe917b7d4a8354418e (patch)
treebea2492aa4840be34a53bd26064f4c333d25790e /pyload/threads/AddonThread.py
parentinvoke addons via context menu (diff)
downloadpyload-d43b66838414e219b7ffecfe917b7d4a8354418e.tar.xz
extraction via context menu + progress information working
Diffstat (limited to 'pyload/threads/AddonThread.py')
-rw-r--r--pyload/threads/AddonThread.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/pyload/threads/AddonThread.py b/pyload/threads/AddonThread.py
index afb56f66b..fd613bdec 100644
--- a/pyload/threads/AddonThread.py
+++ b/pyload/threads/AddonThread.py
@@ -4,6 +4,7 @@
from copy import copy
from traceback import print_exc
+from pyload.Api import ProgressInfo
from BaseThread import BaseThread
class AddonThread(BaseThread):
@@ -18,6 +19,7 @@ class AddonThread(BaseThread):
self.kwargs = kwargs
self.active = []
+ self.progress = 0
m.localThreads.append(self)
@@ -26,6 +28,18 @@ class AddonThread(BaseThread):
def getActiveFiles(self):
return self.active
+ # TODO: multiple progresses
+ def setProgress(self, progress, pyfile=None):
+ """ Sets progress for the thread in percent"""
+ self.progress = progress
+
+ def getProgress(self):
+ """ Progress of the thread """
+ if self.active:
+ active = self.active[0]
+ return ProgressInfo(active.pluginname, active.name, active.getStatusName(), 0,
+ self.progress, 100)
+
def addActive(self, pyfile):
""" Adds a pyfile to active list and thus will be displayed on overview"""
if pyfile not in self.active: