diff --git a/GTG/gtk/browser/modify_tags.py b/GTG/gtk/browser/modify_tags.py index 2a3cf2f16c..d307d54bdd 100644 --- a/GTG/gtk/browser/modify_tags.py +++ b/GTG/gtk/browser/modify_tags.py @@ -47,6 +47,27 @@ def __init__(self, tag_completion, app): self.last_tag_entry = _("NewTag") self.last_apply_to_subtasks = False + + def parse_tag_list(self, text): + """ Parse a line of a list of tasks. User can specify if the tag is + positive or not by prepending '!'. + + @param text: string entry from user + @return: list of tupples (tag, is_positive) + """ + + result = [] + for tag in text.split(): + if tag.startswith('!'): + tag = tag[1:] + is_positive = False + else: + is_positive = True + + result.append((tag, is_positive)) + return result + + def modify_tags(self, tasks): """ Show and run dialog for selected tasks """ @@ -71,7 +92,7 @@ def on_response(self, widget, response): def apply_changes(self): """ Apply changes """ - tags = parse_tag_list(self._tag_entry.get_text()) + tags = self.parse_tag_list(self._tag_entry.get_text()) # If the checkbox is checked, find all subtasks if self._apply_to_subtasks_check.get_active():