From a78e7b73331f34875b51ec145553d7434f286cec Mon Sep 17 00:00:00 2001 From: sebnapi Date: Sun, 10 May 2009 18:41:41 +0000 Subject: new plugin-sys --- download_thread.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'download_thread.py') diff --git a/download_thread.py b/download_thread.py index ee4d4deca..7808d22f1 100644 --- a/download_thread.py +++ b/download_thread.py @@ -26,8 +26,8 @@ import urllib class Status(object): """ Saves all status information """ - def __init__(self, id, status_queue): - self.status_queue = status_queue + def __init__(self, id): + self.status_queue = None self.id = id self.total_kb = 0 self.downloaded_kb = 0 @@ -37,6 +37,8 @@ class Status(object): self.url = None def __call__(self, blocks_read, block_size, total_size): + if self.status_queue == None: + return False self.start = time() self.last_status = time() self.total_kb = total_size / 1024 @@ -49,6 +51,9 @@ class Status(object): if self.last_status+0.2 < time(): self.status_queue.put(copy(self)) self.last_status = time() + + def set_status_queue(self, queue): + self.status_queue = queue class Download_Thread(threading.Thread): -- cgit v1.2.3