diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-03 10:38:46 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-08-03 10:38:46 +0000 |
| commit | 778a4b5fa470c03a598f3cf6f81ab73c3855f488 (patch) | |
| tree | 77bda2c5babe7e826539d21b2190985f6e20a09a | |
| parent | 7d126728ae138e08bfef5abd71de1e608ee7ea55 (diff) | |
| download | python-apt-778a4b5fa470c03a598f3cf6f81ab73c3855f488.tar.gz | |
* some docstrings added, more api fixing
| -rw-r--r-- | apt/cache.py | 6 | ||||
| -rw-r--r-- | apt/package.py | 3 | ||||
| -rw-r--r-- | doc/examples/gui-inst.py | 2 | ||||
| -rw-r--r-- | doc/examples/progress.py | 28 |
4 files changed, 22 insertions, 17 deletions
diff --git a/apt/cache.py b/apt/cache.py index 39640da7..7ec99c22 100644 --- a/apt/cache.py +++ b/apt/cache.py @@ -25,7 +25,11 @@ from apt.progress import OpTextProgress from UserDict import UserDict class Cache(object): - """ Package cache object """ + """ Dictionary-like package cache + This class has all the packages that are available in it's + dictionary + """ + def __init__(self, progress=None): self._callbacks = {} self.open(progress) diff --git a/apt/package.py b/apt/package.py index bae90b05..2368327b 100644 --- a/apt/package.py +++ b/apt/package.py @@ -23,7 +23,8 @@ import apt_pkg, string import random class Package(object): - + """ This class represents a package in the cache + """ def __init__(self, cache, depcache, records, pcache, pkgiter): """ Init the Package object """ self._cache = cache # low level cache diff --git a/doc/examples/gui-inst.py b/doc/examples/gui-inst.py index 677fee8b..b2f64e91 100644 --- a/doc/examples/gui-inst.py +++ b/doc/examples/gui-inst.py @@ -34,7 +34,7 @@ class GuiFetchProgress(gtk.Window, FetchProgress): self.hide() def pulse(self): self.label.set_text("Speed: %s/s" % apt_pkg.SizeToStr(self.currentCPS)) - self.progress.set_fraction(self.CurrentBytes/self.totalBytes) + self.progress.set_fraction(self.currentBytes/self.totalBytes) while gtk.events_pending(): gtk.main_iteration() diff --git a/doc/examples/progress.py b/doc/examples/progress.py index d96b8916..e2ff97e2 100644 --- a/doc/examples/progress.py +++ b/doc/examples/progress.py @@ -7,14 +7,14 @@ class TextProgress(apt.OpProgress): def __init__(self): self.last=0.0 - def Update(self, percent): + def update(self, percent): if (self.last + 1.0) <= percent: sys.stdout.write("\rProgress: %i.2 " % (percent)) self.last = percent if percent >= 100: self.last = 0.0 - def Done(self): + def done(self): self.last = 0.0 print "\rDone " @@ -23,18 +23,18 @@ class TextFetchProgress(apt.FetchProgress): def __init__(self): pass - def Start(self): + def start(self): pass - def Stop(self): + def stop(self): pass - def UpdateStatus(self, uri, descr, shortDescr, status): + def updateStatus(self, uri, descr, shortDescr, status): print "UpdateStatus: '%s' '%s' '%s' '%i'" % (uri,descr,shortDescr, status) - def Pulse(self): - print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % (apt_pkg.SizeToStr(self.CurrentCPS), apt_pkg.SizeToStr(self.CurrentBytes), apt_pkg.SizeToStr(self.TotalBytes), self.CurrentItems, self.TotalItems) + def pulse(self): + print "Pulse: CPS: %s/s; Bytes: %s/%s; Item: %s/%s" % (apt_pkg.SizeToStr(self.currentCPS), apt_pkg.SizeToStr(self.currentBytes), apt_pkg.SizeToStr(self.totalBytes), self.currentItems, self.totalItems) - def MediaChange(self, medium, drive): + def mediaChange(self, medium, drive): print "Please insert medium %s in drive %s" % (medium, drive) sys.stdin.readline() #return False @@ -43,11 +43,11 @@ class TextFetchProgress(apt.FetchProgress): class TextInstallProgress(apt.InstallProgress): def __init__(self): pass - def StartUpdate(self): + def startUpdate(self): print "StartUpdate" - def FinishUpdate(self): + def finishUpdate(self): print "FinishUpdate" - def UpdateInterface(self): + def updateInterface(self): # usefull to e.g. redraw a GUI time.sleep(0.1) @@ -56,15 +56,15 @@ class TextCdromProgress(apt.CdromProgress): def __init__(self): pass # update is called regularly so that the gui can be redrawn - def Update(self, text, step): + def update(self, text, step): # check if we actually have some text to display if text != "": print "Update: %s %s" % (string.strip(text), step) - def AskCdromName(self): + def askCdromName(self): print "Please enter cd-name: ", cd_name = sys.stdin.readline() return (True, string.strip(cd_name)) - def ChangeCdrom(self): + def changeCdrom(self): print "Please insert cdrom and press <ENTER>" answer = sys.stdin.readline() return True |
