diff options
author | Matthias Baumgartner <dev@igsor.net> | 2023-01-29 11:31:16 +0100 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2023-01-29 11:31:16 +0100 |
commit | 4d0ce7fb62eaad3a1f705ec3c77744e3ebc96a9e (patch) | |
tree | dbaf156f663de415bbcb9298d45b45d021d23612 /tagit/widgets | |
parent | d531555fe3483fac7676aa634f3787e8eab9b67f (diff) | |
download | tagit-4d0ce7fb62eaad3a1f705ec3c77744e3ebc96a9e.tar.gz tagit-4d0ce7fb62eaad3a1f705ec3c77744e3ebc96a9e.tar.bz2 tagit-4d0ce7fb62eaad3a1f705ec3c77744e3ebc96a9e.zip |
session actions port
Diffstat (limited to 'tagit/widgets')
-rw-r--r-- | tagit/widgets/session.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/tagit/widgets/session.py b/tagit/widgets/session.py index f45ab35..e97a688 100644 --- a/tagit/widgets/session.py +++ b/tagit/widgets/session.py @@ -5,7 +5,7 @@ A copy of the license is provided with the project. Author: Matthias Baumgartner, 2022 """ # standard imports -from threading import current_thread +import os import typing # kivy imports @@ -16,8 +16,7 @@ import kivy.properties as kp # tagit imports from tagit import parsing from tagit.config.loader import load_settings -#from tagit.storage.broker import Broker # FIXME: mb/port -#from tagit.storage.loader import load_broker, load_log # FIXME: mb/port +from tagit.utils import bsfs # exports __all__: typing.Sequence[str] = ( @@ -63,10 +62,20 @@ class Session(Widget): def load(self, cfg): """Load the session from configuration *cfg*.""" - self.cfg = cfg + #self.log = load_log(cfg) # FIXME: mb/port # initialize storages from config - self.log = load_log(cfg) - self.storage = load_broker(cfg) + # open BSFS storage + store = bsfs.Open(cfg('session', 'bsfs')) + # check storage schema + # FIXME: how to properly load the required schema? + with open(os.path.join(os.path.dirname(__file__), '..', 'apps', 'port-schema.nt'), 'rt') as ifile: + required_schema = bsfs.schema.from_string(ifile.read()) + # FIXME: Since the store isn't persistent, we migrate to the required one here. + #if not required_schema <= store.schema: + # raise Exception('') + store.migrate(required_schema) + # replace current with new storage + self.storage = store def update_settings_key(self, key, value): # change setting |