aboutsummaryrefslogtreecommitdiffstats
path: root/tagit/actions
diff options
context:
space:
mode:
Diffstat (limited to 'tagit/actions')
-rw-r--r--tagit/actions/__init__.py9
-rw-r--r--tagit/actions/action.kv15
-rw-r--r--tagit/actions/filter.py4
-rw-r--r--tagit/actions/grouping.py7
-rw-r--r--tagit/actions/misc.py2
-rw-r--r--tagit/actions/planes.kv15
-rw-r--r--tagit/actions/planes.py57
-rw-r--r--tagit/actions/search.py2
-rw-r--r--tagit/actions/tagging.py21
9 files changed, 23 insertions, 109 deletions
diff --git a/tagit/actions/__init__.py b/tagit/actions/__init__.py
index b2ab6bd..b8b65b8 100644
--- a/tagit/actions/__init__.py
+++ b/tagit/actions/__init__.py
@@ -16,7 +16,6 @@ from . import filter
from . import grouping
from . import misc
#from . import objects
-from . import planes
from . import search
from . import session
from . import tagging
@@ -80,8 +79,8 @@ class ActionBuilder(BuilderBase):
'ShowConsole': misc.ShowConsole,
'ShowHelp': misc.ShowHelp,
'ShowSettings': misc.ShowSettings,
- 'ClipboardCopy': misc.ClipboardCopy,
- 'ClipboardPaste': misc.ClipboardPaste,
+ #'ClipboardCopy': misc.ClipboardCopy,
+ #'ClipboardPaste': misc.ClipboardPaste,
## objects
#'RotateLeft': objects.RotateLeft,
#'RotateRight': objects.RotateRight,
@@ -93,10 +92,6 @@ class ActionBuilder(BuilderBase):
#'SetRank3': objects.SetRank3,
#'SetRank4': objects.SetRank4,
#'SetRank5': objects.SetRank5,
- ## planes
- 'ShowDashboard': planes.ShowDashboard,
- 'ShowBrowsing': planes.ShowBrowsing,
- 'ShowCodash': planes.ShowCodash,
## search
'Search': search.Search,
'ShowSelected': search.ShowSelected,
diff --git a/tagit/actions/action.kv b/tagit/actions/action.kv
index 5352964..807dd18 100644
--- a/tagit/actions/action.kv
+++ b/tagit/actions/action.kv
@@ -27,19 +27,4 @@
# to be disabled **after** show.
show: []
- # decoration
- canvas.before:
- Color:
- rgba: 17 / 255, 32 / 255, 148 / 255, self.selected_alpha
- Rectangle:
- pos: self.x, self.y + 1
- size: self.size
-
- canvas.after:
- Color:
- rgba: 17 / 255, 32 / 255, 148 / 255, self.selected_alpha
- Line:
- width: 2
- rectangle: self.x, self.y, self.width, self.height
-
## EOF ##
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/misc.py b/tagit/actions/misc.py
index b7d0a87..f74e0f9 100644
--- a/tagit/actions/misc.py
+++ b/tagit/actions/misc.py
@@ -27,7 +27,7 @@ from tagit.widgets import Binding
from .action import Action
# constants
-HELP_URL = 'https://www.igsor.net/projects/tagit/'
+HELP_URL = 'https://www.bsfs.io/'
# exports
__all__ = []
diff --git a/tagit/actions/planes.kv b/tagit/actions/planes.kv
deleted file mode 100644
index 184f949..0000000
--- a/tagit/actions/planes.kv
+++ /dev/null
@@ -1,15 +0,0 @@
-#:import resource_find kivy.resources.resource_find
-
-<ShowDashboard>:
- source: resource_find('atlas://planes/dashboard')
- tooltip: 'Switch to the Dashboard'
-
-<ShowBrowsing>:
- source: resource_find('atlas://planes/browsing')
- tooltip: 'Switch to the browsing plane'
-
-<ShowCodash>:
- source: resource_find('atlas://planes/codash')
- tooltip: 'Switch to the contextual dashboard'
-
-## EOF ##
diff --git a/tagit/actions/planes.py b/tagit/actions/planes.py
deleted file mode 100644
index 89f93bb..0000000
--- a/tagit/actions/planes.py
+++ /dev/null
@@ -1,57 +0,0 @@
-"""
-
-Part of the tagit module.
-A copy of the license is provided with the project.
-Author: Matthias Baumgartner, 2022
-"""
-# standard imports
-import os
-
-# kivy imports
-from kivy.lang import Builder
-import kivy.properties as kp
-
-# inner-module imports
-from .action import Action
-
-# exports
-__all__ = []
-
-
-## code ##
-
-# load kv
-Builder.load_file(os.path.join(os.path.dirname(__file__), 'planes.kv'))
-
-# classes
-
-class ShowDashboard(Action):
- """Switch to the dashboard."""
- text = kp.StringProperty('Dashboard')
-
- def apply(self):
- planes = self.root.planes
- if planes.current_slide != planes.dashboard:
- planes.load_slide(planes.dashboard)
-
-
-class ShowBrowsing(Action):
- """Switch to the browsing plane."""
- text = kp.StringProperty('Browsing')
-
- def apply(self):
- planes = self.root.planes
- if planes.current_slide != planes.browsing:
- planes.load_slide(planes.browsing)
-
-
-class ShowCodash(Action):
- """Switch to the contextual dashboard."""
- text = kp.StringProperty('Context')
-
- def apply(self):
- planes = self.root.planes
- if planes.current_slide != planes.codash:
- planes.load_slide(planes.codash)
-
-## EOF ##
diff --git a/tagit/actions/search.py b/tagit/actions/search.py
index ca36a51..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.get(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 8a20702..ab25cb8 100644
--- a/tagit/actions/tagging.py
+++ b/tagit/actions/tagging.py
@@ -9,6 +9,9 @@ from functools import reduce, partial
import operator
import os
+# external imports
+import urllib.parse
+
# kivy imports
from kivy.lang import Builder
import kivy.properties as kp
@@ -24,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__ = []
@@ -45,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)
@@ -67,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[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, \
@@ -75,7 +79,7 @@ class AddTag(Action):
# get objects
ents = browser.unfold(browser.selection)
# collect tags
- tags = reduce(operator.add, tags) # FIXME: mb/port: pass set once supported by Nodes.set
+ tags = reduce(operator.add, tags, self.root.session.storage.empty(ns.bsn.Tag)) # FIXME: mb/port: pass set once supported by Nodes.set
# set tags
ents.set(ns.bse.tag, tags)
session.dispatch('on_predicate_modified', ns.bse.tag, ents, tags)
@@ -93,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:
@@ -126,7 +130,7 @@ class EditTag(Action):
added_labels = labels - original_labels
# get tags of removed labels
removed = {tag for tag, lbl in tags.items() if lbl in removed_labels}
- removed = reduce(operator.add, removed)
+ removed = reduce(operator.add, removed, self.root.session.storage.empty(ns.bsn.Tag))
# get tags of added labels
# FIXME: deny adding tags if tag vocabulary is fixed (ontology case)
lut = {label: tag for tag, label in tags.items()}
@@ -134,10 +138,11 @@ 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[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)
+ added = reduce(operator.add, added, self.root.session.storage.empty(ns.bsn.Tag))
# apply differences
with self.root.browser as browser, \
self.root.session as session: