r240 - branches/rewrite/src
Otavio Salvador
partial-mirror-devel@lists.alioth.debian.org
Wed, 22 Sep 2004 08:54:44 -0600
Author: otavio
Date: Wed Sep 22 08:54:43 2004
New Revision: 240
Modified:
branches/rewrite/src/Download.py
Log:
Add counter on Downlad manager.
Modified: branches/rewrite/src/Download.py
==============================================================================
--- branches/rewrite/src/Download.py (original)
+++ branches/rewrite/src/Download.py Wed Sep 22 08:54:43 2004
@@ -28,12 +28,16 @@
import pdb
class DownloadQueue(Queue):
+ counter = 0
+
""" Implement a Queue without duplicated items. """
def _put(self, item):
if item not in self.queue:
self.queue.append(item)
class DownloadThread(threading.Thread):
+ Lock = threading.Lock()
+
def __init__(self):
self.DisplayInfo = DisplayInfo.ProgressBar()
threading.Thread.__init__(self)
@@ -56,6 +60,11 @@
self.url = url
self.DisplayInfo.text = self.url
+
+ # Store counter information about it
+ self.Lock.acquire()
+ DownloadQueue.counter += 1
+ self.Lock.release()
try:
curl.perform()
@@ -71,8 +80,7 @@
def progress(self, download_t, download_d, upload_t, upload_d):
self.DisplayInfo.max = download_t
self.DisplayInfo.current = download_d
- self.DisplayInfo.refresh()
-
+ d.refresh()
class Download:
""" Download queue """