Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9f0c575

Browse files
committed
- Get the database from a different place.
- Added support for multi-line descriptions. Doesn't look nice yet in Package Manager.
1 parent 38c9266 commit 9f0c575

2 files changed

Lines changed: 24 additions & 11 deletions

File tree

Lib/plat-mac/pimp.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
DEFAULT_DOWNLOADDIR='/tmp'
4545
DEFAULT_BUILDDIR='/tmp'
4646
DEFAULT_INSTALLDIR=distutils.sysconfig.get_python_lib()
47-
DEFAULT_PIMPDATABASE="http://homepages.cwi.nl/~jack/pimp/pimp-%s.plist" % distutils.util.get_platform()
47+
DEFAULT_PIMPDATABASE="http://homepages.cwi.nl/~jack/pimp-0.2/pimp-%s.plist" % distutils.util.get_platform()
4848

4949
def _cmd(output, dir, *cmditems):
5050
"""Internal routine to run a shell command in a given directory."""
@@ -266,7 +266,7 @@ def appendURL(self, url, included=0):
266266
sys.stderr.write("Warning: database version %s newer than pimp version %s\n"
267267
% (self._version, PIMP_VERSION))
268268
self._maintainer = dict.get('Maintainer', '')
269-
self._description = dict.get('Description', '')
269+
self._description = dict.get('Description', '').strip()
270270
self._appendPackages(dict['Packages'])
271271
others = dict.get('Include', [])
272272
for url in others:
@@ -390,7 +390,7 @@ def __getitem__(self, key):
390390
def name(self): return self._dict['Name']
391391
def version(self): return self._dict.get('Version')
392392
def flavor(self): return self._dict.get('Flavor')
393-
def description(self): return self._dict['Description']
393+
def description(self): return self._dict['Description'].strip()
394394
def homepage(self): return self._dict.get('Home-page')
395395
def downloadURL(self): return self._dict.get('Download-URL')
396396

@@ -825,7 +825,7 @@ def _run(mode, verbose, force, args, prefargs):
825825
for pkgname in args:
826826
pkg = db.find(pkgname)
827827
if pkg:
828-
description = pkg.description()
828+
description = pkg.description().split('\r\n')[0]
829829
pkgname = pkg.fullname()
830830
else:
831831
description = 'Error: no such package'
@@ -836,6 +836,9 @@ def _run(mode, verbose, force, args, prefargs):
836836
print "\tDownload URL:\t", pkg.downloadURL()
837837
except KeyError:
838838
pass
839+
description = pkg.description()
840+
description = '\n\t\t\t\t\t'.join(description.split('\r\n'))
841+
print "\tDescription:\t%s" % description
839842
elif mode =='status':
840843
if not args:
841844
args = db.listnames()

Mac/Tools/IDE/PackageManager.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ def getbrowserdata(self, show_hidden=1):
305305
name = pkg.fullname()
306306
status, _ = pkg.installed()
307307
description = pkg.description()
308-
rv.append((status, name, description))
308+
description_line1 = description.split('\n')[0]
309+
rv.append((status, name, description_line1))
309310
return rv
310311

311312
def getstatus(self, number):
@@ -333,19 +334,22 @@ def close(self):
333334
self.closepimp()
334335

335336
def setupwidgets(self):
337+
DESCRIPTION_HEIGHT = 140
336338
INSTALL_POS = -30
337-
STATUS_POS = INSTALL_POS - 70
338-
self.w = W.Window((580, 400), "Python Install Manager", minsize = (400, 200), tabbable = 0)
339+
STATUS_POS = INSTALL_POS - (70 + DESCRIPTION_HEIGHT)
340+
self.w = W.Window((580, 600), "Python Install Manager", minsize = (400, 400), tabbable = 0)
339341
self.w.titlebar = W.TextBox((4, 8, 60, 18), 'Packages:')
340342
self.w.hidden_button = W.CheckBox((-100, 4, 0, 18), 'Show Hidden', self.updatestatus)
341343
data = self.getbrowserdata()
342344
self.w.packagebrowser = W.MultiList((4, 24, 0, STATUS_POS-2), data, self.listhit, cols=3)
343345

344-
self.w.installed_l = W.TextBox((4, STATUS_POS, 60, 12), 'Installed:')
345-
self.w.installed = W.TextBox((64, STATUS_POS, 0, 12), '')
346-
self.w.message_l = W.TextBox((4, STATUS_POS+20, 60, 12), 'Status:')
347-
self.w.message = W.TextBox((64, STATUS_POS+20, 0, 12), '')
346+
self.w.installed_l = W.TextBox((4, STATUS_POS, 70, 12), 'Installed:')
347+
self.w.installed = W.TextBox((74, STATUS_POS, 0, 12), '')
348+
self.w.message_l = W.TextBox((4, STATUS_POS+20, 70, 12), 'Status:')
349+
self.w.message = W.TextBox((74, STATUS_POS+20, 0, 12), '')
348350
self.w.homepage_button = W.Button((4, STATUS_POS+40, 96, 18), 'View homepage', self.do_homepage)
351+
self.w.description_l = W.TextBox((4, STATUS_POS+70, 70, 12), 'Description:')
352+
self.w.description = W.EditText((74, STATUS_POS+70, 0, DESCRIPTION_HEIGHT-4))
349353

350354
self.w.divline = W.HorizontalLine((0, INSTALL_POS-4, 0, 0))
351355
self.w.verbose_button = W.CheckBox((84, INSTALL_POS+4, 60, 18), 'Verbose')
@@ -355,6 +359,7 @@ def setupwidgets(self):
355359
self.w.user_button = W.CheckBox((340, INSTALL_POS+4, 140, 18), 'For Current User Only', self.do_user)
356360
self.w.install_button = W.Button((4, INSTALL_POS+4, 56, 18), 'Install:', self.do_install)
357361
self.w.open()
362+
self.w.description.enable(0)
358363

359364
def updatestatus(self):
360365
sel = self.w.packagebrowser.getselection()
@@ -366,6 +371,7 @@ def updatestatus(self):
366371
self.w.message.set('')
367372
self.w.install_button.enable(0)
368373
self.w.homepage_button.enable(0)
374+
self.w.description.set('')
369375
self.w.verbose_button.enable(0)
370376
self.w.recursive_button.enable(0)
371377
self.w.force_button.enable(0)
@@ -378,6 +384,10 @@ def updatestatus(self):
378384
self.w.message.set(message)
379385
self.w.install_button.enable(installed != "yes" or self.w.force_button.get())
380386
self.w.homepage_button.enable(not not self.packages[sel].homepage())
387+
description = self.packages[sel].description()
388+
description = description.split('\r\n')
389+
description = '\r'.join(description)
390+
self.w.description.set(description)
381391
self.w.verbose_button.enable(1)
382392
self.w.recursive_button.enable(1)
383393
self.w.force_button.enable(1)

0 commit comments

Comments
 (0)