From 7cf05fe5c4fb83340d9927ee03df4172cb0b8605 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Thu, 14 Jan 2010 20:32:02 +0100 Subject: Fix display of overlay type --- layman/overlays/overlay.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/layman/overlays/overlay.py b/layman/overlays/overlay.py index 6ec2f38..9965fdd 100644 --- a/layman/overlays/overlay.py +++ b/layman/overlays/overlay.py @@ -72,8 +72,6 @@ OVERLAY_TYPES = dict((e.type_key, e) for e in ( class Overlay(object): ''' Derive the real implementations from this.''' - type = 'None' - def __init__(self, xml, config, ignore = 0, quiet = False): ''' >>> here = os.path.dirname(os.path.realpath(__file__)) @@ -308,7 +306,10 @@ class Overlay(object): result += u'\nContact : %s <%s>' % (self.owner_name, self.owner_email) else: result += u'\nContact : ' + self.owner_email - result += u'\nType : ' + self.type + if len(self.sources) == 1: + result += u'\nType : ' + self.sources[0].type + else: + result += u'\nType : ' + '/'.join(sorted(set(e.type for e in self.sources))) result += u'; Priority: ' + str(self.priority) + u'\n' description = self.description @@ -366,7 +367,13 @@ class Overlay(object): return 80 name = pad(self.name, 25) - mtype = ' [' + pad(self.type, 10) + ']' + + if len(set(e.type for e in self.sources)) == 1: + _type = self.sources[0].type + else: + _type = '%s/..' % self.sources[0].type + + mtype = ' [' + pad(_type, 10) + ']' if not width: width = terminal_width() srclen = width - 43 -- cgit v1.2.3-1-g7c22