diff options
author | Sérgio Almeida <mephx.x@gmail.com> | 2009-07-29 20:07:51 +0100 |
---|---|---|
committer | Sérgio Almeida <mephx.x@gmail.com> | 2009-07-29 20:07:51 +0100 |
commit | 135f61f07a6faa18109071af4e688a680ff0938d (patch) | |
tree | 47dbfcc682a0b7e7766a82174caf5c73875addec /umodule.py | |
parent | fixed ui bug (diff) | |
download | uselect-135f61f07a6faa18109071af4e688a680ff0938d.tar.gz uselect-135f61f07a6faa18109071af4e688a680ff0938d.tar.bz2 uselect-135f61f07a6faa18109071af4e688a680ff0938d.zip |
Added support for string targets
Diffstat (limited to 'umodule.py')
-rw-r--r-- | umodule.py | 35 |
1 files changed, 23 insertions, 12 deletions
@@ -174,26 +174,34 @@ class Sym(Action): return options - def get_targets(self, links, option, family = []): + def get_targets(self, links, option = None, target = None, family = []): """ Builds a nested list of targets. """ parent = None for link in links: if isinstance(link, list) and not isinstance(link[0], int): - if self.get_targets(link, option, family): - if parent != None: - family.append(parent) + if self.get_targets(link, option = option, family = family, target = target): + if target == None: + if parent != None: + family.append(parent) return family else: del family[:] elif isinstance(link, list) and isinstance(link[0], int): + if option == None: - if option == link[0]: - family.append(link) - return True + if link[1].targets[link[2]] == target: + family.append(link) + return True + else: + parent = link else: - parent = link + if option == link[0]: + family.append(link) + return True + else: + parent = link def do_action(self, args): """ @@ -222,10 +230,13 @@ class Sym(Action): if len(args) != 0: if len(args) >= 1: for arg in args: - - targets = self.get_targets(links, int(arg)) - - print targets + try: + option = int(arg) + target = None + except ValueError: + option = None + target = arg + targets = self.get_targets(links, option = option, target = target) if targets != None: for target in targets: |