From db02d260c500739a71a650cc8920bd167be44c9b Mon Sep 17 00:00:00 2001 From: Seblu <sebastien.luttringer@smartjog.com> Date: Thu, 10 Feb 2011 13:07:08 +0100 Subject: [PATCH] tag maching in tadisplay color --- cccli/tagdisplay.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/cccli/tagdisplay.py b/cccli/tagdisplay.py index b1f6da4..1b418d7 100644 --- a/cccli/tagdisplay.py +++ b/cccli/tagdisplay.py @@ -50,8 +50,14 @@ class TagDisplay(object): def color(self, tagname): '''Return the current tag color''' - if tagname in self.tagcolor and self.tagcolor[tagname] in color: - return color[self.tagcolor[tagname]] + tagname = unicode(tagname) + # build list of matching pattern with tagname + l = [ x for x in self.tagcolor if fnmatch.fnmatch(tagname, x) ] + if len(l) > 0: + # select longest match + tm = max(l) + if self.tagcolor[tm] in color: + return color[self.tagcolor[tm]] return color["yellow"] def resolve(self, tagname, tagvalue): -- GitLab