- Get the database from a different place.

- Added support for multi-line descriptions. Doesn't look nice
yet in Package Manager.
This commit is contained in:
Jack Jansen 2003-05-29 22:07:27 +00:00
parent 38c9266f42
commit 9f0c5754a6
2 changed files with 24 additions and 11 deletions

View File

@ -44,7 +44,7 @@ DEFAULT_FLAVORORDER=['source', 'binary']
DEFAULT_DOWNLOADDIR='/tmp'
DEFAULT_BUILDDIR='/tmp'
DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib()
DEFAULT_PIMPDATABASE="http://homepages.cwi.nl/~jack/pimp/pimp-%s.plist" % distutils.util.get_platform()
DEFAULT_PIMPDATABASE="http://homepages.cwi.nl/~jack/pimp-0.2/pimp-%s.plist" % distutils.util.get_platform()
def _cmd(output, dir, *cmditems):
"""Internal routine to run a shell command in a given directory."""
@ -266,7 +266,7 @@ class PimpDatabase:
sys.stderr.write("Warning: database version %s newer than pimp version %s\n"
% (self._version, PIMP_VERSION))
self._maintainer = dict.get('Maintainer', '')
self._description = dict.get('Description', '')
self._description = dict.get('Description', '').strip()
self._appendPackages(dict['Packages'])
others = dict.get('Include', [])
for url in others:
@ -390,7 +390,7 @@ class PimpPackage:
def name(self): return self._dict['Name']
def version(self): return self._dict.get('Version')
def flavor(self): return self._dict.get('Flavor')
def description(self): return self._dict['Description']
def description(self): return self._dict['Description'].strip()
def homepage(self): return self._dict.get('Home-page')
def downloadURL(self): return self._dict.get('Download-URL')
@ -825,7 +825,7 @@ def _run(mode, verbose, force, args, prefargs):
for pkgname in args:
pkg = db.find(pkgname)
if pkg:
description = pkg.description()
description = pkg.description().split('\r\n')[0]
pkgname = pkg.fullname()
else:
description = 'Error: no such package'
@ -836,6 +836,9 @@ def _run(mode, verbose, force, args, prefargs):
print "\tDownload URL:\t", pkg.downloadURL()
except KeyError:
pass
description = pkg.description()
description = '\n\t\t\t\t\t'.join(description.split('\r\n'))
print "\tDescription:\t%s" % description
elif mode =='status':
if not args:
args = db.listnames()

View File

@ -305,7 +305,8 @@ class PimpInterface:
name = pkg.fullname()
status, _ = pkg.installed()
description = pkg.description()
rv.append((status, name, description))
description_line1 = description.split('\n')[0]
rv.append((status, name, description_line1))
return rv
def getstatus(self, number):
@ -333,19 +334,22 @@ class PackageBrowser(PimpInterface):
self.closepimp()
def setupwidgets(self):
DESCRIPTION_HEIGHT = 140
INSTALL_POS = -30
STATUS_POS = INSTALL_POS - 70
self.w = W.Window((580, 400), "Python Install Manager", minsize = (400, 200), tabbable = 0)
STATUS_POS = INSTALL_POS - (70 + DESCRIPTION_HEIGHT)
self.w = W.Window((580, 600), "Python Install Manager", minsize = (400, 400), tabbable = 0)
self.w.titlebar = W.TextBox((4, 8, 60, 18), 'Packages:')
self.w.hidden_button = W.CheckBox((-100, 4, 0, 18), 'Show Hidden', self.updatestatus)
data = self.getbrowserdata()
self.w.packagebrowser = W.MultiList((4, 24, 0, STATUS_POS-2), data, self.listhit, cols=3)
self.w.installed_l = W.TextBox((4, STATUS_POS, 60, 12), 'Installed:')
self.w.installed = W.TextBox((64, STATUS_POS, 0, 12), '')
self.w.message_l = W.TextBox((4, STATUS_POS+20, 60, 12), 'Status:')
self.w.message = W.TextBox((64, STATUS_POS+20, 0, 12), '')
self.w.installed_l = W.TextBox((4, STATUS_POS, 70, 12), 'Installed:')
self.w.installed = W.TextBox((74, STATUS_POS, 0, 12), '')
self.w.message_l = W.TextBox((4, STATUS_POS+20, 70, 12), 'Status:')
self.w.message = W.TextBox((74, STATUS_POS+20, 0, 12), '')
self.w.homepage_button = W.Button((4, STATUS_POS+40, 96, 18), 'View homepage', self.do_homepage)
self.w.description_l = W.TextBox((4, STATUS_POS+70, 70, 12), 'Description:')
self.w.description = W.EditText((74, STATUS_POS+70, 0, DESCRIPTION_HEIGHT-4))
self.w.divline = W.HorizontalLine((0, INSTALL_POS-4, 0, 0))
self.w.verbose_button = W.CheckBox((84, INSTALL_POS+4, 60, 18), 'Verbose')
@ -355,6 +359,7 @@ class PackageBrowser(PimpInterface):
self.w.user_button = W.CheckBox((340, INSTALL_POS+4, 140, 18), 'For Current User Only', self.do_user)
self.w.install_button = W.Button((4, INSTALL_POS+4, 56, 18), 'Install:', self.do_install)
self.w.open()
self.w.description.enable(0)
def updatestatus(self):
sel = self.w.packagebrowser.getselection()
@ -366,6 +371,7 @@ class PackageBrowser(PimpInterface):
self.w.message.set('')
self.w.install_button.enable(0)
self.w.homepage_button.enable(0)
self.w.description.set('')
self.w.verbose_button.enable(0)
self.w.recursive_button.enable(0)
self.w.force_button.enable(0)
@ -378,6 +384,10 @@ class PackageBrowser(PimpInterface):
self.w.message.set(message)
self.w.install_button.enable(installed != "yes" or self.w.force_button.get())
self.w.homepage_button.enable(not not self.packages[sel].homepage())
description = self.packages[sel].description()
description = description.split('\r\n')
description = '\r'.join(description)
self.w.description.set(description)
self.w.verbose_button.enable(1)
self.w.recursive_button.enable(1)
self.w.force_button.enable(1)