r244 - branches/rewrite/src
Otavio Salvador
partial-mirror-devel@lists.alioth.debian.org
Wed, 22 Sep 2004 10:01:19 -0600
Author: otavio
Date: Wed Sep 22 10:01:18 2004
New Revision: 244
Modified:
branches/rewrite/src/Download.py
Log:
Refactore to better access control in base structure.
Modified: branches/rewrite/src/Download.py
==============================================================================
--- branches/rewrite/src/Download.py (original)
+++ branches/rewrite/src/Download.py Wed Sep 22 10:01:18 2004
@@ -32,12 +32,14 @@
self.queue.append(item)
class DownloadThread(threading.Thread):
- Lock = threading.Lock()
+ """ Implement a Download Thread and use a DisplayInfo class to
+ notify the user about what it's currently doing."""
+ _Lock = threading.Lock()
def __init__(self, DisplayInfo):
- self.DisplayInfo = DisplayInfo
- self.ProgressBar = DisplayInfo.ProgressBar()
- self.DisplayInfo.append(self.ProgressBar)
+ self._DisplayInfo = DisplayInfo
+ self._ProgressBar = DisplayInfo.ProgressBar()
+ self._DisplayInfo.append(self.ProgressBar)
threading.Thread.__init__(self)
def run(self):
@@ -57,13 +59,13 @@
self.url = url
- self.ProgressBar.text = self.url
+ self._ProgressBar.text = self.url
# Store counter information about it
- self.Lock.acquire()
+ self._Lock.acquire()
DownloadQueue.counter += 1
- self.counter = DownloadQueue.counter
- self.Lock.release()
+ self._counter = DownloadQueue.counter
+ self._Lock.release()
try:
curl.perform()
@@ -75,9 +77,9 @@
f.close()
def progress(self, download_t, download_d, upload_t, upload_d):
- self.ProgressBar.max = download_t
- self.ProgressBar.current = download_d
- self.DisplayInfo.refresh()
+ self._ProgressBar.max = download_t
+ self._ProgressBar.current = download_d
+ self._DisplayInfo.refresh()
class Download:
""" Download queue """