From 580caf6f5c9b795f9c38b9c970efce12d006ce1d Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Fri, 17 Feb 2023 08:25:44 +0100 Subject: New UI design * Moved style definitions to its own file (themes/default) * Updated the desktop.kv to the new UI design * Removed planes * Adjusted port config --- tagit/actions/__init__.py | 5 ----- tagit/actions/action.kv | 15 ------------- tagit/actions/planes.kv | 15 ------------- tagit/actions/planes.py | 57 ----------------------------------------------- 4 files changed, 92 deletions(-) delete mode 100644 tagit/actions/planes.kv delete mode 100644 tagit/actions/planes.py (limited to 'tagit/actions') diff --git a/tagit/actions/__init__.py b/tagit/actions/__init__.py index b2ab6bd..bcd71c0 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 @@ -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/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 - -: - source: resource_find('atlas://planes/dashboard') - tooltip: 'Switch to the Dashboard' - -: - source: resource_find('atlas://planes/browsing') - tooltip: 'Switch to the browsing plane' - -: - 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 ## -- cgit v1.2.3 From 906076a24fd3baca68e0381aca1953a05f5b45b7 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Fri, 17 Feb 2023 08:29:26 +0100 Subject: Fixes: * Preview loading in browser * Search via bsfs.Graph.sorted to preserve order * Fixes in parsing.filter.to_string --- tagit/actions/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tagit/actions') diff --git a/tagit/actions/search.py b/tagit/actions/search.py index ca36a51..630413f 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.bsfs.File, query)) Cache.append(self._CACHE_CATEGORY, (query, sort), items) # apply search order because it's cheaper to do it here rather -- cgit v1.2.3 From 7eb2a8074752887afc8845900af2c3c0fb67388e Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Sat, 4 Mar 2023 14:09:17 +0100 Subject: tag uri bugfix --- tagit/actions/tagging.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'tagit/actions') diff --git a/tagit/actions/tagging.py b/tagit/actions/tagging.py index 8a20702..611db8e 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 @@ -67,7 +70,7 @@ 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.bsfs.Tag, TAG_PREFIX[urllib.parse.quote(lbl)]) tag.set(ns.bst.label, lbl) tags.add(tag) with self.root.browser as browser, \ @@ -134,7 +137,7 @@ 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.bsfs.Tag, TAG_PREFIX[urllib.parse.quote(lbl)]) tag.set(ns.bst.label, lbl) added.add(tag) added = reduce(operator.add, added) -- cgit v1.2.3 From 141cfeade2750e0255ca010079421efce4abeca2 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Sat, 4 Mar 2023 14:16:00 +0100 Subject: namespace updates --- tagit/actions/filter.py | 4 ++-- tagit/actions/grouping.py | 7 ++++--- tagit/actions/search.py | 2 +- tagit/actions/tagging.py | 12 +++++++----- 4 files changed, 14 insertions(+), 11 deletions(-) (limited to 'tagit/actions') 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) -- cgit v1.2.3 From a4be2d7d5752ed68a5c0f5fa46a1058f17b9ca01 Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Sat, 4 Mar 2023 14:16:56 +0100 Subject: empty tag set bugfix --- tagit/actions/tagging.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tagit/actions') diff --git a/tagit/actions/tagging.py b/tagit/actions/tagging.py index 90e5931..ab25cb8 100644 --- a/tagit/actions/tagging.py +++ b/tagit/actions/tagging.py @@ -79,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) @@ -130,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()} @@ -142,7 +142,7 @@ class EditTag(Action): 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: -- cgit v1.2.3 From 123477ea13f061e4c4898303726811f7965c91dd Mon Sep 17 00:00:00 2001 From: Matthias Baumgartner Date: Sat, 4 Mar 2023 16:01:35 +0100 Subject: misc minor fixes --- tagit/actions/__init__.py | 4 ++-- tagit/actions/misc.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tagit/actions') diff --git a/tagit/actions/__init__.py b/tagit/actions/__init__.py index bcd71c0..b8b65b8 100644 --- a/tagit/actions/__init__.py +++ b/tagit/actions/__init__.py @@ -79,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, 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__ = [] -- cgit v1.2.3