diff options
author | Matthias Baumgartner <dev@igsor.net> | 2023-03-04 14:16:00 +0100 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2023-03-04 14:16:00 +0100 |
commit | 141cfeade2750e0255ca010079421efce4abeca2 (patch) | |
tree | 8deb4ce8270d1b40280cda6ea3080788f2848def /tagit/actions | |
parent | 7eb2a8074752887afc8845900af2c3c0fb67388e (diff) | |
download | tagit-141cfeade2750e0255ca010079421efce4abeca2.tar.gz tagit-141cfeade2750e0255ca010079421efce4abeca2.tar.bz2 tagit-141cfeade2750e0255ca010079421efce4abeca2.zip |
namespace updates
Diffstat (limited to 'tagit/actions')
-rw-r--r-- | tagit/actions/filter.py | 4 | ||||
-rw-r--r-- | tagit/actions/grouping.py | 7 | ||||
-rw-r--r-- | tagit/actions/search.py | 2 | ||||
-rw-r--r-- | tagit/actions/tagging.py | 12 |
4 files changed, 14 insertions, 11 deletions
diff --git a/tagit/actions/filter.py b/tagit/actions/filter.py index c5cc912..52f5817 100644 --- a/tagit/actions/filter.py +++ b/tagit/actions/filter.py @@ -90,7 +90,7 @@ class AddToken(Action): def apply(self, token=None): if token is None: - sugg = self.root.session.storage.all(ns.bsfs.Tag).label(node=False) + sugg = self.root.session.storage.all(ns.bsn.Tag).label(node=False) dlg = dialogues.TokenEdit(suggestions=sugg) dlg.bind(on_ok=lambda wx: self.add_from_string(wx.text)) dlg.open() @@ -125,7 +125,7 @@ class EditToken(Action): text = kp.StringProperty('Edit token') def apply(self, token): - sugg = self.root.session.storage.all(ns.bsfs.Tag).label(node=False) + sugg = self.root.session.storage.all(ns.bsn.Tag).label(node=False) text = self.root.session.filter_to_string(token) dlg = dialogues.TokenEdit(text=text, suggestions=sugg) dlg.bind(on_ok=lambda obj: self.on_ok(token, obj)) diff --git a/tagit/actions/grouping.py b/tagit/actions/grouping.py index 05c651e..301af20 100644 --- a/tagit/actions/grouping.py +++ b/tagit/actions/grouping.py @@ -23,7 +23,7 @@ from tagit.widgets import Binding from .action import Action # constants -GROUP_PREFIX = Namespace('http://example.com/me/group') +GROUP_PREFIX = Namespace('http://example.com/me/group')() # exports __all__ = [] @@ -57,7 +57,8 @@ class CreateGroup(Action): with self.root.browser as browser, \ self.root.session as session: # create group - grp = session.storage.node(ns.bsfs.Group, GROUP_PREFIX[uuid.UUID()()]) + grp = session.storage.node(ns.bsn.Group, + getattr(GROUP_PREFIX, uuid.UUID()())) if label is not None: grp.set(ns.bsg.label, label) @@ -99,7 +100,7 @@ class DissolveGroup(Action): cursor = browser.cursor if cursor is not None and cursor in browser.folds: grp = browser.folds[cursor].group - ents = session.storage.get(ns.bsfs.Entity, + ents = session.storage.get(ns.bsn.Entity, ast.filter.Any(ns.bse.group, ast.filter.Is(grp))) #ents.remove(ns.bse.group, grp) # FIXME: mb/port #grp.delete() # FIXME: mb/port diff --git a/tagit/actions/search.py b/tagit/actions/search.py index 630413f..dd6c50c 100644 --- a/tagit/actions/search.py +++ b/tagit/actions/search.py @@ -128,7 +128,7 @@ class Search(Action, StorageAwareMixin, ConfigAwareMixin): items = Cache.get(self._CACHE_CATEGORY, (query, sort), None) if items is None: # FIXME: mb/port: consider sort - items = list(session.storage.sorted(ns.bsfs.File, query)) + items = list(session.storage.sorted(ns.bsn.Entity, query)) Cache.append(self._CACHE_CATEGORY, (query, sort), items) # apply search order because it's cheaper to do it here rather diff --git a/tagit/actions/tagging.py b/tagit/actions/tagging.py index 611db8e..90e5931 100644 --- a/tagit/actions/tagging.py +++ b/tagit/actions/tagging.py @@ -27,7 +27,7 @@ from .action import Action # constants TAGS_SEPERATOR = ',' -TAG_PREFIX = Namespace('http://example.com/me/tag') +TAG_PREFIX = Namespace('http://example.com/me/tag')() # exports __all__ = [] @@ -48,7 +48,7 @@ class AddTag(Action): def apply(self): if len(self.root.browser.selection) > 0: - tags = self.root.session.storage.all(ns.bsfs.Tag).label(node=True) + tags = self.root.session.storage.all(ns.bsn.Tag).label(node=True) dlg = dialogues.SimpleInput( suggestions=set(tags.values()), suggestion_sep=TAGS_SEPERATOR) @@ -70,7 +70,8 @@ class AddTag(Action): # FIXME: replace with proper tag factory for lbl in labels: if lbl not in lut: - tag = self.root.session.storage.node(ns.bsfs.Tag, TAG_PREFIX[urllib.parse.quote(lbl)]) + tag = self.root.session.storage.node(ns.bsn.Tag, + getattr(TAG_PREFIX, urllib.parse.quote(lbl))) tag.set(ns.bst.label, lbl) tags.add(tag) with self.root.browser as browser, \ @@ -96,7 +97,7 @@ class EditTag(Action): with self.root.browser as browser: if len(browser.selection) > 0: # get all known tags - all_tags = self.root.session.storage.all(ns.bsfs.Tag).label(node=True) + all_tags = self.root.session.storage.all(ns.bsn.Tag).label(node=True) # get selection tags ent_tags = browser.unfold(browser.selection).tag.label(node=True) if len(ent_tags) == 0: @@ -137,7 +138,8 @@ class EditTag(Action): # FIXME: replace with proper tag factory for lbl in added_labels: if lbl not in lut: - tag = self.root.session.storage.node(ns.bsfs.Tag, TAG_PREFIX[urllib.parse.quote(lbl)]) + tag = self.root.session.storage.node(ns.bsn.Tag, + getattr(TAG_PREFIX, urllib.parse.quote(lbl))) tag.set(ns.bst.label, lbl) added.add(tag) added = reduce(operator.add, added) |