From 1622ac4343bff59c8132f96c7af5427d8dc0d5ea Mon Sep 17 00:00:00 2001 From: Marco de Freitas <marco@sillage.ch> Date: Sun, 14 Jun 2020 22:02:41 +0200 Subject: [PATCH] Documentation, Keywords Cat --- didacto/controller.py | 2 +- didacto/model.py | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/didacto/controller.py b/didacto/controller.py index 0dca1f1..76b3c0d 100644 --- a/didacto/controller.py +++ b/didacto/controller.py @@ -183,7 +183,7 @@ class Controller: for key in metadata_in: metadata_out[key]=metadata_in[key] if '/AAPL:Keywords' in metadata_out: - metadata_out.pop('/AAPL:Keywords') # to fix some bug with sibelius6 - MacOs pdf + metadata_out.pop('/AAPL:Keywords') # this fixes some bug with sibelius6 - MacOs pdf print(metadata_out) print(type(metadata_out)) diff --git a/didacto/model.py b/didacto/model.py index c6df394..d7a05ba 100644 --- a/didacto/model.py +++ b/didacto/model.py @@ -153,6 +153,17 @@ class Model: class UserData(): + '''This Class stores user data, keyword definition and categories + curent {'keyword1':'definition1', etc.} + future {'keyword1':{'definition':'definition1', + 'categories':['cat1','cat2', etc.] + }} + simpler {'keyword1':'definition1',['cat1','cat2','cat3']} + + even simpler, two different dics, in two files + or go for sql lite ??? + ''' + def __init__(self, data, ): self.user_data=data @@ -162,6 +173,18 @@ class UserData(): def set(self,key,data): self.user_data[key] = data + +# new methods to handle keywords categories + def get_categories(self,key): + return self.user_data[key][1] + + def set_categries(self,key,cat): + self.user_data[key][1] = cat + + + + + def retrieve(self): return self.user_data -- GitLab