Merge lp:~gtg-user/gtg/backends-main into lp:~gtg/gtg/old-trunk
- backends-main
- Merge into old-trunk
Proposed by
Luca Invernizzi
Status: | Superseded |
---|---|
Proposed branch: | lp:~gtg-user/gtg/backends-main |
Merge into: | lp:~gtg/gtg/old-trunk |
Diff against target: |
2430 lines (+1276/-312) 14 files modified
CHANGELOG (+1/-0) GTG/backends/backend_localfile.py (+99/-71) GTG/backends/genericbackend.py (+260/-138) GTG/core/datastore.py (+156/-51) GTG/core/filteredtree.py (+4/-1) GTG/core/filters_bank.py (+2/-0) GTG/core/requester.py (+3/-0) GTG/core/task.py (+3/-1) GTG/gtk/browser/browser.py (+3/-1) GTG/tests/test_backends.py (+6/-48) GTG/tests/test_interruptible.py (+61/-0) GTG/tools/interruptible.py (+62/-0) GTG/tools/taskxml.py (+6/-1) data/icons/hicolor/scalable/apps/backend_localfile.svg (+610/-0) |
To merge this branch: | bzr merge lp:~gtg-user/gtg/backends-main |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gtg developers | Pending | ||
Review via email: mp+32583@code.launchpad.net |
This proposal has been superseded by a proposal from 2010-08-13.
Commit message
Description of the change
Update of the already merged general backends framework and the localfile backend.
Adds some bug fixes, but the main contribution is documentation.
To post a comment you must log in.
lp:~gtg-user/gtg/backends-main
updated
- 879. By Luca Invernizzi
-
added localfile png icon
- 880. By Luca Invernizzi
-
added localfile svg icon
- 881. By Luca Invernizzi
-
Icon is now in the correct place
- 882. By Luca Invernizzi
-
updated changelog
- 883. By Luca Invernizzi
-
merge with trunk
- 884. By Luca Invernizzi
-
backends can auto-flush themselves
- 885. By Luca Invernizzi
-
merge w/ trunk
- 886. By Luca Invernizzi
-
cherrypicking from my development branch
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CHANGELOG' | |||
2 | --- CHANGELOG 2010-08-04 00:30:22 +0000 | |||
3 | +++ CHANGELOG 2010-08-13 23:43:04 +0000 | |||
4 | @@ -4,6 +4,7 @@ | |||
5 | 4 | * Fixed bug with data consistency #579189, by Marko Kevac | 4 | * Fixed bug with data consistency #579189, by Marko Kevac |
6 | 5 | * Added samba bugzilla to the bugzilla plugin, by Jelmer Vernoij | 5 | * Added samba bugzilla to the bugzilla plugin, by Jelmer Vernoij |
7 | 6 | * Fixed bug #532392, a start date is later than a due date, by Volodymyr Floreskul | 6 | * Fixed bug #532392, a start date is later than a due date, by Volodymyr Floreskul |
8 | 7 | * Extended backend system to support multiple backends by Luca Invernizzi | ||
9 | 7 | 8 | ||
10 | 8 | 2010-03-01 Getting Things GNOME! 0.2.2 | 9 | 2010-03-01 Getting Things GNOME! 0.2.2 |
11 | 9 | * Autostart on login, by Luca Invernizzi | 10 | * Autostart on login, by Luca Invernizzi |
12 | 10 | 11 | ||
13 | === modified file 'GTG/backends/backend_localfile.py' | |||
14 | --- GTG/backends/backend_localfile.py 2010-06-22 20:24:01 +0000 | |||
15 | +++ GTG/backends/backend_localfile.py 2010-08-13 23:43:04 +0000 | |||
16 | @@ -20,6 +20,9 @@ | |||
17 | 20 | ''' | 20 | ''' |
18 | 21 | Localfile is a read/write backend that will store your tasks in an XML file | 21 | Localfile is a read/write backend that will store your tasks in an XML file |
19 | 22 | This file will be in your $XDG_DATA_DIR/gtg folder. | 22 | This file will be in your $XDG_DATA_DIR/gtg folder. |
20 | 23 | |||
21 | 24 | This backend contains comments that are meant as a reference, in case someone | ||
22 | 25 | wants to write a backend. | ||
23 | 23 | ''' | 26 | ''' |
24 | 24 | 27 | ||
25 | 25 | import os | 28 | import os |
26 | @@ -29,18 +32,30 @@ | |||
27 | 29 | from GTG.core import CoreConfig | 32 | from GTG.core import CoreConfig |
28 | 30 | from GTG.tools import cleanxml, taskxml | 33 | from GTG.tools import cleanxml, taskxml |
29 | 31 | from GTG import _ | 34 | from GTG import _ |
30 | 35 | from GTG.tools.logger import Log | ||
31 | 32 | 36 | ||
32 | 33 | 37 | ||
33 | 34 | 38 | ||
34 | 35 | class Backend(GenericBackend): | 39 | class Backend(GenericBackend): |
35 | 40 | ''' | ||
36 | 41 | Localfile backend, which stores your tasks in a XML file in the standard | ||
37 | 42 | XDG_DATA_DIR/gtg folder (the path is configurable). | ||
38 | 43 | An instance of this class is used as the default backend for GTG. | ||
39 | 44 | This backend loads all the tasks stored in the localfile after it's enabled, | ||
40 | 45 | and from that point on just writes the changes to the file: it does not | ||
41 | 46 | listen for eventual file changes | ||
42 | 47 | ''' | ||
43 | 36 | 48 | ||
44 | 37 | 49 | ||
45 | 38 | DEFAULT_PATH = CoreConfig().get_data_dir() #default path for filenames | 50 | DEFAULT_PATH = CoreConfig().get_data_dir() #default path for filenames |
46 | 39 | 51 | ||
47 | 40 | 52 | ||
51 | 41 | #Description of the backend (mainly it's data we show the user, only the | 53 | #General description of the backend: these are used to show a description of |
52 | 42 | # name is used internally. Please note that BACKEND_NAME and | 54 | # the backend to the user when s/he is considering adding it. |
53 | 43 | # BACKEND_ICON_NAME should *not* be translated. | 55 | # BACKEND_NAME is the name of the backend used internally (it must be |
54 | 56 | # unique). | ||
55 | 57 | #Please note that BACKEND_NAME and BACKEND_ICON_NAME should *not* be | ||
56 | 58 | #translated. | ||
57 | 44 | _general_description = { \ | 59 | _general_description = { \ |
58 | 45 | GenericBackend.BACKEND_NAME: "backend_localfile", \ | 60 | GenericBackend.BACKEND_NAME: "backend_localfile", \ |
59 | 46 | GenericBackend.BACKEND_HUMAN_NAME: _("Local File"), \ | 61 | GenericBackend.BACKEND_HUMAN_NAME: _("Local File"), \ |
60 | @@ -53,10 +68,14 @@ | |||
61 | 53 | "for GTG to save your tasks."),\ | 68 | "for GTG to save your tasks."),\ |
62 | 54 | } | 69 | } |
63 | 55 | 70 | ||
68 | 56 | #parameters to configure a new backend of this type. | 71 | #These are the parameters to configure a new backend of this type. A |
69 | 57 | #NOTE: should we always give back a different default filename? it can be | 72 | # parameter has a name, a type and a default value. |
70 | 58 | # done, but I'd like to keep this backend simple, so that it can be | 73 | # Here, we define a parameter "path", which is a string, and has a default |
71 | 59 | # used as example (invernizzi) | 74 | # value as a random file in the default path |
72 | 75 | #NOTE: to keep this simple, the filename default path is the same until GTG | ||
73 | 76 | # is restarted. I consider this a minor annoyance, and we can avoid | ||
74 | 77 | # coding the change of the path each time a backend is | ||
75 | 78 | # created (invernizzi) | ||
76 | 60 | _static_parameters = { \ | 79 | _static_parameters = { \ |
77 | 61 | "path": { \ | 80 | "path": { \ |
78 | 62 | GenericBackend.PARAM_TYPE: GenericBackend.TYPE_STRING, \ | 81 | GenericBackend.PARAM_TYPE: GenericBackend.TYPE_STRING, \ |
79 | @@ -64,30 +83,22 @@ | |||
80 | 64 | os.path.join(DEFAULT_PATH, "gtg_tasks-%s.xml" %(uuid.uuid4())) | 83 | os.path.join(DEFAULT_PATH, "gtg_tasks-%s.xml" %(uuid.uuid4())) |
81 | 65 | }} | 84 | }} |
82 | 66 | 85 | ||
83 | 67 | def _get_default_filename_path(self, filename = None): | ||
84 | 68 | ''' | ||
85 | 69 | Generates a default path with a random filename | ||
86 | 70 | @param filename: specify a filename | ||
87 | 71 | ''' | ||
88 | 72 | if not filename: | ||
89 | 73 | filename = "gtg_tasks-%s.xml" % (uuid.uuid4()) | ||
90 | 74 | return os.path.join(self.DEFAULT_PATH, filename) | ||
91 | 75 | |||
92 | 76 | def __init__(self, parameters): | 86 | def __init__(self, parameters): |
93 | 77 | """ | 87 | """ |
94 | 78 | Instantiates a new backend. | 88 | Instantiates a new backend. |
95 | 79 | 89 | ||
101 | 80 | @param parameters: should match the dictionary returned in | 90 | @param parameters: A dictionary of parameters, generated from |
102 | 81 | get_parameters. Anyway, the backend should care if one expected | 91 | _static_parameters. A few parameters are added to those, the list of |
103 | 82 | value is None or does not exist in the dictionary. | 92 | these is in the "DefaultBackend" class, look for the KEY_* constants. |
104 | 83 | @firstrun: only needed for the default backend. It should be | 93 | |
105 | 84 | omitted for all other backends. | 94 | The backend should take care if one expected value is None or |
106 | 95 | does not exist in the dictionary. | ||
107 | 85 | """ | 96 | """ |
108 | 86 | super(Backend, self).__init__(parameters) | 97 | super(Backend, self).__init__(parameters) |
110 | 87 | self.tids = [] | 98 | self.tids = [] #we keep the list of loaded task ids here |
111 | 88 | #####RETROCOMPATIBILIY | 99 | #####RETROCOMPATIBILIY |
114 | 89 | #NOTE: retrocompatibility. We convert "filename" to "path" | 100 | #NOTE: retrocompatibility from the 0.2 series to 0.3. |
115 | 90 | # and we forget about "filename" | 101 | # We convert "filename" to "path and we forget about "filename " |
116 | 91 | if "need_conversion" in parameters: | 102 | if "need_conversion" in parameters: |
117 | 92 | parameters["path"] = os.path.join(self.DEFAULT_PATH, \ | 103 | parameters["path"] = os.path.join(self.DEFAULT_PATH, \ |
118 | 93 | parameters["need_conversion"]) | 104 | parameters["need_conversion"]) |
119 | @@ -99,24 +110,30 @@ | |||
120 | 99 | self._parameters["path"], "project") | 110 | self._parameters["path"], "project") |
121 | 100 | 111 | ||
122 | 101 | def initialize(self): | 112 | def initialize(self): |
123 | 113 | """This is called when a backend is enabled""" | ||
124 | 102 | super(Backend, self).initialize() | 114 | super(Backend, self).initialize() |
125 | 103 | self.doc, self.xmlproj = cleanxml.openxmlfile( \ | 115 | self.doc, self.xmlproj = cleanxml.openxmlfile( \ |
126 | 104 | self._parameters["path"], "project") | 116 | self._parameters["path"], "project") |
127 | 105 | 117 | ||
128 | 106 | def this_is_the_first_run(self, xml): | 118 | def this_is_the_first_run(self, xml): |
131 | 107 | #Create the default tasks for the first run. | 119 | """ |
132 | 108 | #We write the XML object in a file | 120 | Called upon the very first GTG startup. |
133 | 121 | This function is needed only in this backend, because it can be used as | ||
134 | 122 | default one. | ||
135 | 123 | The xml parameter is an object containing GTG default tasks. It will be | ||
136 | 124 | saved to a file, and the backend will be set as default. | ||
137 | 125 | @param xml: an xml object containing the default tasks. | ||
138 | 126 | """ | ||
139 | 109 | self._parameters[self.KEY_DEFAULT_BACKEND] = True | 127 | self._parameters[self.KEY_DEFAULT_BACKEND] = True |
140 | 110 | cleanxml.savexml(self._parameters["path"], xml) | 128 | cleanxml.savexml(self._parameters["path"], xml) |
141 | 111 | self.doc, self.xmlproj = cleanxml.openxmlfile(\ | 129 | self.doc, self.xmlproj = cleanxml.openxmlfile(\ |
142 | 112 | self._parameters["path"], "project") | 130 | self._parameters["path"], "project") |
143 | 113 | self._parameters[self.KEY_DEFAULT_BACKEND] = True | ||
144 | 114 | 131 | ||
145 | 115 | def start_get_tasks(self): | 132 | def start_get_tasks(self): |
146 | 116 | ''' | 133 | ''' |
150 | 117 | Once this function is launched, the backend can start pushing | 134 | This function starts submitting the tasks from the XML file into GTG core. |
151 | 118 | tasks to gtg parameters. | 135 | It's run as a separate thread. |
152 | 119 | 136 | ||
153 | 120 | @return: start_get_tasks() might not return or finish | 137 | @return: start_get_tasks() might not return or finish |
154 | 121 | ''' | 138 | ''' |
155 | 122 | tid_list = [] | 139 | tid_list = [] |
156 | @@ -130,52 +147,63 @@ | |||
157 | 130 | self.datastore.push_task(task) | 147 | self.datastore.push_task(task) |
158 | 131 | 148 | ||
159 | 132 | def set_task(self, task): | 149 | def set_task(self, task): |
178 | 133 | tid = task.get_id() | 150 | ''' |
179 | 134 | existing = None | 151 | This function is called from GTG core whenever a task should be |
180 | 135 | #First, we find the existing task from the treenode | 152 | saved, either because it's a new one or it has been modified. |
181 | 136 | for node in self.xmlproj.childNodes: | 153 | This function will look into the loaded XML object if the task is |
182 | 137 | if node.getAttribute("id") == tid: | 154 | present, and if it's not, it will create it. Then, it will save the |
183 | 138 | existing = node | 155 | task data in the XML object. |
184 | 139 | t_xml = taskxml.task_to_xml(self.doc, task) | 156 | |
185 | 140 | modified = False | 157 | @param task: the task object to save |
186 | 141 | #We then replace the existing node | 158 | ''' |
187 | 142 | if existing and t_xml: | 159 | tid = task.get_id() |
188 | 143 | #We will write only if the task has changed | 160 | #We create an XML representation of the task |
189 | 144 | if t_xml.toxml() != existing.toxml(): | 161 | t_xml = taskxml.task_to_xml(self.doc, task) |
190 | 145 | self.xmlproj.replaceChild(t_xml, existing) | 162 | |
191 | 146 | modified = True | 163 | #we find if the task exists in the XML treenode. |
192 | 147 | #If the node doesn't exist, we create it | 164 | existing = None |
193 | 148 | # (it might not be the case in all backends | 165 | for node in self.xmlproj.childNodes: |
194 | 149 | else: | 166 | if node.getAttribute("id") == tid: |
195 | 150 | self.xmlproj.appendChild(t_xml) | 167 | existing = node |
196 | 168 | |||
197 | 169 | modified = False | ||
198 | 170 | #We then replace the existing node | ||
199 | 171 | if existing and t_xml: | ||
200 | 172 | #We will write only if the task has changed | ||
201 | 173 | if t_xml.toxml() != existing.toxml(): | ||
202 | 174 | self.xmlproj.replaceChild(t_xml, existing) | ||
203 | 151 | modified = True | 175 | modified = True |
208 | 152 | #In this particular backend, we write all the tasks | 176 | #If the node doesn't exist, we create it |
209 | 153 | #This is inherent to the XML file backend | 177 | else: |
210 | 154 | if modified and self._parameters["path"] and self.doc : | 178 | self.xmlproj.appendChild(t_xml) |
211 | 155 | cleanxml.savexml(self._parameters["path"], self.doc) | 179 | modified = True |
212 | 180 | |||
213 | 181 | #if the XML object has changed, we save it to file | ||
214 | 182 | if modified and self._parameters["path"] and self.doc : | ||
215 | 183 | cleanxml.savexml(self._parameters["path"], self.doc) | ||
216 | 156 | 184 | ||
217 | 157 | def remove_task(self, tid): | 185 | def remove_task(self, tid): |
219 | 158 | ''' Completely remove the task with ID = tid ''' | 186 | ''' This function is called from GTG core whenever a task must be |
220 | 187 | removed from the backend. Note that the task could be not present here. | ||
221 | 188 | |||
222 | 189 | @param tid: the id of the task to delete | ||
223 | 190 | ''' | ||
224 | 191 | modified = False | ||
225 | 159 | for node in self.xmlproj.childNodes: | 192 | for node in self.xmlproj.childNodes: |
226 | 160 | if node.getAttribute("id") == tid: | 193 | if node.getAttribute("id") == tid: |
227 | 194 | modified = True | ||
228 | 161 | self.xmlproj.removeChild(node) | 195 | self.xmlproj.removeChild(node) |
229 | 162 | if tid in self.tids: | 196 | if tid in self.tids: |
230 | 163 | self.tids.remove(tid) | 197 | self.tids.remove(tid) |
249 | 164 | cleanxml.savexml(self._parameters["path"], self.doc) | 198 | |
250 | 165 | 199 | #We save the XML file only if it's necessary | |
251 | 166 | 200 | if modified: | |
252 | 167 | def quit(self, disable = False): | 201 | cleanxml.savexml(self._parameters["path"], self.doc) |
253 | 168 | ''' | 202 | |
254 | 169 | Called when GTG quits or disconnects the backend. | 203 | #NOTE: This is not used currently. Therefore, I'm disabling it (invernizzi) |
255 | 170 | ''' | 204 | # def get_number_of_tasks(self): |
256 | 171 | super(Backend, self).quit(disable) | 205 | # ''' |
257 | 172 | 206 | # Returns the number of tasks stored in the backend. Doesn't need to be a | |
258 | 173 | def save_state(self): | 207 | # fast function, is called just for the UI |
259 | 174 | cleanxml.savexml(self._parameters["path"], self.doc, backup=True) | 208 | # ''' |
260 | 175 | 209 | # return len(self.tids) | |
243 | 176 | def get_number_of_tasks(self): | ||
244 | 177 | ''' | ||
245 | 178 | Returns the number of tasks stored in the backend. Doesn't need to be a | ||
246 | 179 | fast function, is called just for the UI | ||
247 | 180 | ''' | ||
248 | 181 | return len(self.tids) | ||
261 | 182 | 210 | ||
262 | === modified file 'GTG/backends/genericbackend.py' | |||
263 | --- GTG/backends/genericbackend.py 2010-06-22 20:44:26 +0000 | |||
264 | +++ GTG/backends/genericbackend.py 2010-08-13 23:43:04 +0000 | |||
265 | @@ -18,7 +18,8 @@ | |||
266 | 18 | # ----------------------------------------------------------------------------- | 18 | # ----------------------------------------------------------------------------- |
267 | 19 | 19 | ||
268 | 20 | ''' | 20 | ''' |
270 | 21 | FIXME: document! | 21 | This file contains the most generic representation of a backend, the |
271 | 22 | GenericBackend class | ||
272 | 22 | ''' | 23 | ''' |
273 | 23 | 24 | ||
274 | 24 | import os | 25 | import os |
275 | @@ -29,69 +30,71 @@ | |||
276 | 29 | from collections import deque | 30 | from collections import deque |
277 | 30 | 31 | ||
278 | 31 | from GTG.backends.backendsignals import BackendSignals | 32 | from GTG.backends.backendsignals import BackendSignals |
283 | 32 | from GTG.tools.keyring import Keyring | 33 | from GTG.tools.keyring import Keyring |
284 | 33 | from GTG.core import CoreConfig | 34 | from GTG.core import CoreConfig |
285 | 34 | from GTG.tools.logger import Log | 35 | from GTG.tools.logger import Log |
286 | 35 | 36 | from GTG.tools.interruptible import _cancellation_point | |
287 | 36 | 37 | ||
288 | 37 | 38 | ||
289 | 38 | 39 | ||
290 | 39 | class GenericBackend(object): | 40 | class GenericBackend(object): |
291 | 40 | ''' | 41 | ''' |
294 | 41 | Base class for every backend. It's a little more than an interface which | 42 | Base class for every backend. |
295 | 42 | methods have to be redefined in order for the backend to run. | 43 | It defines the interface a backend must have and takes care of all the |
296 | 44 | operations common to all backends. | ||
297 | 45 | A particular backend should redefine all the methods marked as such. | ||
298 | 43 | ''' | 46 | ''' |
299 | 44 | 47 | ||
300 | 45 | 48 | ||
315 | 46 | #BACKEND TYPE DESCRIPTION | 49 | ########################################################################### |
316 | 47 | #"_general_description" is a dictionary that holds the values for the | 50 | ### BACKEND INTERFACE ##################################################### |
317 | 48 | # following keys: | 51 | ########################################################################### |
318 | 49 | BACKEND_NAME = "name" #the backend gtg internal name (doesn't change in | 52 | |
319 | 50 | # translations, *must be unique*) | 53 | #General description of the backend: these parameters are used |
320 | 51 | BACKEND_HUMAN_NAME = "human-friendly-name" #The name shown to the user | 54 | #to show a description of the backend to the user when s/he is |
321 | 52 | BACKEND_DESCRIPTION = "description" #A short description of the backend | 55 | #considering adding it. |
322 | 53 | BACKEND_AUTHORS = "authors" #a list of strings | 56 | # For an example, see the GTG/backends/backend_localfile.py file |
323 | 54 | BACKEND_TYPE = "type" | 57 | #_general_description has this format: |
324 | 55 | #BACKEND_TYPE is one of: | 58 | #_general_description = { |
325 | 56 | TYPE_READWRITE = "readwrite" | 59 | # GenericBackend.BACKEND_NAME: "backend_unique_identifier", \ |
326 | 57 | TYPE_READONLY = "readonly" | 60 | # GenericBackend.BACKEND_HUMAN_NAME: _("Human friendly name"), \ |
327 | 58 | TYPE_IMPORT = "import" | 61 | # GenericBackend.BACKEND_AUTHORS: ["First author", \ |
328 | 59 | TYPE_EXPORT = "export" | 62 | # "Chuck Norris"], \ |
329 | 63 | # GenericBackend.BACKEND_TYPE: GenericBackend.TYPE_READWRITE, \ | ||
330 | 64 | # GenericBackend.BACKEND_DESCRIPTION: \ | ||
331 | 65 | # _("Short description of the backend"),\ | ||
332 | 66 | # } | ||
333 | 67 | # The complete list of constants and their meaning is given below. | ||
334 | 60 | _general_description = {} | 68 | _general_description = {} |
335 | 61 | 69 | ||
357 | 62 | 70 | #These are the parameters to configure a new backend of this type. A | |
358 | 63 | #"static_parameters" is a dictionary of dictionaries, each of which | 71 | # parameter has a name, a type and a default value. |
359 | 64 | #representing a parameter needed to configure the backend. | 72 | # For an example, see the GTG/backends/backend_localfile.py file |
360 | 65 | #each "sub-dictionary" is identified by this a key representing its name. | 73 | #_static_parameters has this format: |
361 | 66 | #"static_parameters" will be part of the definition of each | 74 | #_static_parameters = { \ |
362 | 67 | #particular backend. | 75 | # "param1_name": { \ |
363 | 68 | # Each dictionary contains the keys: | 76 | # GenericBackend.PARAM_TYPE: GenericBackend.TYPE_STRING, |
364 | 69 | #PARAM_DESCRIPTION = "description" #short description (shown to the user | 77 | # GenericBackend.PARAM_DEFAULT_VALUE: "my default value", |
365 | 70 | # during configuration) | 78 | # }, |
366 | 71 | PARAM_DEFAULT_VALUE = "default_value" # its default value | 79 | # "param2_name": { |
367 | 72 | PARAM_TYPE = "type" | 80 | # GenericBackend.PARAM_TYPE: GenericBackend.TYPE_INT, |
368 | 73 | #PARAM_TYPE is one of the following (changing this changes the way | 81 | # GenericBackend.PARAM_DEFAULT_VALUE: 42, |
369 | 74 | # the user can configure the parameter) | 82 | # }} |
370 | 75 | TYPE_PASSWORD = "password" #the real password is stored in the GNOME | 83 | # The complete list of constants and their meaning is given below. |
350 | 76 | # keyring | ||
351 | 77 | # This is just a key to find it there | ||
352 | 78 | TYPE_STRING = "string" #generic string, nothing fancy is done | ||
353 | 79 | TYPE_INT = "int" #edit box can contain only integers | ||
354 | 80 | TYPE_BOOL = "bool" #checkbox is shown | ||
355 | 81 | TYPE_LIST_OF_STRINGS = "liststring" #list of strings. the "," character is | ||
356 | 82 | # prohibited in strings | ||
371 | 83 | _static_parameters = {} | 84 | _static_parameters = {} |
372 | 84 | 85 | ||
373 | 85 | def initialize(self): | 86 | def initialize(self): |
374 | 86 | ''' | 87 | ''' |
376 | 87 | Called each time it is enabled again (including on backend creation). | 88 | Called each time it is enabled (including on backend creation). |
377 | 88 | Please note that a class instance for each disabled backend *is* | 89 | Please note that a class instance for each disabled backend *is* |
378 | 89 | created, but it's not initialized. | 90 | created, but it's not initialized. |
379 | 90 | Optional. | 91 | Optional. |
380 | 91 | NOTE: make sure to call super().initialize() | 92 | NOTE: make sure to call super().initialize() |
381 | 92 | ''' | 93 | ''' |
384 | 93 | for module_name in self.get_required_modules(): | 94 | #NOTE: I'm disabling this since support for runtime checking of the |
385 | 94 | sys.modules[module_name]= __import__(module_name) | 95 | # presence of the necessary modules is disabled. (invernizzi) |
386 | 96 | # for module_name in self.get_required_modules(): | ||
387 | 97 | # sys.modules[module_name]= __import__(module_name) | ||
388 | 95 | self._parameters[self.KEY_ENABLED] = True | 98 | self._parameters[self.KEY_ENABLED] = True |
389 | 96 | self._is_initialized = True | 99 | self._is_initialized = True |
390 | 97 | #we signal that the backend has been enabled | 100 | #we signal that the backend has been enabled |
391 | @@ -99,65 +102,66 @@ | |||
392 | 99 | 102 | ||
393 | 100 | def start_get_tasks(self): | 103 | def start_get_tasks(self): |
394 | 101 | ''' | 104 | ''' |
397 | 102 | Once this function is launched, the backend can start pushing | 105 | This function starts submitting the tasks from the backend into GTG |
398 | 103 | tasks to gtg parameters. | 106 | core. |
399 | 107 | It's run as a separate thread. | ||
400 | 104 | 108 | ||
401 | 105 | @return: start_get_tasks() might not return or finish | 109 | @return: start_get_tasks() might not return or finish |
402 | 106 | ''' | 110 | ''' |
404 | 107 | raise NotImplemented() | 111 | return |
405 | 108 | 112 | ||
406 | 109 | def set_task(self, task): | 113 | def set_task(self, task): |
407 | 110 | ''' | 114 | ''' |
410 | 111 | Save the task in the backend. If the task id is new for the | 115 | This function is called from GTG core whenever a task should be |
411 | 112 | backend, then a new task must be created. | 116 | saved, either because it's a new one or it has been modified. |
412 | 117 | If the task id is new for the backend, then a new task must be | ||
413 | 118 | created. No special notification that the task is a new one is given. | ||
414 | 119 | |||
415 | 120 | @param task: the task object to save | ||
416 | 113 | ''' | 121 | ''' |
417 | 114 | pass | 122 | pass |
418 | 115 | 123 | ||
419 | 116 | def remove_task(self, tid): | 124 | def remove_task(self, tid): |
421 | 117 | ''' Completely remove the task with ID = tid ''' | 125 | ''' This function is called from GTG core whenever a task must be |
422 | 126 | removed from the backend. Note that the task could be not present here. | ||
423 | 127 | |||
424 | 128 | @param tid: the id of the task to delete | ||
425 | 129 | ''' | ||
426 | 118 | pass | 130 | pass |
427 | 119 | 131 | ||
428 | 120 | def has_task(self, tid): | ||
429 | 121 | '''Returns true if the backend has an internal idea | ||
430 | 122 | of the task corresponding to the tid. False otherwise''' | ||
431 | 123 | raise NotImplemented() | ||
432 | 124 | |||
433 | 125 | def new_task_id(self): | ||
434 | 126 | ''' | ||
435 | 127 | Returns an available ID for a new task so that a task with this ID | ||
436 | 128 | can be saved with set_task later. | ||
437 | 129 | ''' | ||
438 | 130 | raise NotImplemented() | ||
439 | 131 | |||
440 | 132 | def this_is_the_first_run(self, xml): | 132 | def this_is_the_first_run(self, xml): |
441 | 133 | ''' | 133 | ''' |
463 | 134 | Steps to execute if it's the first time the backend is run. Optional. | 134 | Optional, and almost surely not needed. |
464 | 135 | ''' | 135 | Called upon the very first GTG startup. |
465 | 136 | pass | 136 | This function is needed only in the default backend (XML localfile, |
466 | 137 | 137 | currently). | |
467 | 138 | def purge(self): | 138 | The xml parameter is an object containing GTG default tasks. |
468 | 139 | ''' | 139 | |
469 | 140 | Called when a backend will be removed from GTG. Useful for removing | 140 | @param xml: an xml object containing the default tasks. |
470 | 141 | configuration files. Optional. | 141 | ''' |
471 | 142 | ''' | 142 | pass |
472 | 143 | pass | 143 | |
473 | 144 | 144 | #NOTE: task counting is disabled in the UI, so I've disabled it here | |
474 | 145 | def get_number_of_tasks(self): | 145 | # (invernizzi) |
475 | 146 | ''' | 146 | # def get_number_of_tasks(self): |
476 | 147 | Returns the number of tasks stored in the backend. Doesn't need to be a | 147 | # ''' |
477 | 148 | fast function, is called just for the UI | 148 | # Returns the number of tasks stored in the backend. Doesn't need |
478 | 149 | ''' | 149 | # to be a fast function, is called just for the UI |
479 | 150 | raise NotImplemented() | 150 | # ''' |
480 | 151 | 151 | # raise NotImplemented() | |
481 | 152 | @staticmethod | 152 | |
482 | 153 | def get_required_modules(): | 153 | #NOTE: I'm disabling this since support for runtime checking of the |
483 | 154 | return [] | 154 | # presence of the necessary modules is disabled. (invernizzi) |
484 | 155 | # @staticmethod | ||
485 | 156 | # def get_required_modules(): | ||
486 | 157 | # return [] | ||
487 | 155 | 158 | ||
488 | 156 | def quit(self, disable = False): | 159 | def quit(self, disable = False): |
489 | 157 | ''' | 160 | ''' |
493 | 158 | Called when GTG quits or disconnects the backend. Remember to execute | 161 | Called when GTG quits or the user wants to disable the backend. |
494 | 159 | also this function when quitting. If disable is True, the backend won't | 162 | |
495 | 160 | be automatically loaded at next GTG start | 163 | @param disable: If disable is True, the backend won't |
496 | 164 | be automatically loaded when GTG starts | ||
497 | 161 | ''' | 165 | ''' |
498 | 162 | self._is_initialized = False | 166 | self._is_initialized = False |
499 | 163 | if disable: | 167 | if disable: |
500 | @@ -179,6 +183,44 @@ | |||
501 | 179 | ###### You don't need to reimplement the functions below this line ############ | 183 | ###### You don't need to reimplement the functions below this line ############ |
502 | 180 | ############################################################################### | 184 | ############################################################################### |
503 | 181 | 185 | ||
504 | 186 | ########################################################################### | ||
505 | 187 | ### CONSTANTS ############################################################# | ||
506 | 188 | ########################################################################### | ||
507 | 189 | #BACKEND TYPE DESCRIPTION | ||
508 | 190 | # Each backend must have a "_general_description" attribute, which | ||
509 | 191 | # is a dictionary that holds the values for the following keys. | ||
510 | 192 | BACKEND_NAME = "name" #the backend gtg internal name (doesn't change in | ||
511 | 193 | # translations, *must be unique*) | ||
512 | 194 | BACKEND_HUMAN_NAME = "human-friendly-name" #The name shown to the user | ||
513 | 195 | BACKEND_DESCRIPTION = "description" #A short description of the backend | ||
514 | 196 | BACKEND_AUTHORS = "authors" #a list of strings | ||
515 | 197 | BACKEND_TYPE = "type" | ||
516 | 198 | #BACKEND_TYPE is one of: | ||
517 | 199 | TYPE_READWRITE = "readwrite" | ||
518 | 200 | TYPE_READONLY = "readonly" | ||
519 | 201 | TYPE_IMPORT = "import" | ||
520 | 202 | TYPE_EXPORT = "export" | ||
521 | 203 | |||
522 | 204 | |||
523 | 205 | #"static_parameters" is a dictionary of dictionaries, each of which | ||
524 | 206 | # are a description of a parameter needed to configure the backend and | ||
525 | 207 | # is identified in the outer dictionary by a key which is the name of the | ||
526 | 208 | # parameter. | ||
527 | 209 | # For an example, see the GTG/backends/backend_localfile.py file | ||
528 | 210 | # Each dictionary contains the keys: | ||
529 | 211 | PARAM_DEFAULT_VALUE = "default_value" # its default value | ||
530 | 212 | PARAM_TYPE = "type" | ||
531 | 213 | #PARAM_TYPE is one of the following (changing this changes the way | ||
532 | 214 | # the user can configure the parameter) | ||
533 | 215 | TYPE_PASSWORD = "password" #the real password is stored in the GNOME | ||
534 | 216 | # keyring | ||
535 | 217 | # This is just a key to find it there | ||
536 | 218 | TYPE_STRING = "string" #generic string, nothing fancy is done | ||
537 | 219 | TYPE_INT = "int" #edit box can contain only integers | ||
538 | 220 | TYPE_BOOL = "bool" #checkbox is shown | ||
539 | 221 | TYPE_LIST_OF_STRINGS = "liststring" #list of strings. the "," character is | ||
540 | 222 | # prohibited in strings | ||
541 | 223 | |||
542 | 182 | #These parameters are common to all backends and necessary. | 224 | #These parameters are common to all backends and necessary. |
543 | 183 | # They will be added automatically to your _static_parameters list | 225 | # They will be added automatically to your _static_parameters list |
544 | 184 | #NOTE: for now I'm disabling changing the default backend. Once it's all | 226 | #NOTE: for now I'm disabling changing the default backend. Once it's all |
545 | @@ -189,7 +231,11 @@ | |||
546 | 189 | KEY_ATTACHED_TAGS = "attached-tags" | 231 | KEY_ATTACHED_TAGS = "attached-tags" |
547 | 190 | KEY_USER = "user" | 232 | KEY_USER = "user" |
548 | 191 | KEY_PID = "pid" | 233 | KEY_PID = "pid" |
550 | 192 | ALLTASKS_TAG = "gtg-tags-all" #IXME: moved here to avoid circular imports | 234 | ALLTASKS_TAG = "gtg-tags-all" #NOTE: this has been moved here to avoid |
551 | 235 | # circular imports. It's the same as in | ||
552 | 236 | # the CoreConfig class, because it's the | ||
553 | 237 | # same thing conceptually. It doesn't | ||
554 | 238 | # matter it the naming diverges. | ||
555 | 193 | 239 | ||
556 | 194 | _static_parameters_obligatory = { \ | 240 | _static_parameters_obligatory = { \ |
557 | 195 | KEY_DEFAULT_BACKEND: { \ | 241 | KEY_DEFAULT_BACKEND: { \ |
558 | @@ -229,28 +275,30 @@ | |||
559 | 229 | ''' | 275 | ''' |
560 | 230 | Helper method, used to obtain the full list of the static_parameters | 276 | Helper method, used to obtain the full list of the static_parameters |
561 | 231 | (user configured and default ones) | 277 | (user configured and default ones) |
562 | 278 | |||
563 | 279 | @returns dict: the dict containing all the static parameters | ||
564 | 232 | ''' | 280 | ''' |
572 | 233 | if hasattr(cls, "_static_parameters"): | 281 | temp_dic = cls._static_parameters_obligatory.copy() |
573 | 234 | temp_dic = cls._static_parameters_obligatory.copy() | 282 | if cls._general_description[cls.BACKEND_TYPE] == \ |
574 | 235 | if cls._general_description[cls.BACKEND_TYPE] == cls.TYPE_READWRITE: | 283 | cls.TYPE_READWRITE: |
575 | 236 | for key, value in \ | 284 | for key, value in \ |
576 | 237 | cls._static_parameters_obligatory_for_rw.iteritems(): | 285 | cls._static_parameters_obligatory_for_rw.iteritems(): |
570 | 238 | temp_dic[key] = value | ||
571 | 239 | for key, value in cls._static_parameters.iteritems(): | ||
577 | 240 | temp_dic[key] = value | 286 | temp_dic[key] = value |
582 | 241 | return temp_dic | 287 | for key, value in cls._static_parameters.iteritems(): |
583 | 242 | else: | 288 | temp_dic[key] = value |
584 | 243 | raise NotImplemented("_static_parameters not implemented for " + \ | 289 | return temp_dic |
581 | 244 | "backend %s" % type(cls)) | ||
585 | 245 | 290 | ||
586 | 246 | def __init__(self, parameters): | 291 | def __init__(self, parameters): |
587 | 247 | """ | 292 | """ |
591 | 248 | Instantiates a new backend. Please note that this is called also for | 293 | Instantiates a new backend. Please note that this is called also |
592 | 249 | disabled backends. Those are not initialized, so you might want to check | 294 | for disabled backends. Those are not initialized, so you might |
593 | 250 | out the initialize() function. | 295 | want to check out the initialize() function. |
594 | 251 | """ | 296 | """ |
595 | 252 | if self.KEY_DEFAULT_BACKEND not in parameters: | 297 | if self.KEY_DEFAULT_BACKEND not in parameters: |
596 | 298 | #if it's not specified, then this is the default backend | ||
597 | 299 | #(for retro-compatibility with the GTG 0.2 series) | ||
598 | 253 | parameters[self.KEY_DEFAULT_BACKEND] = True | 300 | parameters[self.KEY_DEFAULT_BACKEND] = True |
599 | 301 | #default backends should get all the tasks | ||
600 | 254 | if parameters[self.KEY_DEFAULT_BACKEND] or \ | 302 | if parameters[self.KEY_DEFAULT_BACKEND] or \ |
601 | 255 | (not self.KEY_ATTACHED_TAGS in parameters and \ | 303 | (not self.KEY_ATTACHED_TAGS in parameters and \ |
602 | 256 | self._general_description[self.BACKEND_TYPE] \ | 304 | self._general_description[self.BACKEND_TYPE] \ |
603 | @@ -259,12 +307,17 @@ | |||
604 | 259 | self._parameters = parameters | 307 | self._parameters = parameters |
605 | 260 | self._signal_manager = BackendSignals() | 308 | self._signal_manager = BackendSignals() |
606 | 261 | self._is_initialized = False | 309 | self._is_initialized = False |
607 | 310 | #if debugging mode is enabled, tasks should be saved as soon as they're | ||
608 | 311 | # marked as modified. If in normal mode, we prefer speed over easier | ||
609 | 312 | # debugging. | ||
610 | 262 | if Log.is_debugging_mode(): | 313 | if Log.is_debugging_mode(): |
611 | 263 | self.timer_timestep = 5 | 314 | self.timer_timestep = 5 |
612 | 264 | else: | 315 | else: |
613 | 265 | self.timer_timestep = 1 | 316 | self.timer_timestep = 1 |
614 | 266 | self.to_set_timer = None | 317 | self.to_set_timer = None |
615 | 267 | self.please_quit = False | 318 | self.please_quit = False |
616 | 319 | self.cancellation_point = lambda: _cancellation_point(\ | ||
617 | 320 | lambda: self.please_quit) | ||
618 | 268 | self.to_set = deque() | 321 | self.to_set = deque() |
619 | 269 | self.to_remove = deque() | 322 | self.to_remove = deque() |
620 | 270 | 323 | ||
621 | @@ -274,6 +327,9 @@ | |||
622 | 274 | ''' | 327 | ''' |
623 | 275 | if hasattr(self._parameters, self.KEY_DEFAULT_BACKEND) and \ | 328 | if hasattr(self._parameters, self.KEY_DEFAULT_BACKEND) and \ |
624 | 276 | self._parameters[self.KEY_DEFAULT_BACKEND]: | 329 | self._parameters[self.KEY_DEFAULT_BACKEND]: |
625 | 330 | #default backends should get all the tasks | ||
626 | 331 | #NOTE: this shouldn't be needed, but it doesn't cost anything and it | ||
627 | 332 | # could avoid potential tasks losses. | ||
628 | 277 | return [self.ALLTASKS_TAG] | 333 | return [self.ALLTASKS_TAG] |
629 | 278 | try: | 334 | try: |
630 | 279 | return self._parameters[self.KEY_ATTACHED_TAGS] | 335 | return self._parameters[self.KEY_ATTACHED_TAGS] |
631 | @@ -283,6 +339,8 @@ | |||
632 | 283 | def set_attached_tags(self, tags): | 339 | def set_attached_tags(self, tags): |
633 | 284 | ''' | 340 | ''' |
634 | 285 | Changes the set of attached tags | 341 | Changes the set of attached tags |
635 | 342 | |||
636 | 343 | @param tags: the new attached_tags set | ||
637 | 286 | ''' | 344 | ''' |
638 | 287 | self._parameters[self.KEY_ATTACHED_TAGS] = tags | 345 | self._parameters[self.KEY_ATTACHED_TAGS] = tags |
639 | 288 | 346 | ||
640 | @@ -300,6 +358,12 @@ | |||
641 | 300 | return self._parameters | 358 | return self._parameters |
642 | 301 | 359 | ||
643 | 302 | def set_parameter(self, parameter, value): | 360 | def set_parameter(self, parameter, value): |
644 | 361 | ''' | ||
645 | 362 | Change a parameter for this backend | ||
646 | 363 | |||
647 | 364 | @param parameter: the parameter name | ||
648 | 365 | @param value: the new value | ||
649 | 366 | ''' | ||
650 | 303 | self._parameters[parameter] = value | 367 | self._parameters[parameter] = value |
651 | 304 | 368 | ||
652 | 305 | @classmethod | 369 | @classmethod |
653 | @@ -330,24 +394,22 @@ | |||
654 | 330 | def _get_from_general_description(cls, key): | 394 | def _get_from_general_description(cls, key): |
655 | 331 | ''' | 395 | ''' |
656 | 332 | Helper method to extract values from cls._general_description. | 396 | Helper method to extract values from cls._general_description. |
659 | 333 | Raises an exception if the key is missing (helpful for developers | 397 | |
660 | 334 | adding new backends). | 398 | @param key: the key to extract |
661 | 335 | ''' | 399 | ''' |
668 | 336 | if key in cls._general_description: | 400 | return cls._general_description[key] |
663 | 337 | return cls._general_description[key] | ||
664 | 338 | else: | ||
665 | 339 | raise NotImplemented("Key %s is missing from " +\ | ||
666 | 340 | "'self._general_description' of a backend (%s). " + | ||
667 | 341 | "Please add the corresponding value" % (key, type(cls))) | ||
669 | 342 | 401 | ||
670 | 343 | @classmethod | 402 | @classmethod |
671 | 344 | def cast_param_type_from_string(cls, param_value, param_type): | 403 | def cast_param_type_from_string(cls, param_value, param_type): |
672 | 345 | ''' | 404 | ''' |
673 | 346 | Parameters are saved in a text format, so we have to cast them to the | 405 | Parameters are saved in a text format, so we have to cast them to the |
674 | 347 | appropriate type on loading. This function does exactly that. | 406 | appropriate type on loading. This function does exactly that. |
675 | 407 | |||
676 | 408 | @param param_value: the actual value of the parameter, in a string | ||
677 | 409 | format | ||
678 | 410 | @param param_type: the wanted type | ||
679 | 411 | @returns something: the casted param_value | ||
680 | 348 | ''' | 412 | ''' |
681 | 349 | #FIXME: we could use pickle (dumps and loads), at least in some cases | ||
682 | 350 | # (invernizzi) | ||
683 | 351 | if param_type in cls._type_converter: | 413 | if param_type in cls._type_converter: |
684 | 352 | return cls._type_converter[param_type](param_value) | 414 | return cls._type_converter[param_type](param_value) |
685 | 353 | elif param_type == cls.TYPE_BOOL: | 415 | elif param_type == cls.TYPE_BOOL: |
686 | @@ -374,6 +436,10 @@ | |||
687 | 374 | def cast_param_type_to_string(self, param_type, param_value): | 436 | def cast_param_type_to_string(self, param_type, param_value): |
688 | 375 | ''' | 437 | ''' |
689 | 376 | Inverse of cast_param_type_from_string | 438 | Inverse of cast_param_type_from_string |
690 | 439 | |||
691 | 440 | @param param_value: the actual value of the parameter | ||
692 | 441 | @param param_type: the type of the parameter (password...) | ||
693 | 442 | @returns something: param_value casted to string | ||
694 | 377 | ''' | 443 | ''' |
695 | 378 | if param_type == GenericBackend.TYPE_PASSWORD: | 444 | if param_type == GenericBackend.TYPE_PASSWORD: |
696 | 379 | if param_value == None: | 445 | if param_value == None: |
697 | @@ -391,20 +457,27 @@ | |||
698 | 391 | def get_id(self): | 457 | def get_id(self): |
699 | 392 | ''' | 458 | ''' |
700 | 393 | returns the backends id, used in the datastore for indexing backends | 459 | returns the backends id, used in the datastore for indexing backends |
701 | 460 | |||
702 | 461 | @returns string: the backend id | ||
703 | 394 | ''' | 462 | ''' |
704 | 395 | return self.get_name() + "@" + self._parameters["pid"] | 463 | return self.get_name() + "@" + self._parameters["pid"] |
705 | 396 | 464 | ||
706 | 397 | @classmethod | 465 | @classmethod |
707 | 398 | def get_human_default_name(cls): | 466 | def get_human_default_name(cls): |
708 | 399 | ''' | 467 | ''' |
710 | 400 | returns the user friendly default backend name. | 468 | returns the user friendly default backend name, without eventual user |
711 | 469 | modifications. | ||
712 | 470 | |||
713 | 471 | @returns string: the default "human name" | ||
714 | 401 | ''' | 472 | ''' |
715 | 402 | return cls._general_description[cls.BACKEND_HUMAN_NAME] | 473 | return cls._general_description[cls.BACKEND_HUMAN_NAME] |
716 | 403 | 474 | ||
717 | 404 | def get_human_name(self): | 475 | def get_human_name(self): |
718 | 405 | ''' | 476 | ''' |
719 | 406 | returns the user customized backend name. If the user hasn't | 477 | returns the user customized backend name. If the user hasn't |
721 | 407 | customized it, returns the default one | 478 | customized it, returns the default one. |
722 | 479 | |||
723 | 480 | @returns string: the "human name" of this backend | ||
724 | 408 | ''' | 481 | ''' |
725 | 409 | if self.KEY_HUMAN_NAME in self._parameters and \ | 482 | if self.KEY_HUMAN_NAME in self._parameters and \ |
726 | 410 | self._parameters[self.KEY_HUMAN_NAME] != "": | 483 | self._parameters[self.KEY_HUMAN_NAME] != "": |
727 | @@ -415,6 +488,8 @@ | |||
728 | 415 | def set_human_name(self, name): | 488 | def set_human_name(self, name): |
729 | 416 | ''' | 489 | ''' |
730 | 417 | sets a custom name for the backend | 490 | sets a custom name for the backend |
731 | 491 | |||
732 | 492 | @param name: the new name | ||
733 | 418 | ''' | 493 | ''' |
734 | 419 | self._parameters[self.KEY_HUMAN_NAME] = name | 494 | self._parameters[self.KEY_HUMAN_NAME] = name |
735 | 420 | #we signal the change | 495 | #we signal the change |
736 | @@ -423,29 +498,49 @@ | |||
737 | 423 | def is_enabled(self): | 498 | def is_enabled(self): |
738 | 424 | ''' | 499 | ''' |
739 | 425 | Returns if the backend is enabled | 500 | Returns if the backend is enabled |
740 | 501 | |||
741 | 502 | @returns bool | ||
742 | 426 | ''' | 503 | ''' |
743 | 427 | return self.get_parameters()[GenericBackend.KEY_ENABLED] or \ | 504 | return self.get_parameters()[GenericBackend.KEY_ENABLED] or \ |
745 | 428 | self.is_default() | 505 | self.is_default() |
746 | 429 | 506 | ||
747 | 430 | def is_default(self): | 507 | def is_default(self): |
748 | 431 | ''' | 508 | ''' |
749 | 432 | Returns if the backend is enabled | 509 | Returns if the backend is enabled |
750 | 510 | |||
751 | 511 | @returns bool | ||
752 | 433 | ''' | 512 | ''' |
753 | 434 | return self.get_parameters()[GenericBackend.KEY_DEFAULT_BACKEND] | 513 | return self.get_parameters()[GenericBackend.KEY_DEFAULT_BACKEND] |
754 | 435 | 514 | ||
755 | 436 | def is_initialized(self): | 515 | def is_initialized(self): |
756 | 437 | ''' | 516 | ''' |
757 | 438 | Returns if the backend is up and running | 517 | Returns if the backend is up and running |
758 | 518 | |||
759 | 519 | @returns is_initialized | ||
760 | 439 | ''' | 520 | ''' |
761 | 440 | return self._is_initialized | 521 | return self._is_initialized |
762 | 441 | 522 | ||
763 | 442 | def get_parameter_type(self, param_name): | 523 | def get_parameter_type(self, param_name): |
764 | 524 | ''' | ||
765 | 525 | Given the name of a parameter, returns its type. If the parameter is one | ||
766 | 526 | of the default ones, it does not have a type: in that case, it returns | ||
767 | 527 | None | ||
768 | 528 | |||
769 | 529 | @param param_name: the name of the parameter | ||
770 | 530 | @returns string: the type, or None | ||
771 | 531 | ''' | ||
772 | 443 | try: | 532 | try: |
773 | 444 | return self.get_static_parameters()[param_name][self.PARAM_TYPE] | 533 | return self.get_static_parameters()[param_name][self.PARAM_TYPE] |
775 | 445 | except KeyError: | 534 | except: |
776 | 446 | return None | 535 | return None |
777 | 447 | 536 | ||
778 | 448 | def register_datastore(self, datastore): | 537 | def register_datastore(self, datastore): |
779 | 538 | ''' | ||
780 | 539 | Setter function to inform the backend about the datastore that's loading | ||
781 | 540 | it. | ||
782 | 541 | |||
783 | 542 | @param datastore: a Datastore | ||
784 | 543 | ''' | ||
785 | 449 | self.datastore = datastore | 544 | self.datastore = datastore |
786 | 450 | 545 | ||
787 | 451 | ############################################################################### | 546 | ############################################################################### |
788 | @@ -455,6 +550,7 @@ | |||
789 | 455 | def _store_pickled_file(self, path, data): | 550 | def _store_pickled_file(self, path, data): |
790 | 456 | ''' | 551 | ''' |
791 | 457 | A helper function to save some object in a file. | 552 | A helper function to save some object in a file. |
792 | 553 | |||
793 | 458 | @param path: a relative path. A good choice is | 554 | @param path: a relative path. A good choice is |
794 | 459 | "backend_name/object_name" | 555 | "backend_name/object_name" |
795 | 460 | @param data: the object | 556 | @param data: the object |
796 | @@ -467,15 +563,13 @@ | |||
797 | 467 | if exception.errno != errno.EEXIST: | 563 | if exception.errno != errno.EEXIST: |
798 | 468 | raise | 564 | raise |
799 | 469 | #saving | 565 | #saving |
800 | 470 | #try: | ||
801 | 471 | with open(path, 'wb') as file: | 566 | with open(path, 'wb') as file: |
802 | 472 | pickle.dump(data, file) | 567 | pickle.dump(data, file) |
803 | 473 | #except pickle.PickleError: | ||
804 | 474 | #pass | ||
805 | 475 | 568 | ||
806 | 476 | def _load_pickled_file(self, path, default_value = None): | 569 | def _load_pickled_file(self, path, default_value = None): |
807 | 477 | ''' | 570 | ''' |
808 | 478 | A helper function to load some object from a file. | 571 | A helper function to load some object from a file. |
809 | 572 | |||
810 | 479 | @param path: the relative path of the file | 573 | @param path: the relative path of the file |
811 | 480 | @param default_value: the value to return if the file is missing or | 574 | @param default_value: the value to return if the file is missing or |
812 | 481 | corrupt | 575 | corrupt |
813 | @@ -485,11 +579,29 @@ | |||
814 | 485 | if not os.path.exists(path): | 579 | if not os.path.exists(path): |
815 | 486 | return default_value | 580 | return default_value |
816 | 487 | else: | 581 | else: |
819 | 488 | try: | 582 | with open(path, 'r') as file: |
820 | 489 | with open(path, 'r') as file: | 583 | try: |
821 | 490 | return pickle.load(file) | 584 | return pickle.load(file) |
824 | 491 | except pickle.PickleError: | 585 | except pickle.PickleError: |
825 | 492 | return default_value | 586 | Log.error("PICKLE ERROR") |
826 | 587 | return default_value | ||
827 | 588 | |||
828 | 589 | def _gtg_task_is_syncable_per_attached_tags(self, task): | ||
829 | 590 | ''' | ||
830 | 591 | Helper function which checks if the given task satisfies the filtering | ||
831 | 592 | imposed by the tags attached to the backend. | ||
832 | 593 | That means, if a user wants a backend to sync only tasks tagged @works, | ||
833 | 594 | this function should be used to check if that is verified. | ||
834 | 595 | |||
835 | 596 | @returns bool: True if the task should be synced | ||
836 | 597 | ''' | ||
837 | 598 | attached_tags = self.get_attached_tags() | ||
838 | 599 | if GenericBackend.ALLTASKS_TAG in attached_tags: | ||
839 | 600 | return True | ||
840 | 601 | for tag in task.get_tags_name(): | ||
841 | 602 | if tag in attached_tags: | ||
842 | 603 | return True | ||
843 | 604 | return False | ||
844 | 493 | 605 | ||
845 | 494 | ############################################################################### | 606 | ############################################################################### |
846 | 495 | ### THREADING ################################################################# | 607 | ### THREADING ################################################################# |
847 | @@ -504,25 +616,29 @@ | |||
848 | 504 | self.launch_setting_thread) | 616 | self.launch_setting_thread) |
849 | 505 | self.to_set_timer.start() | 617 | self.to_set_timer.start() |
850 | 506 | 618 | ||
852 | 507 | def launch_setting_thread(self): | 619 | def launch_setting_thread(self, bypass_quit_request = False): |
853 | 508 | ''' | 620 | ''' |
854 | 509 | This function is launched as a separate thread. Its job is to perform | 621 | This function is launched as a separate thread. Its job is to perform |
859 | 510 | the changes that have been issued from GTG core. In particular, for | 622 | the changes that have been issued from GTG core. |
860 | 511 | each task in the self.to_set queue, a task has to be modified or to be | 623 | In particular, for each task in the self.to_set queue, a task |
861 | 512 | created (if the tid is new), and for each task in the self.to_remove | 624 | has to be modified or to be created (if the tid is new), and for |
862 | 513 | queue, a task has to be deleted | 625 | each task in the self.to_remove queue, a task has to be deleted |
863 | 626 | |||
864 | 627 | @param bypass_quit_request: if True, the thread should not be stopped | ||
865 | 628 | even if asked by self.please_quit = True. | ||
866 | 629 | It's used when the backend quits, to finish | ||
867 | 630 | syncing all pending tasks | ||
868 | 514 | ''' | 631 | ''' |
870 | 515 | while not self.please_quit: | 632 | while not self.please_quit or bypass_quit_request: |
871 | 516 | try: | 633 | try: |
872 | 517 | task = self.to_set.pop() | 634 | task = self.to_set.pop() |
873 | 518 | except IndexError: | 635 | except IndexError: |
874 | 519 | break | 636 | break |
875 | 520 | #time.sleep(4) | ||
876 | 521 | tid = task.get_id() | 637 | tid = task.get_id() |
877 | 522 | if tid not in self.to_remove: | 638 | if tid not in self.to_remove: |
878 | 523 | self.set_task(task) | 639 | self.set_task(task) |
879 | 524 | 640 | ||
881 | 525 | while not self.please_quit: | 641 | while not self.please_quit or bypass_quit_request: |
882 | 526 | try: | 642 | try: |
883 | 527 | tid = self.to_remove.pop() | 643 | tid = self.to_remove.pop() |
884 | 528 | except IndexError: | 644 | except IndexError: |
885 | @@ -532,7 +648,12 @@ | |||
886 | 532 | self.to_set_timer = None | 648 | self.to_set_timer = None |
887 | 533 | 649 | ||
888 | 534 | def queue_set_task(self, task): | 650 | def queue_set_task(self, task): |
890 | 535 | ''' Save the task in the backend. ''' | 651 | ''' Save the task in the backend. In particular, it just enqueues the |
891 | 652 | task in the self.to_set queue. A thread will shortly run to apply the | ||
892 | 653 | requested changes. | ||
893 | 654 | |||
894 | 655 | @param task: the task that should be saved | ||
895 | 656 | ''' | ||
896 | 536 | tid = task.get_id() | 657 | tid = task.get_id() |
897 | 537 | if task not in self.to_set and tid not in self.to_remove: | 658 | if task not in self.to_set and tid not in self.to_remove: |
898 | 538 | self.to_set.appendleft(task) | 659 | self.to_set.appendleft(task) |
899 | @@ -540,7 +661,10 @@ | |||
900 | 540 | 661 | ||
901 | 541 | def queue_remove_task(self, tid): | 662 | def queue_remove_task(self, tid): |
902 | 542 | ''' | 663 | ''' |
904 | 543 | Queues task to be removed. | 664 | Queues task to be removed. In particular, it just enqueues the |
905 | 665 | task in the self.to_remove queue. A thread will shortly run to apply the | ||
906 | 666 | requested changes. | ||
907 | 667 | |||
908 | 544 | @param tid: The Task ID of the task to be removed | 668 | @param tid: The Task ID of the task to be removed |
909 | 545 | ''' | 669 | ''' |
910 | 546 | if tid not in self.to_remove: | 670 | if tid not in self.to_remove: |
911 | @@ -553,8 +677,6 @@ | |||
912 | 553 | Helper method. Forces the backend to perform all the pending changes. | 677 | Helper method. Forces the backend to perform all the pending changes. |
913 | 554 | It is usually called upon quitting the backend. | 678 | It is usually called upon quitting the backend. |
914 | 555 | ''' | 679 | ''' |
915 | 556 | #FIXME: this function should become part of the r/w r/o generic class | ||
916 | 557 | # for backends | ||
917 | 558 | if self.to_set_timer != None: | 680 | if self.to_set_timer != None: |
918 | 559 | self.please_quit = True | 681 | self.please_quit = True |
919 | 560 | try: | 682 | try: |
920 | @@ -562,10 +684,10 @@ | |||
921 | 562 | except: | 684 | except: |
922 | 563 | pass | 685 | pass |
923 | 564 | try: | 686 | try: |
925 | 565 | self.to_set_timer.join(5) | 687 | self.to_set_timer.join() |
926 | 566 | except: | 688 | except: |
927 | 567 | pass | 689 | pass |
930 | 568 | self.please_quit = False | 690 | self.launch_setting_thread(bypass_quit_request = True) |
929 | 569 | self.launch_setting_thread() | ||
931 | 570 | self.save_state() | 691 | self.save_state() |
932 | 571 | 692 | ||
933 | 693 | |||
934 | 572 | 694 | ||
935 | === modified file 'GTG/core/datastore.py' | |||
936 | --- GTG/core/datastore.py 2010-06-23 10:54:11 +0000 | |||
937 | +++ GTG/core/datastore.py 2010-08-13 23:43:04 +0000 | |||
938 | @@ -18,8 +18,8 @@ | |||
939 | 18 | # ----------------------------------------------------------------------------- | 18 | # ----------------------------------------------------------------------------- |
940 | 19 | 19 | ||
941 | 20 | """ | 20 | """ |
944 | 21 | The DaataStore contains a list of TagSource objects, which are proxies | 21 | Contains the Datastore object, which is the manager of all the active backends |
945 | 22 | between a backend and the datastore itself | 22 | (both enabled and disabled ones) |
946 | 23 | """ | 23 | """ |
947 | 24 | 24 | ||
948 | 25 | import threading | 25 | import threading |
949 | @@ -34,7 +34,6 @@ | |||
950 | 34 | from GTG.tools.logger import Log | 34 | from GTG.tools.logger import Log |
951 | 35 | from GTG.backends.genericbackend import GenericBackend | 35 | from GTG.backends.genericbackend import GenericBackend |
952 | 36 | from GTG.tools import cleanxml | 36 | from GTG.tools import cleanxml |
953 | 37 | from GTG.tools.keyring import Keyring | ||
954 | 38 | from GTG.backends.backendsignals import BackendSignals | 37 | from GTG.backends.backendsignals import BackendSignals |
955 | 39 | from GTG.tools.synchronized import synchronized | 38 | from GTG.tools.synchronized import synchronized |
956 | 40 | from GTG.tools.borg import Borg | 39 | from GTG.tools.borg import Borg |
957 | @@ -59,11 +58,17 @@ | |||
958 | 59 | self.requester = requester.Requester(self) | 58 | self.requester = requester.Requester(self) |
959 | 60 | self.tagstore = tagstore.TagStore(self.requester) | 59 | self.tagstore = tagstore.TagStore(self.requester) |
960 | 61 | self._backend_signals = BackendSignals() | 60 | self._backend_signals = BackendSignals() |
963 | 62 | self.mutex = threading.RLock() | 61 | self.please_quit = False #when turned to true, all pending operation |
964 | 63 | self.is_default_backend_loaded = False | 62 | # should be completed and then GTG should quit |
965 | 63 | self.is_default_backend_loaded = False #the default backend must be | ||
966 | 64 | # loaded before anyone else. | ||
967 | 65 | # This turns to True when the | ||
968 | 66 | # default backend loading has | ||
969 | 67 | # finished. | ||
970 | 64 | self._backend_signals.connect('default-backend-loaded', \ | 68 | self._backend_signals.connect('default-backend-loaded', \ |
971 | 65 | self._activate_non_default_backends) | 69 | self._activate_non_default_backends) |
972 | 66 | self.filtered_datastore = FilteredDataStore(self) | 70 | self.filtered_datastore = FilteredDataStore(self) |
973 | 71 | self._backend_mutex = threading.Lock() | ||
974 | 67 | 72 | ||
975 | 68 | ########################################################################## | 73 | ########################################################################## |
976 | 69 | ### Helper functions (get_ methods for Datastore embedded objects) | 74 | ### Helper functions (get_ methods for Datastore embedded objects) |
977 | @@ -72,6 +77,7 @@ | |||
978 | 72 | def get_tagstore(self): | 77 | def get_tagstore(self): |
979 | 73 | ''' | 78 | ''' |
980 | 74 | Helper function to obtain the Tagstore associated with this DataStore | 79 | Helper function to obtain the Tagstore associated with this DataStore |
981 | 80 | |||
982 | 75 | @return GTG.core.tagstore.TagStore: the tagstore object | 81 | @return GTG.core.tagstore.TagStore: the tagstore object |
983 | 76 | ''' | 82 | ''' |
984 | 77 | return self.tagstore | 83 | return self.tagstore |
985 | @@ -79,15 +85,17 @@ | |||
986 | 79 | def get_requester(self): | 85 | def get_requester(self): |
987 | 80 | ''' | 86 | ''' |
988 | 81 | Helper function to get the Requester associate with this DataStore | 87 | Helper function to get the Requester associate with this DataStore |
989 | 88 | |||
990 | 82 | @returns GTG.core.requester.Requester: the requester associated with | 89 | @returns GTG.core.requester.Requester: the requester associated with |
992 | 83 | this datastore | 90 | this datastore |
993 | 84 | ''' | 91 | ''' |
994 | 85 | return self.requester | 92 | return self.requester |
995 | 86 | 93 | ||
996 | 87 | def get_tasks_tree(self): | 94 | def get_tasks_tree(self): |
997 | 88 | ''' | 95 | ''' |
998 | 89 | Helper function to get a Tree with all the tasks contained in this | 96 | Helper function to get a Tree with all the tasks contained in this |
1000 | 90 | Datastore | 97 | Datastore. |
1001 | 98 | |||
1002 | 91 | @returns GTG.core.tree.Tree: a task tree (the main one) | 99 | @returns GTG.core.tree.Tree: a task tree (the main one) |
1003 | 92 | ''' | 100 | ''' |
1004 | 93 | return self.open_tasks | 101 | return self.open_tasks |
1005 | @@ -99,6 +107,7 @@ | |||
1006 | 99 | def get_all_tasks(self): | 107 | def get_all_tasks(self): |
1007 | 100 | ''' | 108 | ''' |
1008 | 101 | Returns list of all keys of open tasks | 109 | Returns list of all keys of open tasks |
1009 | 110 | |||
1010 | 102 | @return a list of strings: a list of task ids | 111 | @return a list of strings: a list of task ids |
1011 | 103 | ''' | 112 | ''' |
1012 | 104 | return self.open_tasks.get_all_keys() | 113 | return self.open_tasks.get_all_keys() |
1013 | @@ -107,6 +116,7 @@ | |||
1014 | 107 | ''' | 116 | ''' |
1015 | 108 | Returns true if the tid is among the open or closed tasks for | 117 | Returns true if the tid is among the open or closed tasks for |
1016 | 109 | this DataStore, False otherwise. | 118 | this DataStore, False otherwise. |
1017 | 119 | |||
1018 | 110 | @param tid: Task ID to search for | 120 | @param tid: Task ID to search for |
1019 | 111 | @return bool: True if the task is present | 121 | @return bool: True if the task is present |
1020 | 112 | ''' | 122 | ''' |
1021 | @@ -116,6 +126,7 @@ | |||
1022 | 116 | ''' | 126 | ''' |
1023 | 117 | Returns the internal task object for the given tid, or None if the | 127 | Returns the internal task object for the given tid, or None if the |
1024 | 118 | tid is not present in this DataStore. | 128 | tid is not present in this DataStore. |
1025 | 129 | |||
1026 | 119 | @param tid: Task ID to retrieve | 130 | @param tid: Task ID to retrieve |
1027 | 120 | @returns GTG.core.task.Task or None: whether the Task is present | 131 | @returns GTG.core.task.Task or None: whether the Task is present |
1028 | 121 | or not | 132 | or not |
1029 | @@ -123,12 +134,13 @@ | |||
1030 | 123 | if self.has_task(tid): | 134 | if self.has_task(tid): |
1031 | 124 | return self.open_tasks.get_node(tid) | 135 | return self.open_tasks.get_node(tid) |
1032 | 125 | else: | 136 | else: |
1034 | 126 | Log.debug("requested non-existent task") | 137 | Log.error("requested non-existent task") |
1035 | 127 | return None | 138 | return None |
1036 | 128 | 139 | ||
1037 | 129 | def task_factory(self, tid, newtask = False): | 140 | def task_factory(self, tid, newtask = False): |
1038 | 130 | ''' | 141 | ''' |
1039 | 131 | Instantiates the given task id as a Task object. | 142 | Instantiates the given task id as a Task object. |
1040 | 143 | |||
1041 | 132 | @param tid: a task id. Must be unique | 144 | @param tid: a task id. Must be unique |
1042 | 133 | @param newtask: True if the task has never been seen before | 145 | @param newtask: True if the task has never been seen before |
1043 | 134 | @return Task: a Task instance | 146 | @return Task: a Task instance |
1044 | @@ -141,6 +153,7 @@ | |||
1045 | 141 | New task is created in all the backends that collect all tasks (among | 153 | New task is created in all the backends that collect all tasks (among |
1046 | 142 | them, the default backend). The default backend uses the same task id | 154 | them, the default backend). The default backend uses the same task id |
1047 | 143 | in its own internal representation. | 155 | in its own internal representation. |
1048 | 156 | |||
1049 | 144 | @return: The task object that was created. | 157 | @return: The task object that was created. |
1050 | 145 | """ | 158 | """ |
1051 | 146 | task = self.task_factory(uuid.uuid4(), True) | 159 | task = self.task_factory(uuid.uuid4(), True) |
1052 | @@ -148,10 +161,13 @@ | |||
1053 | 148 | return task | 161 | return task |
1054 | 149 | 162 | ||
1055 | 150 | @synchronized | 163 | @synchronized |
1057 | 151 | def push_task(self, task, backend_capabilities = 'bypass for now'): | 164 | def push_task(self, task): |
1058 | 152 | ''' | 165 | ''' |
1059 | 153 | Adds the given task object to the task tree. In other words, registers | 166 | Adds the given task object to the task tree. In other words, registers |
1060 | 154 | the given task in the GTG task set. | 167 | the given task in the GTG task set. |
1061 | 168 | This function is used in mutual exclusion: only a backend at a time is | ||
1062 | 169 | allowed to push tasks. | ||
1063 | 170 | |||
1064 | 155 | @param task: A valid task object (a GTG.core.task.Task) | 171 | @param task: A valid task object (a GTG.core.task.Task) |
1065 | 156 | @return bool: True if the task has been accepted | 172 | @return bool: True if the task has been accepted |
1066 | 157 | ''' | 173 | ''' |
1067 | @@ -172,10 +188,10 @@ | |||
1068 | 172 | def get_all_backends(self, disabled = False): | 188 | def get_all_backends(self, disabled = False): |
1069 | 173 | """ | 189 | """ |
1070 | 174 | returns list of all registered backends for this DataStore. | 190 | returns list of all registered backends for this DataStore. |
1071 | 191 | |||
1072 | 175 | @param disabled: If disabled is True, attaches also the list of disabled backends | 192 | @param disabled: If disabled is True, attaches also the list of disabled backends |
1073 | 176 | @return list: a list of TaskSource objects | 193 | @return list: a list of TaskSource objects |
1074 | 177 | """ | 194 | """ |
1075 | 178 | #NOTE: consider cashing this result for speed. | ||
1076 | 179 | result = [] | 195 | result = [] |
1077 | 180 | for backend in self.backends.itervalues(): | 196 | for backend in self.backends.itervalues(): |
1078 | 181 | if backend.is_enabled() or disabled: | 197 | if backend.is_enabled() or disabled: |
1079 | @@ -184,10 +200,11 @@ | |||
1080 | 184 | 200 | ||
1081 | 185 | def get_backend(self, backend_id): | 201 | def get_backend(self, backend_id): |
1082 | 186 | ''' | 202 | ''' |
1084 | 187 | Returns a backend given its id | 203 | Returns a backend given its id. |
1085 | 204 | |||
1086 | 188 | @param backend_id: a backend id | 205 | @param backend_id: a backend id |
1087 | 189 | @returns GTG.core.datastore.TaskSource or None: the requested backend, | 206 | @returns GTG.core.datastore.TaskSource or None: the requested backend, |
1089 | 190 | or none | 207 | or None |
1090 | 191 | ''' | 208 | ''' |
1091 | 192 | if backend_id in self.backends: | 209 | if backend_id in self.backends: |
1092 | 193 | return self.backends[backend_id] | 210 | return self.backends[backend_id] |
1093 | @@ -197,20 +214,24 @@ | |||
1094 | 197 | def register_backend(self, backend_dic): | 214 | def register_backend(self, backend_dic): |
1095 | 198 | """ | 215 | """ |
1096 | 199 | Registers a TaskSource as a backend for this DataStore | 216 | Registers a TaskSource as a backend for this DataStore |
1097 | 217 | |||
1098 | 200 | @param backend_dic: Dictionary object containing all the | 218 | @param backend_dic: Dictionary object containing all the |
1102 | 201 | parameters to initialize the backend (filename...). It should | 219 | parameters to initialize the backend |
1103 | 202 | also contain the backend class (under "backend"), and its unique | 220 | (filename...). It should also contain the |
1104 | 203 | id (under "pid") | 221 | backend class (under "backend"), and its |
1105 | 222 | unique id (under "pid") | ||
1106 | 204 | """ | 223 | """ |
1107 | 205 | if "backend" in backend_dic: | 224 | if "backend" in backend_dic: |
1108 | 206 | if "pid" not in backend_dic: | 225 | if "pid" not in backend_dic: |
1110 | 207 | Log.debug("registering a backend without pid.") | 226 | Log.error("registering a backend without pid.") |
1111 | 208 | return None | 227 | return None |
1112 | 209 | backend = backend_dic["backend"] | 228 | backend = backend_dic["backend"] |
1113 | 210 | #Checking that is a new backend | 229 | #Checking that is a new backend |
1114 | 211 | if backend.get_id() in self.backends: | 230 | if backend.get_id() in self.backends: |
1116 | 212 | Log.debug("registering already registered backend") | 231 | Log.error("registering already registered backend") |
1117 | 213 | return None | 232 | return None |
1118 | 233 | #creating the TaskSource which will wrap the backend, | ||
1119 | 234 | # filtering the tasks that should hit the backend. | ||
1120 | 214 | source = TaskSource(requester = self.requester, | 235 | source = TaskSource(requester = self.requester, |
1121 | 215 | backend = backend, | 236 | backend = backend, |
1122 | 216 | datastore = self.filtered_datastore) | 237 | datastore = self.filtered_datastore) |
1123 | @@ -234,23 +255,46 @@ | |||
1124 | 234 | source.start_get_tasks() | 255 | source.start_get_tasks() |
1125 | 235 | return source | 256 | return source |
1126 | 236 | else: | 257 | else: |
1128 | 237 | Log.debug("Tried to register a backend without a pid") | 258 | Log.error("Tried to register a backend without a pid") |
1129 | 238 | 259 | ||
1130 | 239 | def _activate_non_default_backends(self, sender = None): | 260 | def _activate_non_default_backends(self, sender = None): |
1131 | 240 | ''' | 261 | ''' |
1132 | 241 | Non-default backends have to wait until the default loads before | 262 | Non-default backends have to wait until the default loads before |
1133 | 242 | being activated. This function is called after the first default | 263 | being activated. This function is called after the first default |
1134 | 243 | backend has loaded all its tasks. | 264 | backend has loaded all its tasks. |
1135 | 265 | |||
1136 | 266 | @param sender: not used, just here for signal compatibility | ||
1137 | 244 | ''' | 267 | ''' |
1138 | 245 | if self.is_default_backend_loaded: | 268 | if self.is_default_backend_loaded: |
1139 | 246 | Log.debug("spurious call") | 269 | Log.debug("spurious call") |
1140 | 247 | return | 270 | return |
1141 | 271 | |||
1142 | 272 | |||
1143 | 248 | self.is_default_backend_loaded = True | 273 | self.is_default_backend_loaded = True |
1144 | 249 | for backend in self.backends.itervalues(): | 274 | for backend in self.backends.itervalues(): |
1145 | 250 | if backend.is_enabled() and not backend.is_default(): | 275 | if backend.is_enabled() and not backend.is_default(): |
1149 | 251 | backend.initialize() | 276 | self._backend_startup(backend) |
1150 | 252 | backend.start_get_tasks() | 277 | |
1151 | 253 | self.flush_all_tasks(backend.get_id()) | 278 | def _backend_startup(self, backend): |
1152 | 279 | ''' | ||
1153 | 280 | Helper function to launch a thread that starts a backend. | ||
1154 | 281 | |||
1155 | 282 | @param backend: the backend object | ||
1156 | 283 | ''' | ||
1157 | 284 | def __backend_startup(self, backend): | ||
1158 | 285 | ''' | ||
1159 | 286 | Helper function to start a backend | ||
1160 | 287 | |||
1161 | 288 | @param backend: the backend object | ||
1162 | 289 | ''' | ||
1163 | 290 | backend.initialize() | ||
1164 | 291 | backend.start_get_tasks() | ||
1165 | 292 | self.flush_all_tasks(backend.get_id()) | ||
1166 | 293 | |||
1167 | 294 | thread = threading.Thread(target = __backend_startup, | ||
1168 | 295 | args = (self, backend)) | ||
1169 | 296 | thread.setDaemon(True) | ||
1170 | 297 | thread.start() | ||
1171 | 254 | 298 | ||
1172 | 255 | def set_backend_enabled(self, backend_id, state): | 299 | def set_backend_enabled(self, backend_id, state): |
1173 | 256 | """ | 300 | """ |
1174 | @@ -262,6 +306,7 @@ | |||
1175 | 262 | Enable: | 306 | Enable: |
1176 | 263 | Reloads a disabled backend. Backend must be already known by the | 307 | Reloads a disabled backend. Backend must be already known by the |
1177 | 264 | Datastore | 308 | Datastore |
1178 | 309 | |||
1179 | 265 | @parma backend_id: a backend id | 310 | @parma backend_id: a backend id |
1180 | 266 | @param state: True to enable, False to disable | 311 | @param state: True to enable, False to disable |
1181 | 267 | """ | 312 | """ |
1182 | @@ -270,11 +315,12 @@ | |||
1183 | 270 | current_state = backend.is_enabled() | 315 | current_state = backend.is_enabled() |
1184 | 271 | if current_state == True and state == False: | 316 | if current_state == True and state == False: |
1185 | 272 | #we disable the backend | 317 | #we disable the backend |
1187 | 273 | backend.quit(disable = True) | 318 | #FIXME!!! |
1188 | 319 | threading.Thread(target = backend.quit, \ | ||
1189 | 320 | kwargs = {'disable': True}).start() | ||
1190 | 274 | elif current_state == False and state == True: | 321 | elif current_state == False and state == True: |
1191 | 275 | if self.is_default_backend_loaded == True: | 322 | if self.is_default_backend_loaded == True: |
1194 | 276 | backend.initialize() | 323 | self._backend_startup(backend) |
1193 | 277 | self.flush_all_tasks(backend_id) | ||
1195 | 278 | else: | 324 | else: |
1196 | 279 | #will be activated afterwards | 325 | #will be activated afterwards |
1197 | 280 | backend.set_parameter(GenericBackend.KEY_ENABLED, | 326 | backend.set_parameter(GenericBackend.KEY_ENABLED, |
1198 | @@ -283,13 +329,19 @@ | |||
1199 | 283 | def remove_backend(self, backend_id): | 329 | def remove_backend(self, backend_id): |
1200 | 284 | ''' | 330 | ''' |
1201 | 285 | Removes a backend, and forgets it ever existed. | 331 | Removes a backend, and forgets it ever existed. |
1202 | 332 | |||
1203 | 286 | @param backend_id: a backend id | 333 | @param backend_id: a backend id |
1204 | 287 | ''' | 334 | ''' |
1205 | 288 | if backend_id in self.backends: | 335 | if backend_id in self.backends: |
1206 | 289 | backend = self.backends[backend_id] | 336 | backend = self.backends[backend_id] |
1207 | 290 | if backend.is_enabled(): | 337 | if backend.is_enabled(): |
1208 | 291 | self.set_backend_enabled(backend_id, False) | 338 | self.set_backend_enabled(backend_id, False) |
1210 | 292 | backend.purge() | 339 | #FIXME: to keep things simple, backends are not notified that they |
1211 | 340 | # are completely removed (they think they're just | ||
1212 | 341 | # deactivated). We should add a "purge" call to backend to let | ||
1213 | 342 | # them know that they're removed, so that they can remove all | ||
1214 | 343 | # the various files they've created. (invernizzi) | ||
1215 | 344 | |||
1216 | 293 | #we notify that the backend has been deleted | 345 | #we notify that the backend has been deleted |
1217 | 294 | self._backend_signals.backend_removed(backend.get_id()) | 346 | self._backend_signals.backend_removed(backend.get_id()) |
1218 | 295 | del self.backends[backend_id] | 347 | del self.backends[backend_id] |
1219 | @@ -297,6 +349,7 @@ | |||
1220 | 297 | def backend_change_attached_tags(self, backend_id, tag_names): | 349 | def backend_change_attached_tags(self, backend_id, tag_names): |
1221 | 298 | ''' | 350 | ''' |
1222 | 299 | Changes the tags for which a backend should store a task | 351 | Changes the tags for which a backend should store a task |
1223 | 352 | |||
1224 | 300 | @param backend_id: a backend_id | 353 | @param backend_id: a backend_id |
1225 | 301 | @param tag_names: the new set of tags. This should not be a tag object, | 354 | @param tag_names: the new set of tags. This should not be a tag object, |
1226 | 302 | just the tag name. | 355 | just the tag name. |
1227 | @@ -312,43 +365,59 @@ | |||
1228 | 312 | It has to be run after the creation of a new backend (or an alteration | 365 | It has to be run after the creation of a new backend (or an alteration |
1229 | 313 | of its "attached tags"), so that the tasks which are already loaded in | 366 | of its "attached tags"), so that the tasks which are already loaded in |
1230 | 314 | the Tree will be saved in the proper backends | 367 | the Tree will be saved in the proper backends |
1231 | 368 | |||
1232 | 315 | @param backend_id: a backend id | 369 | @param backend_id: a backend id |
1233 | 316 | ''' | 370 | ''' |
1234 | 317 | def _internal_flush_all_tasks(): | 371 | def _internal_flush_all_tasks(): |
1235 | 318 | backend = self.backends[backend_id] | 372 | backend = self.backends[backend_id] |
1236 | 319 | for task_id in self.requester.get_all_tasks_list(): | 373 | for task_id in self.requester.get_all_tasks_list(): |
1237 | 374 | if self.please_quit: | ||
1238 | 375 | break | ||
1239 | 320 | backend.queue_set_task(None, task_id) | 376 | backend.queue_set_task(None, task_id) |
1241 | 321 | t = threading.Thread(target = _internal_flush_all_tasks).start() | 377 | t = threading.Thread(target = _internal_flush_all_tasks) |
1242 | 378 | t.start() | ||
1243 | 322 | self.backends[backend_id].start_get_tasks() | 379 | self.backends[backend_id].start_get_tasks() |
1244 | 323 | 380 | ||
1245 | 324 | def save(self, quit = False): | 381 | def save(self, quit = False): |
1246 | 325 | ''' | 382 | ''' |
1247 | 326 | Saves the backends parameters. | 383 | Saves the backends parameters. |
1248 | 384 | |||
1249 | 327 | @param quit: If quit is true, backends are shut down | 385 | @param quit: If quit is true, backends are shut down |
1250 | 328 | ''' | 386 | ''' |
1251 | 387 | try: | ||
1252 | 388 | self.start_get_tasks_thread.join() | ||
1253 | 389 | except Exception, e: | ||
1254 | 390 | pass | ||
1255 | 329 | doc,xmlconfig = cleanxml.emptydoc("config") | 391 | doc,xmlconfig = cleanxml.emptydoc("config") |
1256 | 330 | #we ask all the backends to quit first. | 392 | #we ask all the backends to quit first. |
1257 | 331 | if quit: | 393 | if quit: |
1258 | 394 | #we quit backends in parallel | ||
1259 | 395 | threads_dic = {} | ||
1260 | 332 | for b in self.get_all_backends(): | 396 | for b in self.get_all_backends(): |
1264 | 333 | #NOTE:we could do this in parallel. Maybe a quit and | 397 | thread = threading.Thread(target = b.quit) |
1265 | 334 | #has_quit would be faster (invernizzi) | 398 | threads_dic[b.get_id()] = thread |
1266 | 335 | b.quit() | 399 | thread.start() |
1267 | 400 | for backend_id, thread in threads_dic.iteritems(): | ||
1268 | 401 | #after 20 seconds, we give up | ||
1269 | 402 | thread.join(20) | ||
1270 | 403 | if thread.isAlive(): | ||
1271 | 404 | Log.error("The %s backend stalled while quitting", | ||
1272 | 405 | backend_id) | ||
1273 | 336 | #we save the parameters | 406 | #we save the parameters |
1274 | 337 | for b in self.get_all_backends(disabled = True): | 407 | for b in self.get_all_backends(disabled = True): |
1275 | 338 | t_xml = doc.createElement("backend") | 408 | t_xml = doc.createElement("backend") |
1276 | 339 | for key, value in b.get_parameters().iteritems(): | 409 | for key, value in b.get_parameters().iteritems(): |
1277 | 340 | if key in ["backend", "xmlobject"]: | 410 | if key in ["backend", "xmlobject"]: |
1279 | 341 | #We don't want parameters,backend,xmlobject | 411 | #We don't want parameters, backend, xmlobject: we'll create |
1280 | 412 | # them at next startup | ||
1281 | 342 | continue | 413 | continue |
1282 | 343 | param_type = b.get_parameter_type(key) | 414 | param_type = b.get_parameter_type(key) |
1283 | 344 | value = b.cast_param_type_to_string(param_type, value) | 415 | value = b.cast_param_type_to_string(param_type, value) |
1284 | 345 | t_xml.setAttribute(str(key), value) | 416 | t_xml.setAttribute(str(key), value) |
1285 | 346 | #Saving all the projects at close | 417 | #Saving all the projects at close |
1286 | 347 | xmlconfig.appendChild(t_xml) | 418 | xmlconfig.appendChild(t_xml) |
1287 | 348 | |||
1288 | 349 | datafile = os.path.join(CoreConfig().get_data_dir(), CoreConfig.DATA_FILE) | 419 | datafile = os.path.join(CoreConfig().get_data_dir(), CoreConfig.DATA_FILE) |
1289 | 350 | cleanxml.savexml(datafile,doc,backup=True) | 420 | cleanxml.savexml(datafile,doc,backup=True) |
1290 | 351 | |||
1291 | 352 | #Saving the tagstore | 421 | #Saving the tagstore |
1292 | 353 | ts = self.get_tagstore() | 422 | ts = self.get_tagstore() |
1293 | 354 | ts.save() | 423 | ts.save() |
1294 | @@ -356,9 +425,21 @@ | |||
1295 | 356 | def request_task_deletion(self, tid): | 425 | def request_task_deletion(self, tid): |
1296 | 357 | ''' | 426 | ''' |
1297 | 358 | This is a proxy function to request a task deletion from a backend | 427 | This is a proxy function to request a task deletion from a backend |
1298 | 428 | |||
1299 | 359 | @param tid: the tid of the task to remove | 429 | @param tid: the tid of the task to remove |
1300 | 360 | ''' | 430 | ''' |
1301 | 361 | self.requester.delete_task(tid) | 431 | self.requester.delete_task(tid) |
1302 | 432 | |||
1303 | 433 | def get_backend_mutex(self): | ||
1304 | 434 | ''' | ||
1305 | 435 | Returns the mutex object used by backends to avoid modifying a task | ||
1306 | 436 | at the same time. | ||
1307 | 437 | |||
1308 | 438 | @returns threading.Lock | ||
1309 | 439 | ''' | ||
1310 | 440 | return self._backend_mutex | ||
1311 | 441 | |||
1312 | 442 | |||
1313 | 362 | 443 | ||
1314 | 363 | 444 | ||
1315 | 364 | class TaskSource(): | 445 | class TaskSource(): |
1316 | @@ -366,9 +447,12 @@ | |||
1317 | 366 | Transparent interface between the real backend and the DataStore. | 447 | Transparent interface between the real backend and the DataStore. |
1318 | 367 | Is in charge of connecting and disconnecting to signals | 448 | Is in charge of connecting and disconnecting to signals |
1319 | 368 | ''' | 449 | ''' |
1320 | 450 | |||
1321 | 451 | |||
1322 | 369 | def __init__(self, requester, backend, datastore): | 452 | def __init__(self, requester, backend, datastore): |
1323 | 370 | """ | 453 | """ |
1324 | 371 | Instantiates a TaskSource object. | 454 | Instantiates a TaskSource object. |
1325 | 455 | |||
1326 | 372 | @param requester: a Requester | 456 | @param requester: a Requester |
1327 | 373 | @param backend: the backend being wrapped | 457 | @param backend: the backend being wrapped |
1328 | 374 | @param datastore: a FilteredDatastore | 458 | @param datastore: a FilteredDatastore |
1329 | @@ -378,6 +462,7 @@ | |||
1330 | 378 | self.backend.register_datastore(datastore) | 462 | self.backend.register_datastore(datastore) |
1331 | 379 | self.to_set = deque() | 463 | self.to_set = deque() |
1332 | 380 | self.to_remove = deque() | 464 | self.to_remove = deque() |
1333 | 465 | self.please_quit = False | ||
1334 | 381 | self.task_filter = self.get_task_filter_for_backend() | 466 | self.task_filter = self.get_task_filter_for_backend() |
1335 | 382 | if Log.is_debugging_mode(): | 467 | if Log.is_debugging_mode(): |
1336 | 383 | self.timer_timestep = 5 | 468 | self.timer_timestep = 5 |
1337 | @@ -391,7 +476,10 @@ | |||
1338 | 391 | '''' | 476 | '''' |
1339 | 392 | Maps the TaskSource to the backend and starts threading. | 477 | Maps the TaskSource to the backend and starts threading. |
1340 | 393 | ''' | 478 | ''' |
1342 | 394 | threading.Thread(target = self.__start_get_tasks).start() | 479 | self.start_get_tasks_thread = \ |
1343 | 480 | threading.Thread(target = self.__start_get_tasks) | ||
1344 | 481 | self.start_get_tasks_thread.setDaemon(True) | ||
1345 | 482 | self.start_get_tasks_thread.start() | ||
1346 | 395 | 483 | ||
1347 | 396 | def __start_get_tasks(self): | 484 | def __start_get_tasks(self): |
1348 | 397 | ''' | 485 | ''' |
1349 | @@ -405,7 +493,7 @@ | |||
1350 | 405 | 493 | ||
1351 | 406 | def get_task_filter_for_backend(self): | 494 | def get_task_filter_for_backend(self): |
1352 | 407 | ''' | 495 | ''' |
1354 | 408 | Fiter that checks if the task should be stored in this backend. | 496 | Filter that checks if the task should be stored in this backend. |
1355 | 409 | 497 | ||
1356 | 410 | @returns function: a function that accepts a task and returns True/False | 498 | @returns function: a function that accepts a task and returns True/False |
1357 | 411 | whether the task should be stored or not | 499 | whether the task should be stored or not |
1358 | @@ -417,6 +505,7 @@ | |||
1359 | 417 | def should_task_id_be_stored(self, task_id): | 505 | def should_task_id_be_stored(self, task_id): |
1360 | 418 | ''' | 506 | ''' |
1361 | 419 | Helper function: Checks if a task should be stored in this backend | 507 | Helper function: Checks if a task should be stored in this backend |
1362 | 508 | |||
1363 | 420 | @param task_id: a task id | 509 | @param task_id: a task id |
1364 | 421 | @returns bool: True if the task should be stored | 510 | @returns bool: True if the task should be stored |
1365 | 422 | ''' | 511 | ''' |
1366 | @@ -427,6 +516,7 @@ | |||
1367 | 427 | """ | 516 | """ |
1368 | 428 | Updates the task in the DataStore. Actually, it adds the task to a | 517 | Updates the task in the DataStore. Actually, it adds the task to a |
1369 | 429 | queue to be updated asynchronously. | 518 | queue to be updated asynchronously. |
1370 | 519 | |||
1371 | 430 | @param sender: not used, any value will do. | 520 | @param sender: not used, any value will do. |
1372 | 431 | @param task: The Task object to be updated. | 521 | @param task: The Task object to be updated. |
1373 | 432 | """ | 522 | """ |
1374 | @@ -437,14 +527,17 @@ | |||
1375 | 437 | else: | 527 | else: |
1376 | 438 | self.queue_remove_task(None, tid) | 528 | self.queue_remove_task(None, tid) |
1377 | 439 | 529 | ||
1379 | 440 | def launch_setting_thread(self): | 530 | def launch_setting_thread(self, bypass_please_quit = False): |
1380 | 441 | ''' | 531 | ''' |
1381 | 442 | Operates the threads to set and remove tasks. | 532 | Operates the threads to set and remove tasks. |
1382 | 443 | Releases the lock when it is done. | 533 | Releases the lock when it is done. |
1383 | 534 | |||
1384 | 535 | @param bypass_please_quit: if True, the self.please_quit "quit condition" | ||
1385 | 536 | is ignored. Currently, it's turned to true | ||
1386 | 537 | after the quit condition has been issued, to | ||
1387 | 538 | execute eventual pending operations. | ||
1388 | 444 | ''' | 539 | ''' |
1392 | 445 | #FIXME: the lock should be general for all backends. Therefore, it | 540 | while not self.please_quit or bypass_please_quit: |
1390 | 446 | #should be handled in the datastore | ||
1391 | 447 | while True: | ||
1393 | 448 | try: | 541 | try: |
1394 | 449 | tid = self.to_set.pop() | 542 | tid = self.to_set.pop() |
1395 | 450 | except IndexError: | 543 | except IndexError: |
1396 | @@ -457,7 +550,7 @@ | |||
1397 | 457 | self.req.has_task(tid): | 550 | self.req.has_task(tid): |
1398 | 458 | task = self.req.get_task(tid) | 551 | task = self.req.get_task(tid) |
1399 | 459 | self.backend.queue_set_task(task) | 552 | self.backend.queue_set_task(task) |
1401 | 460 | while True: | 553 | while not self.please_quit or bypass_please_quit: |
1402 | 461 | try: | 554 | try: |
1403 | 462 | tid = self.to_remove.pop() | 555 | tid = self.to_remove.pop() |
1404 | 463 | except IndexError: | 556 | except IndexError: |
1405 | @@ -469,6 +562,7 @@ | |||
1406 | 469 | def queue_remove_task(self, sender, tid): | 562 | def queue_remove_task(self, sender, tid): |
1407 | 470 | ''' | 563 | ''' |
1408 | 471 | Queues task to be removed. | 564 | Queues task to be removed. |
1409 | 565 | |||
1410 | 472 | @param sender: not used, any value will do | 566 | @param sender: not used, any value will do |
1411 | 473 | @param tid: The Task ID of the task to be removed | 567 | @param tid: The Task ID of the task to be removed |
1412 | 474 | ''' | 568 | ''' |
1413 | @@ -480,14 +574,16 @@ | |||
1414 | 480 | ''' | 574 | ''' |
1415 | 481 | Helper function to launch the setting thread, if it's not running | 575 | Helper function to launch the setting thread, if it's not running |
1416 | 482 | ''' | 576 | ''' |
1418 | 483 | if self.to_set_timer == None: | 577 | if self.to_set_timer == None and not self.please_quit: |
1419 | 484 | self.to_set_timer = threading.Timer(self.timer_timestep, \ | 578 | self.to_set_timer = threading.Timer(self.timer_timestep, \ |
1420 | 485 | self.launch_setting_thread) | 579 | self.launch_setting_thread) |
1421 | 580 | self.to_set_timer.setDaemon(True) | ||
1422 | 486 | self.to_set_timer.start() | 581 | self.to_set_timer.start() |
1423 | 487 | 582 | ||
1424 | 488 | def initialize(self, connect_signals = True): | 583 | def initialize(self, connect_signals = True): |
1425 | 489 | ''' | 584 | ''' |
1426 | 490 | Initializes the backend and starts looking for signals. | 585 | Initializes the backend and starts looking for signals. |
1427 | 586 | |||
1428 | 491 | @param connect_signals: if True, it starts listening for signals | 587 | @param connect_signals: if True, it starts listening for signals |
1429 | 492 | ''' | 588 | ''' |
1430 | 493 | self.backend.initialize() | 589 | self.backend.initialize() |
1431 | @@ -520,23 +616,28 @@ | |||
1432 | 520 | ''' | 616 | ''' |
1433 | 521 | Forces the TaskSource to sync all the pending tasks | 617 | Forces the TaskSource to sync all the pending tasks |
1434 | 522 | ''' | 618 | ''' |
1445 | 523 | if self.to_set_timer != None: | 619 | try: |
1446 | 524 | try: | 620 | self.to_set_timer.cancel() |
1447 | 525 | self.to_set_timer.cancel() | 621 | except Exception, e: |
1448 | 526 | except: | 622 | pass |
1449 | 527 | pass | 623 | try: |
1450 | 528 | try: | 624 | self.to_set_timer.join(3) |
1451 | 529 | self.to_set_timer.join(5) | 625 | except Exception, e: |
1452 | 530 | except: | 626 | pass |
1453 | 531 | pass | 627 | try: |
1454 | 532 | self.launch_setting_thread() | 628 | self.start_get_tasks_thread.join(3) |
1455 | 629 | except: | ||
1456 | 630 | pass | ||
1457 | 631 | self.launch_setting_thread(bypass_please_quit = True) | ||
1458 | 533 | 632 | ||
1459 | 534 | def quit(self, disable = False): | 633 | def quit(self, disable = False): |
1460 | 535 | ''' | 634 | ''' |
1461 | 536 | Quits the backend and disconnect the signals | 635 | Quits the backend and disconnect the signals |
1462 | 636 | |||
1463 | 537 | @param disable: if True, the backend is disabled. | 637 | @param disable: if True, the backend is disabled. |
1464 | 538 | ''' | 638 | ''' |
1465 | 539 | self._disconnect_signals() | 639 | self._disconnect_signals() |
1466 | 640 | self.please_quit = True | ||
1467 | 540 | self.sync() | 641 | self.sync() |
1468 | 541 | self.backend.quit(disable) | 642 | self.backend.quit(disable) |
1469 | 542 | 643 | ||
1470 | @@ -544,6 +645,7 @@ | |||
1471 | 544 | ''' | 645 | ''' |
1472 | 545 | Delegates all the functions not defined here to the real backend | 646 | Delegates all the functions not defined here to the real backend |
1473 | 546 | (standard python function) | 647 | (standard python function) |
1474 | 648 | |||
1475 | 547 | @param attr: attribute to get | 649 | @param attr: attribute to get |
1476 | 548 | ''' | 650 | ''' |
1477 | 549 | if attr in self.__dict__: | 651 | if attr in self.__dict__: |
1478 | @@ -566,12 +668,15 @@ | |||
1479 | 566 | self.datastore = datastore | 668 | self.datastore = datastore |
1480 | 567 | 669 | ||
1481 | 568 | def __getattr__(self, attr): | 670 | def __getattr__(self, attr): |
1483 | 569 | if attr in ['task_factory', \ | 671 | if attr in ['task_factory', |
1484 | 570 | 'push_task', | 672 | 'push_task', |
1485 | 571 | 'get_task', | 673 | 'get_task', |
1486 | 572 | 'has_task', | 674 | 'has_task', |
1487 | 675 | 'get_backend_mutex', | ||
1488 | 573 | 'request_task_deletion']: | 676 | 'request_task_deletion']: |
1489 | 574 | return getattr(self.datastore, attr) | 677 | return getattr(self.datastore, attr) |
1490 | 678 | elif attr in ['get_all_tags']: | ||
1491 | 679 | return self.datastore.requester.get_all_tags | ||
1492 | 575 | else: | 680 | else: |
1493 | 576 | raise AttributeError | 681 | raise AttributeError |
1494 | 577 | 682 | ||
1495 | 578 | 683 | ||
1496 | === modified file 'GTG/core/filteredtree.py' | |||
1497 | --- GTG/core/filteredtree.py 2010-08-02 19:07:24 +0000 | |||
1498 | +++ GTG/core/filteredtree.py 2010-08-13 23:43:04 +0000 | |||
1499 | @@ -791,7 +791,10 @@ | |||
1500 | 791 | self.node_to_remove.append(tid) | 791 | self.node_to_remove.append(tid) |
1501 | 792 | isroot = False | 792 | isroot = False |
1502 | 793 | if tid in self.displayed_nodes: | 793 | if tid in self.displayed_nodes: |
1504 | 794 | isroot = self.__is_root(self.get_node(tid)) | 794 | node = self.get_node(tid) |
1505 | 795 | if not node: | ||
1506 | 796 | return | ||
1507 | 797 | isroot = self.__is_root(node) | ||
1508 | 795 | self.remove_count += 1 | 798 | self.remove_count += 1 |
1509 | 796 | self.__nodes_count -= 1 | 799 | self.__nodes_count -= 1 |
1510 | 797 | self.emit('task-deleted-inview',tid) | 800 | self.emit('task-deleted-inview',tid) |
1511 | 798 | 801 | ||
1512 | === modified file 'GTG/core/filters_bank.py' | |||
1513 | --- GTG/core/filters_bank.py 2010-08-02 19:09:17 +0000 | |||
1514 | +++ GTG/core/filters_bank.py 2010-08-13 23:43:04 +0000 | |||
1515 | @@ -256,6 +256,8 @@ | |||
1516 | 256 | @param task: a task object | 256 | @param task: a task object |
1517 | 257 | @oaram tags_to_match_set: a *set* of tag names | 257 | @oaram tags_to_match_set: a *set* of tag names |
1518 | 258 | ''' | 258 | ''' |
1519 | 259 | if task == None: | ||
1520 | 260 | return [] | ||
1521 | 259 | try: | 261 | try: |
1522 | 260 | tags_to_match_set = parameters['tags'] | 262 | tags_to_match_set = parameters['tags'] |
1523 | 261 | except KeyError: | 263 | except KeyError: |
1524 | 262 | 264 | ||
1525 | === modified file 'GTG/core/requester.py' | |||
1526 | --- GTG/core/requester.py 2010-06-22 19:55:15 +0000 | |||
1527 | +++ GTG/core/requester.py 2010-08-13 23:43:04 +0000 | |||
1528 | @@ -284,3 +284,6 @@ | |||
1529 | 284 | 284 | ||
1530 | 285 | def backend_change_attached_tags(self, backend_id, tags): | 285 | def backend_change_attached_tags(self, backend_id, tags): |
1531 | 286 | return self.ds.backend_change_attached_tags(backend_id, tags) | 286 | return self.ds.backend_change_attached_tags(backend_id, tags) |
1532 | 287 | |||
1533 | 288 | def save_datastore(self): | ||
1534 | 289 | return self.ds.save() | ||
1535 | 287 | 290 | ||
1536 | === modified file 'GTG/core/task.py' | |||
1537 | --- GTG/core/task.py 2010-07-01 09:59:33 +0000 | |||
1538 | +++ GTG/core/task.py 2010-08-13 23:43:04 +0000 | |||
1539 | @@ -505,7 +505,9 @@ | |||
1540 | 505 | def get_tags(self): | 505 | def get_tags(self): |
1541 | 506 | l = [] | 506 | l = [] |
1542 | 507 | for tname in self.tags: | 507 | for tname in self.tags: |
1544 | 508 | l.append(self.req.get_tag(tname)) | 508 | tag = self.req.get_tag(tname) |
1545 | 509 | if tag: | ||
1546 | 510 | l.append(tag) | ||
1547 | 509 | return l | 511 | return l |
1548 | 510 | 512 | ||
1549 | 511 | def rename_tag(self, old, new): | 513 | def rename_tag(self, old, new): |
1550 | 512 | 514 | ||
1551 | === modified file 'GTG/gtk/browser/browser.py' | |||
1552 | --- GTG/gtk/browser/browser.py 2010-08-10 17:30:24 +0000 | |||
1553 | +++ GTG/gtk/browser/browser.py 2010-08-13 23:43:04 +0000 | |||
1554 | @@ -953,7 +953,9 @@ | |||
1555 | 953 | text = \ | 953 | text = \ |
1556 | 954 | text.replace("%s%s:%s" % (spaces, attribute, args), "") | 954 | text.replace("%s%s:%s" % (spaces, attribute, args), "") |
1557 | 955 | # Create the new task | 955 | # Create the new task |
1559 | 956 | task = self.req.new_task(tags=[t.get_name() for t in tags], newtask=True) | 956 | task = self.req.new_task( newtask=True) |
1560 | 957 | for tag in tags: | ||
1561 | 958 | task.add_tag(tag.get_name()) | ||
1562 | 957 | if text != "": | 959 | if text != "": |
1563 | 958 | task.set_title(text.strip()) | 960 | task.set_title(text.strip()) |
1564 | 959 | task.set_to_keep() | 961 | task.set_to_keep() |
1565 | 960 | 962 | ||
1566 | === modified file 'GTG/tests/test_backends.py' | |||
1567 | --- GTG/tests/test_backends.py 2010-06-23 12:49:28 +0000 | |||
1568 | +++ GTG/tests/test_backends.py 2010-08-13 23:43:04 +0000 | |||
1569 | @@ -1,6 +1,6 @@ | |||
1570 | 1 | # -*- coding: utf-8 -*- | 1 | # -*- coding: utf-8 -*- |
1571 | 2 | # ----------------------------------------------------------------------------- | 2 | # ----------------------------------------------------------------------------- |
1573 | 3 | # Gettings Things Gnome! - a personal organizer for the GNOME desktop | 3 | # Getting Things Gnome! - a personal organizer for the GNOME desktop |
1574 | 4 | # Copyright (c) 2008-2009 - Lionel Dricot & Bertrand Rousseau | 4 | # Copyright (c) 2008-2009 - Lionel Dricot & Bertrand Rousseau |
1575 | 5 | # | 5 | # |
1576 | 6 | # This program is free software: you can redistribute it and/or modify it under | 6 | # This program is free software: you can redistribute it and/or modify it under |
1577 | @@ -30,8 +30,8 @@ | |||
1578 | 30 | 30 | ||
1579 | 31 | # GTG imports | 31 | # GTG imports |
1580 | 32 | from GTG.backends import backend_localfile as localfile | 32 | from GTG.backends import backend_localfile as localfile |
1581 | 33 | from GTG.core import datastore | ||
1582 | 34 | from GTG.tools import cleanxml | 33 | from GTG.tools import cleanxml |
1583 | 34 | from GTG.core import CoreConfig | ||
1584 | 35 | 35 | ||
1585 | 36 | 36 | ||
1586 | 37 | class GtgBackendsUniTests(unittest.TestCase): | 37 | class GtgBackendsUniTests(unittest.TestCase): |
1587 | @@ -44,6 +44,10 @@ | |||
1588 | 44 | self.taskpath = '' | 44 | self.taskpath = '' |
1589 | 45 | self.datapath = '' | 45 | self.datapath = '' |
1590 | 46 | 46 | ||
1591 | 47 | def SetUp(self): | ||
1592 | 48 | CoreConfig().set_data_dir("./test_data") | ||
1593 | 49 | CoreConfig().set_conf_dir("./test_data") | ||
1594 | 50 | |||
1595 | 47 | def test_localfile_get_name(self): | 51 | def test_localfile_get_name(self): |
1596 | 48 | """Tests for localfile/get_name function : | 52 | """Tests for localfile/get_name function : |
1597 | 49 | - a string is expected. | 53 | - a string is expected. |
1598 | @@ -105,52 +109,6 @@ | |||
1599 | 105 | expectedres = True | 109 | expectedres = True |
1600 | 106 | self.assertEqual(res, expectedres) | 110 | self.assertEqual(res, expectedres) |
1601 | 107 | 111 | ||
1602 | 108 | # def test_localfile_backend_method4(self): | ||
1603 | 109 | # """Tests for localfile/Backend/get_task method: | ||
1604 | 110 | # - Compares task titles to check if method works. | ||
1605 | 111 | # """ | ||
1606 | 112 | # self.create_test_environment() | ||
1607 | 113 | # doc, configxml = cleanxml.openxmlfile(self.datapath, 'config') | ||
1608 | 114 | # xmlproject = doc.getElementsByTagName('backend') | ||
1609 | 115 | # for domobj in xmlproject: | ||
1610 | 116 | # dic = {} | ||
1611 | 117 | # if domobj.hasAttribute("module"): | ||
1612 | 118 | # dic["module"] = str(domobj.getAttribute("module")) | ||
1613 | 119 | # dic["pid"] = str(domobj.getAttribute("pid")) | ||
1614 | 120 | # dic["xmlobject"] = domobj | ||
1615 | 121 | # dic["filename"] = self.taskfile | ||
1616 | 122 | # beobj = localfile.Backend(dic) | ||
1617 | 123 | # dstore = datastore.DataStore() | ||
1618 | 124 | # newtask = dstore.new_task(tid="0@2", pid="1", newtask=True) | ||
1619 | 125 | # beobj.get_task(newtask, "0@1") | ||
1620 | 126 | # self.assertEqual(newtask.get_title(), u"Ceci est un test") | ||
1621 | 127 | |||
1622 | 128 | # def test_localfile_backend_method5(self): | ||
1623 | 129 | # """Tests for localfile/Backend/set_task method: | ||
1624 | 130 | # - parses task file to check if new task has been stored. | ||
1625 | 131 | # """ | ||
1626 | 132 | # self.create_test_environment() | ||
1627 | 133 | # doc, configxml = cleanxml.openxmlfile(self.datapath, 'config') | ||
1628 | 134 | # xmlproject = doc.getElementsByTagName('backend') | ||
1629 | 135 | # for domobj in xmlproject: | ||
1630 | 136 | # dic = {} | ||
1631 | 137 | # if domobj.hasAttribute("module"): | ||
1632 | 138 | # dic["module"] = str(domobj.getAttribute("module")) | ||
1633 | 139 | # dic["pid"] = str(domobj.getAttribute("pid")) | ||
1634 | 140 | # dic["xmlobject"] = domobj | ||
1635 | 141 | # dic["filename"] = self.taskfile | ||
1636 | 142 | # beobj = localfile.Backend(dic) | ||
1637 | 143 | # dstore = datastore.DataStore() | ||
1638 | 144 | # newtask = dstore.new_task(tid="0@2", pid="1", newtask=True) | ||
1639 | 145 | # beobj.set_task(newtask) | ||
1640 | 146 | # dataline = open(self.taskpath, 'r').read() | ||
1641 | 147 | # if "0@2" in dataline: | ||
1642 | 148 | # res = True | ||
1643 | 149 | # else: | ||
1644 | 150 | # res = False | ||
1645 | 151 | # expectedres = True | ||
1646 | 152 | # self.assertEqual(res, expectedres) | ||
1647 | 153 | |||
1648 | 154 | def create_test_environment(self): | 112 | def create_test_environment(self): |
1649 | 155 | """Create the test environment""" | 113 | """Create the test environment""" |
1650 | 156 | self.taskfile = 'test.xml' | 114 | self.taskfile = 'test.xml' |
1651 | 157 | 115 | ||
1652 | === added file 'GTG/tests/test_interruptible.py' | |||
1653 | --- GTG/tests/test_interruptible.py 1970-01-01 00:00:00 +0000 | |||
1654 | +++ GTG/tests/test_interruptible.py 2010-08-13 23:43:04 +0000 | |||
1655 | @@ -0,0 +1,61 @@ | |||
1656 | 1 | # -*- coding: utf-8 -*- | ||
1657 | 2 | # ----------------------------------------------------------------------------- | ||
1658 | 3 | # Gettings Things Gnome! - a personal organizer for the GNOME desktop | ||
1659 | 4 | # Copyright (c) 2008-2009 - Lionel Dricot & Bertrand Rousseau | ||
1660 | 5 | # | ||
1661 | 6 | # This program is free software: you can redistribute it and/or modify it under | ||
1662 | 7 | # the terms of the GNU General Public License as published by the Free Software | ||
1663 | 8 | # Foundation, either version 3 of the License, or (at your option) any later | ||
1664 | 9 | # version. | ||
1665 | 10 | # | ||
1666 | 11 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
1667 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
1668 | 13 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
1669 | 14 | # details. | ||
1670 | 15 | # | ||
1671 | 16 | # You should have received a copy of the GNU General Public License along with | ||
1672 | 17 | # this program. If not, see <http://www.gnu.org/licenses/>. | ||
1673 | 18 | # ----------------------------------------------------------------------------- | ||
1674 | 19 | |||
1675 | 20 | ''' | ||
1676 | 21 | Tests for interrupting cooperative threads | ||
1677 | 22 | ''' | ||
1678 | 23 | |||
1679 | 24 | import unittest | ||
1680 | 25 | import time | ||
1681 | 26 | from threading import Thread, Event | ||
1682 | 27 | |||
1683 | 28 | from GTG.tools.interruptible import interruptible, _cancellation_point | ||
1684 | 29 | |||
1685 | 30 | |||
1686 | 31 | class TestInterruptible(unittest.TestCase): | ||
1687 | 32 | ''' | ||
1688 | 33 | Tests for interrupting cooperative threads | ||
1689 | 34 | ''' | ||
1690 | 35 | |||
1691 | 36 | def test_interruptible_decorator(self): | ||
1692 | 37 | '''Tests for the @interruptible decorator.''' | ||
1693 | 38 | self.quit_condition = False | ||
1694 | 39 | cancellation_point = lambda: _cancellation_point(\ | ||
1695 | 40 | lambda: self.quit_condition) | ||
1696 | 41 | self.thread_started = Event() | ||
1697 | 42 | @interruptible | ||
1698 | 43 | def never_ending(cancellation_point): | ||
1699 | 44 | self.thread_started.set() | ||
1700 | 45 | while True: | ||
1701 | 46 | time.sleep(0.1) | ||
1702 | 47 | cancellation_point() | ||
1703 | 48 | thread = Thread(target = never_ending, args = (cancellation_point, )) | ||
1704 | 49 | thread.start() | ||
1705 | 50 | self.thread_started.wait() | ||
1706 | 51 | self.quit_condition = True | ||
1707 | 52 | countdown = 10 | ||
1708 | 53 | while thread.is_alive() and countdown > 0: | ||
1709 | 54 | time.sleep(0.1) | ||
1710 | 55 | countdown -= 1 | ||
1711 | 56 | self.assertFalse(thread.is_alive()) | ||
1712 | 57 | |||
1713 | 58 | |||
1714 | 59 | def test_suite(): | ||
1715 | 60 | return unittest.TestLoader().loadTestsFromTestCase(TestInterruptible) | ||
1716 | 61 | |||
1717 | 0 | 62 | ||
1718 | === added file 'GTG/tools/interruptible.py' | |||
1719 | --- GTG/tools/interruptible.py 1970-01-01 00:00:00 +0000 | |||
1720 | +++ GTG/tools/interruptible.py 2010-08-13 23:43:04 +0000 | |||
1721 | @@ -0,0 +1,62 @@ | |||
1722 | 1 | # -*- coding: utf-8 -*- | ||
1723 | 2 | # ----------------------------------------------------------------------------- | ||
1724 | 3 | # Gettings Things Gnome! - a personal organizer for the GNOME desktop | ||
1725 | 4 | # Copyright (c) 2008-2009 - Lionel Dricot & Bertrand Rousseau | ||
1726 | 5 | # | ||
1727 | 6 | # This program is free software: you can redistribute it and/or modify it under | ||
1728 | 7 | # the terms of the GNU General Public License as published by the Free Software | ||
1729 | 8 | # Foundation, either version 3 of the License, or (at your option) any later | ||
1730 | 9 | # version. | ||
1731 | 10 | # | ||
1732 | 11 | # This program is distributed in the hope that it will be useful, but WITHOUT | ||
1733 | 12 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
1734 | 13 | # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | ||
1735 | 14 | # details. | ||
1736 | 15 | # | ||
1737 | 16 | # You should have received a copy of the GNU General Public License along with | ||
1738 | 17 | # this program. If not, see <http://www.gnu.org/licenses/>. | ||
1739 | 18 | # ----------------------------------------------------------------------------- | ||
1740 | 19 | |||
1741 | 20 | ''' | ||
1742 | 21 | Utils to stop and quit gracefully a thread, issuing the command from | ||
1743 | 22 | another one | ||
1744 | 23 | ''' | ||
1745 | 24 | |||
1746 | 25 | |||
1747 | 26 | |||
1748 | 27 | class Interrupted(Exception): | ||
1749 | 28 | '''Exception raised when a thread should be interrupted''' | ||
1750 | 29 | |||
1751 | 30 | |||
1752 | 31 | pass | ||
1753 | 32 | |||
1754 | 33 | |||
1755 | 34 | |||
1756 | 35 | |||
1757 | 36 | def interruptible(fn): | ||
1758 | 37 | ''' | ||
1759 | 38 | A decorator that makes a function interruptible. It should be applied only | ||
1760 | 39 | to the function which is the target of a Thread object. | ||
1761 | 40 | ''' | ||
1762 | 41 | |||
1763 | 42 | |||
1764 | 43 | def new(*args): | ||
1765 | 44 | try: | ||
1766 | 45 | return fn(*args) | ||
1767 | 46 | except Interrupted: | ||
1768 | 47 | return | ||
1769 | 48 | return new | ||
1770 | 49 | |||
1771 | 50 | def _cancellation_point(test_function): | ||
1772 | 51 | ''' | ||
1773 | 52 | This function checks a test_function and, if it evaluates to True, makes the | ||
1774 | 53 | thread quit (similar to pthread_cancel() in C) | ||
1775 | 54 | It starts with a _ as it's mostly used in a specialized form, as: | ||
1776 | 55 | cancellation_point = functools.partial(_cancellation_point, | ||
1777 | 56 | lambda: quit_condition == True) | ||
1778 | 57 | |||
1779 | 58 | @param test_function: the function to test before cancelling | ||
1780 | 59 | ''' | ||
1781 | 60 | if test_function(): | ||
1782 | 61 | raise Interrupted | ||
1783 | 62 | |||
1784 | 0 | 63 | ||
1785 | === modified file 'GTG/tools/taskxml.py' | |||
1786 | --- GTG/tools/taskxml.py 2010-06-22 19:55:15 +0000 | |||
1787 | +++ GTG/tools/taskxml.py 2010-08-13 23:43:04 +0000 | |||
1788 | @@ -20,6 +20,7 @@ | |||
1789 | 20 | #Functions to convert a Task object to an XML string and back | 20 | #Functions to convert a Task object to an XML string and back |
1790 | 21 | import xml.dom.minidom | 21 | import xml.dom.minidom |
1791 | 22 | import xml.sax.saxutils as saxutils | 22 | import xml.sax.saxutils as saxutils |
1792 | 23 | import datetime | ||
1793 | 23 | 24 | ||
1794 | 24 | from GTG.tools import cleanxml | 25 | from GTG.tools import cleanxml |
1795 | 25 | from GTG.tools import dates | 26 | from GTG.tools import dates |
1796 | @@ -55,7 +56,6 @@ | |||
1797 | 55 | content = xml.dom.minidom.parseString(tas) | 56 | content = xml.dom.minidom.parseString(tas) |
1798 | 56 | cur_task.set_text(content.firstChild.toxml()) #pylint: disable-msg=E1103 | 57 | cur_task.set_text(content.firstChild.toxml()) #pylint: disable-msg=E1103 |
1799 | 57 | cur_task.set_due_date(dates.strtodate(cleanxml.readTextNode(xmlnode,"duedate"))) | 58 | cur_task.set_due_date(dates.strtodate(cleanxml.readTextNode(xmlnode,"duedate"))) |
1800 | 58 | cur_task.set_modified(cleanxml.readTextNode(xmlnode,"modified")) | ||
1801 | 59 | cur_task.set_start_date(dates.strtodate(cleanxml.readTextNode(xmlnode,"startdate"))) | 59 | cur_task.set_start_date(dates.strtodate(cleanxml.readTextNode(xmlnode,"startdate"))) |
1802 | 60 | cur_tags = xmlnode.getAttribute("tags").replace(' ','').split(",") | 60 | cur_tags = xmlnode.getAttribute("tags").replace(' ','').split(",") |
1803 | 61 | if "" in cur_tags: cur_tags.remove("") | 61 | if "" in cur_tags: cur_tags.remove("") |
1804 | @@ -69,6 +69,11 @@ | |||
1805 | 69 | backend_id = node.firstChild.nodeValue | 69 | backend_id = node.firstChild.nodeValue |
1806 | 70 | remote_task_id = node.childNodes[1].firstChild.nodeValue | 70 | remote_task_id = node.childNodes[1].firstChild.nodeValue |
1807 | 71 | task.add_remote_id(backend_id, remote_task_id) | 71 | task.add_remote_id(backend_id, remote_task_id) |
1808 | 72 | modified_string = cleanxml.readTextNode(xmlnode,"modified") | ||
1809 | 73 | if modified_string: | ||
1810 | 74 | modified_datetime = datetime.datetime.strptime(modified_string,\ | ||
1811 | 75 | "%Y-%m-%dT%H:%M:%S") | ||
1812 | 76 | cur_task.set_modified(modified_datetime) | ||
1813 | 72 | return cur_task | 77 | return cur_task |
1814 | 73 | 78 | ||
1815 | 74 | #Task as parameter the doc where to put the XML node | 79 | #Task as parameter the doc where to put the XML node |
1816 | 75 | 80 | ||
1817 | === added file 'data/icons/hicolor/scalable/apps/backend_localfile.svg' | |||
1818 | --- data/icons/hicolor/scalable/apps/backend_localfile.svg 1970-01-01 00:00:00 +0000 | |||
1819 | +++ data/icons/hicolor/scalable/apps/backend_localfile.svg 2010-08-13 23:43:04 +0000 | |||
1820 | @@ -0,0 +1,610 @@ | |||
1821 | 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
1822 | 2 | <!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
1823 | 3 | |||
1824 | 4 | <svg | ||
1825 | 5 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
1826 | 6 | xmlns:cc="http://creativecommons.org/ns#" | ||
1827 | 7 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
1828 | 8 | xmlns:svg="http://www.w3.org/2000/svg" | ||
1829 | 9 | xmlns="http://www.w3.org/2000/svg" | ||
1830 | 10 | xmlns:xlink="http://www.w3.org/1999/xlink" | ||
1831 | 11 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
1832 | 12 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
1833 | 13 | inkscape:export-ydpi="600" | ||
1834 | 14 | inkscape:export-xdpi="600" | ||
1835 | 15 | inkscape:export-filename="/home/luca/Projects/gtg/Google/GSoC/data/icons/hicolor/scalable/apps/backend_localfile.png" | ||
1836 | 16 | sodipodi:docname="backend_localfile.svg" | ||
1837 | 17 | inkscape:version="0.47 r22583" | ||
1838 | 18 | sodipodi:version="0.32" | ||
1839 | 19 | id="svg249" | ||
1840 | 20 | height="48.000000px" | ||
1841 | 21 | width="48.000000px" | ||
1842 | 22 | inkscape:output_extension="org.inkscape.output.svg.inkscape" | ||
1843 | 23 | version="1.1"> | ||
1844 | 24 | <defs | ||
1845 | 25 | id="defs3"> | ||
1846 | 26 | <inkscape:perspective | ||
1847 | 27 | sodipodi:type="inkscape:persp3d" | ||
1848 | 28 | inkscape:vp_x="0 : 24 : 1" | ||
1849 | 29 | inkscape:vp_y="0 : 1000 : 0" | ||
1850 | 30 | inkscape:vp_z="48 : 24 : 1" | ||
1851 | 31 | inkscape:persp3d-origin="24 : 16 : 1" | ||
1852 | 32 | id="perspective80" /> | ||
1853 | 33 | <linearGradient | ||
1854 | 34 | inkscape:collect="always" | ||
1855 | 35 | xlink:href="#linearGradient3656" | ||
1856 | 36 | id="linearGradient5816" | ||
1857 | 37 | gradientUnits="userSpaceOnUse" | ||
1858 | 38 | x1="-26.753757" | ||
1859 | 39 | y1="11.566258" | ||
1860 | 40 | x2="-24.75" | ||
1861 | 41 | y2="9.687501" /> | ||
1862 | 42 | <linearGradient | ||
1863 | 43 | inkscape:collect="always" | ||
1864 | 44 | xlink:href="#linearGradient3520" | ||
1865 | 45 | id="linearGradient5836" | ||
1866 | 46 | gradientUnits="userSpaceOnUse" | ||
1867 | 47 | gradientTransform="matrix(0.9223058,0,0,0.9185751,-92.447368,61.3257)" | ||
1868 | 48 | x1="-18.588562" | ||
1869 | 49 | y1="11.052948" | ||
1870 | 50 | x2="-28.789402" | ||
1871 | 51 | y2="14.069944" /> | ||
1872 | 52 | <radialGradient | ||
1873 | 53 | inkscape:collect="always" | ||
1874 | 54 | xlink:href="#linearGradient3671" | ||
1875 | 55 | id="radialGradient5839" | ||
1876 | 56 | gradientUnits="userSpaceOnUse" | ||
1877 | 57 | gradientTransform="matrix(0.4073362,-0.2798276,0.7510293,1.0932492,-115.18484,51.56213)" | ||
1878 | 58 | cx="-26.305403" | ||
1879 | 59 | cy="10.108011" | ||
1880 | 60 | fx="-26.305403" | ||
1881 | 61 | fy="10.108011" | ||
1882 | 62 | r="7.0421038" /> | ||
1883 | 63 | <linearGradient | ||
1884 | 64 | inkscape:collect="always" | ||
1885 | 65 | id="linearGradient6469"> | ||
1886 | 66 | <stop | ||
1887 | 67 | style="stop-color:#000000;stop-opacity:1;" | ||
1888 | 68 | offset="0" | ||
1889 | 69 | id="stop6471" /> | ||
1890 | 70 | <stop | ||
1891 | 71 | style="stop-color:#000000;stop-opacity:0;" | ||
1892 | 72 | offset="1" | ||
1893 | 73 | id="stop6473" /> | ||
1894 | 74 | </linearGradient> | ||
1895 | 75 | <linearGradient | ||
1896 | 76 | inkscape:collect="always" | ||
1897 | 77 | xlink:href="#linearGradient6469" | ||
1898 | 78 | id="linearGradient6475" | ||
1899 | 79 | x1="58.282169" | ||
1900 | 80 | y1="70.751839" | ||
1901 | 81 | x2="61.181217" | ||
1902 | 82 | y2="67.799171" | ||
1903 | 83 | gradientUnits="userSpaceOnUse" | ||
1904 | 84 | gradientTransform="translate(-180,0)" /> | ||
1905 | 85 | <radialGradient | ||
1906 | 86 | inkscape:collect="always" | ||
1907 | 87 | xlink:href="#linearGradient3741" | ||
1908 | 88 | id="radialGradient5810" | ||
1909 | 89 | gradientUnits="userSpaceOnUse" | ||
1910 | 90 | gradientTransform="matrix(1.8860258,0,0,1.1764706,-3.5441033,-4.2352941)" | ||
1911 | 91 | cx="4" | ||
1912 | 92 | cy="5.2999997" | ||
1913 | 93 | fx="4" | ||
1914 | 94 | fy="5.2999997" | ||
1915 | 95 | r="17" /> | ||
1916 | 96 | <linearGradient | ||
1917 | 97 | inkscape:collect="always" | ||
1918 | 98 | xlink:href="#linearGradient3613" | ||
1919 | 99 | id="linearGradient5845" | ||
1920 | 100 | gradientUnits="userSpaceOnUse" | ||
1921 | 101 | gradientTransform="translate(-90,60)" | ||
1922 | 102 | x1="-47.5" | ||
1923 | 103 | y1="49.020683" | ||
1924 | 104 | x2="-62.75" | ||
1925 | 105 | y2="-22.502075" /> | ||
1926 | 106 | <radialGradient | ||
1927 | 107 | inkscape:collect="always" | ||
1928 | 108 | xlink:href="#linearGradient3683" | ||
1929 | 109 | id="radialGradient5843" | ||
1930 | 110 | gradientUnits="userSpaceOnUse" | ||
1931 | 111 | gradientTransform="matrix(3.9957492,0,0,1.9350367,0.62141,28.832578)" | ||
1932 | 112 | cx="-30.249996" | ||
1933 | 113 | cy="35.357208" | ||
1934 | 114 | fx="-30.249996" | ||
1935 | 115 | fy="35.357208" | ||
1936 | 116 | r="18.000002" /> | ||
1937 | 117 | <linearGradient | ||
1938 | 118 | inkscape:collect="always" | ||
1939 | 119 | xlink:href="#linearGradient3702" | ||
1940 | 120 | id="linearGradient5804" | ||
1941 | 121 | gradientUnits="userSpaceOnUse" | ||
1942 | 122 | x1="25.058096" | ||
1943 | 123 | y1="47.027729" | ||
1944 | 124 | x2="25.058096" | ||
1945 | 125 | y2="39.999443" /> | ||
1946 | 126 | <radialGradient | ||
1947 | 127 | inkscape:collect="always" | ||
1948 | 128 | xlink:href="#linearGradient3688" | ||
1949 | 129 | id="radialGradient5802" | ||
1950 | 130 | gradientUnits="userSpaceOnUse" | ||
1951 | 131 | gradientTransform="matrix(2.003784,0,0,1.4,-20.01187,-104.4)" | ||
1952 | 132 | cx="4.9929786" | ||
1953 | 133 | cy="43.5" | ||
1954 | 134 | fx="4.9929786" | ||
1955 | 135 | fy="43.5" | ||
1956 | 136 | r="2.5" /> | ||
1957 | 137 | <radialGradient | ||
1958 | 138 | inkscape:collect="always" | ||
1959 | 139 | xlink:href="#linearGradient3688" | ||
1960 | 140 | id="radialGradient5800" | ||
1961 | 141 | gradientUnits="userSpaceOnUse" | ||
1962 | 142 | gradientTransform="matrix(2.003784,0,0,1.4,27.98813,-17.4)" | ||
1963 | 143 | cx="4.9929786" | ||
1964 | 144 | cy="43.5" | ||
1965 | 145 | fx="4.9929786" | ||
1966 | 146 | fy="43.5" | ||
1967 | 147 | r="2.5" /> | ||
1968 | 148 | <linearGradient | ||
1969 | 149 | inkscape:collect="always" | ||
1970 | 150 | xlink:href="#linearGradient3702" | ||
1971 | 151 | id="linearGradient5798" | ||
1972 | 152 | gradientUnits="userSpaceOnUse" | ||
1973 | 153 | x1="25.058096" | ||
1974 | 154 | y1="47.027729" | ||
1975 | 155 | x2="25.058096" | ||
1976 | 156 | y2="39.999443" /> | ||
1977 | 157 | <radialGradient | ||
1978 | 158 | inkscape:collect="always" | ||
1979 | 159 | xlink:href="#linearGradient3688" | ||
1980 | 160 | id="radialGradient5796" | ||
1981 | 161 | gradientUnits="userSpaceOnUse" | ||
1982 | 162 | gradientTransform="matrix(2.003784,0,0,1.4,-20.01187,-104.4)" | ||
1983 | 163 | cx="4.9929786" | ||
1984 | 164 | cy="43.5" | ||
1985 | 165 | fx="4.9929786" | ||
1986 | 166 | fy="43.5" | ||
1987 | 167 | r="2.5" /> | ||
1988 | 168 | <radialGradient | ||
1989 | 169 | inkscape:collect="always" | ||
1990 | 170 | xlink:href="#linearGradient3688" | ||
1991 | 171 | id="radialGradient5794" | ||
1992 | 172 | gradientUnits="userSpaceOnUse" | ||
1993 | 173 | gradientTransform="matrix(2.003784,0,0,1.4,27.98813,-17.4)" | ||
1994 | 174 | cx="4.9929786" | ||
1995 | 175 | cy="43.5" | ||
1996 | 176 | fx="4.9929786" | ||
1997 | 177 | fy="43.5" | ||
1998 | 178 | r="2.5" /> | ||
1999 | 179 | <linearGradient | ||
2000 | 180 | inkscape:collect="always" | ||
2001 | 181 | id="linearGradient3656"> | ||
2002 | 182 | <stop | ||
2003 | 183 | style="stop-color:#ffffff;stop-opacity:1;" | ||
2004 | 184 | offset="0" | ||
2005 | 185 | id="stop3658" /> | ||
2006 | 186 | <stop | ||
2007 | 187 | style="stop-color:#ffffff;stop-opacity:0;" | ||
2008 | 188 | offset="1" | ||
2009 | 189 | id="stop3660" /> | ||
2010 | 190 | </linearGradient> | ||
2011 | 191 | <linearGradient | ||
2012 | 192 | inkscape:collect="always" | ||
2013 | 193 | id="linearGradient3520"> | ||
2014 | 194 | <stop | ||
2015 | 195 | style="stop-color:#000000;stop-opacity:0.41295547" | ||
2016 | 196 | offset="0" | ||
2017 | 197 | id="stop3522" /> | ||
2018 | 198 | <stop | ||
2019 | 199 | style="stop-color:#000000;stop-opacity:0;" | ||
2020 | 200 | offset="1" | ||
2021 | 201 | id="stop3524" /> | ||
2022 | 202 | </linearGradient> | ||
2023 | 203 | <linearGradient | ||
2024 | 204 | id="linearGradient3671"> | ||
2025 | 205 | <stop | ||
2026 | 206 | style="stop-color:#ffffff;stop-opacity:1;" | ||
2027 | 207 | offset="0" | ||
2028 | 208 | id="stop3673" /> | ||
2029 | 209 | <stop | ||
2030 | 210 | id="stop3691" | ||
2031 | 211 | offset="0.47533694" | ||
2032 | 212 | style="stop-color:#ffffff;stop-opacity:1;" /> | ||
2033 | 213 | <stop | ||
2034 | 214 | style="stop-color:#ffffff;stop-opacity:0;" | ||
2035 | 215 | offset="1" | ||
2036 | 216 | id="stop3675" /> | ||
2037 | 217 | </linearGradient> | ||
2038 | 218 | <linearGradient | ||
2039 | 219 | inkscape:collect="always" | ||
2040 | 220 | id="linearGradient3741"> | ||
2041 | 221 | <stop | ||
2042 | 222 | style="stop-color:#ffffff;stop-opacity:1;" | ||
2043 | 223 | offset="0" | ||
2044 | 224 | id="stop3743" /> | ||
2045 | 225 | <stop | ||
2046 | 226 | style="stop-color:#ffffff;stop-opacity:0;" | ||
2047 | 227 | offset="1" | ||
2048 | 228 | id="stop3745" /> | ||
2049 | 229 | </linearGradient> | ||
2050 | 230 | <linearGradient | ||
2051 | 231 | inkscape:collect="always" | ||
2052 | 232 | id="linearGradient3613"> | ||
2053 | 233 | <stop | ||
2054 | 234 | style="stop-color:#888a85;stop-opacity:1" | ||
2055 | 235 | offset="0" | ||
2056 | 236 | id="stop3615" /> | ||
2057 | 237 | <stop | ||
2058 | 238 | style="stop-color:#babdb6;stop-opacity:1" | ||
2059 | 239 | offset="1" | ||
2060 | 240 | id="stop3617" /> | ||
2061 | 241 | </linearGradient> | ||
2062 | 242 | <linearGradient | ||
2063 | 243 | id="linearGradient3683"> | ||
2064 | 244 | <stop | ||
2065 | 245 | id="stop3685" | ||
2066 | 246 | offset="0" | ||
2067 | 247 | style="stop-color:#f6f6f5;stop-opacity:1;" /> | ||
2068 | 248 | <stop | ||
2069 | 249 | id="stop3689" | ||
2070 | 250 | offset="1" | ||
2071 | 251 | style="stop-color:#d3d7cf;stop-opacity:1" /> | ||
2072 | 252 | </linearGradient> | ||
2073 | 253 | <linearGradient | ||
2074 | 254 | id="linearGradient3688" | ||
2075 | 255 | inkscape:collect="always"> | ||
2076 | 256 | <stop | ||
2077 | 257 | id="stop3690" | ||
2078 | 258 | offset="0" | ||
2079 | 259 | style="stop-color:black;stop-opacity:1;" /> | ||
2080 | 260 | <stop | ||
2081 | 261 | id="stop3692" | ||
2082 | 262 | offset="1" | ||
2083 | 263 | style="stop-color:black;stop-opacity:0;" /> | ||
2084 | 264 | </linearGradient> | ||
2085 | 265 | <linearGradient | ||
2086 | 266 | id="linearGradient3702"> | ||
2087 | 267 | <stop | ||
2088 | 268 | id="stop3704" | ||
2089 | 269 | offset="0" | ||
2090 | 270 | style="stop-color:black;stop-opacity:0;" /> | ||
2091 | 271 | <stop | ||
2092 | 272 | style="stop-color:black;stop-opacity:1;" | ||
2093 | 273 | offset="0.5" | ||
2094 | 274 | id="stop3710" /> | ||
2095 | 275 | <stop | ||
2096 | 276 | id="stop3706" | ||
2097 | 277 | offset="1" | ||
2098 | 278 | style="stop-color:black;stop-opacity:0;" /> | ||
2099 | 279 | </linearGradient> | ||
2100 | 280 | </defs> | ||
2101 | 281 | <sodipodi:namedview | ||
2102 | 282 | inkscape:window-y="26" | ||
2103 | 283 | inkscape:window-x="230" | ||
2104 | 284 | inkscape:window-height="742" | ||
2105 | 285 | inkscape:window-width="1048" | ||
2106 | 286 | inkscape:document-units="px" | ||
2107 | 287 | inkscape:grid-bbox="true" | ||
2108 | 288 | showgrid="false" | ||
2109 | 289 | inkscape:current-layer="layer6" | ||
2110 | 290 | inkscape:cy="9.7451355" | ||
2111 | 291 | inkscape:cx="46.371834" | ||
2112 | 292 | inkscape:zoom="1" | ||
2113 | 293 | inkscape:pageshadow="2" | ||
2114 | 294 | inkscape:pageopacity="0.0" | ||
2115 | 295 | borderopacity="0.25490196" | ||
2116 | 296 | bordercolor="#666666" | ||
2117 | 297 | pagecolor="#ffffff" | ||
2118 | 298 | id="base" | ||
2119 | 299 | inkscape:showpageshadow="false" | ||
2120 | 300 | inkscape:window-maximized="0" /> | ||
2121 | 301 | <metadata | ||
2122 | 302 | id="metadata4"> | ||
2123 | 303 | <rdf:RDF> | ||
2124 | 304 | <cc:Work | ||
2125 | 305 | rdf:about=""> | ||
2126 | 306 | <dc:format>image/svg+xml</dc:format> | ||
2127 | 307 | <dc:type | ||
2128 | 308 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
2129 | 309 | <dc:title>Generic Text</dc:title> | ||
2130 | 310 | <dc:subject> | ||
2131 | 311 | <rdf:Bag> | ||
2132 | 312 | <rdf:li>text</rdf:li> | ||
2133 | 313 | <rdf:li>plaintext</rdf:li> | ||
2134 | 314 | <rdf:li>regular</rdf:li> | ||
2135 | 315 | <rdf:li>document</rdf:li> | ||
2136 | 316 | </rdf:Bag> | ||
2137 | 317 | </dc:subject> | ||
2138 | 318 | <cc:license | ||
2139 | 319 | rdf:resource="http://creativecommons.org/licenses/GPL/2.0/" /> | ||
2140 | 320 | <dc:creator> | ||
2141 | 321 | <cc:Agent> | ||
2142 | 322 | <dc:title>Lapo Calamandrei</dc:title> | ||
2143 | 323 | </cc:Agent> | ||
2144 | 324 | </dc:creator> | ||
2145 | 325 | <dc:source /> | ||
2146 | 326 | <dc:date /> | ||
2147 | 327 | <dc:rights> | ||
2148 | 328 | <cc:Agent> | ||
2149 | 329 | <dc:title /> | ||
2150 | 330 | </cc:Agent> | ||
2151 | 331 | </dc:rights> | ||
2152 | 332 | <dc:publisher> | ||
2153 | 333 | <cc:Agent> | ||
2154 | 334 | <dc:title /> | ||
2155 | 335 | </cc:Agent> | ||
2156 | 336 | </dc:publisher> | ||
2157 | 337 | <dc:identifier /> | ||
2158 | 338 | <dc:relation /> | ||
2159 | 339 | <dc:language /> | ||
2160 | 340 | <dc:coverage /> | ||
2161 | 341 | <dc:description /> | ||
2162 | 342 | <dc:contributor> | ||
2163 | 343 | <cc:Agent> | ||
2164 | 344 | <dc:title /> | ||
2165 | 345 | </cc:Agent> | ||
2166 | 346 | </dc:contributor> | ||
2167 | 347 | </cc:Work> | ||
2168 | 348 | <cc:License | ||
2169 | 349 | rdf:about="http://creativecommons.org/licenses/GPL/2.0/"> | ||
2170 | 350 | <cc:permits | ||
2171 | 351 | rdf:resource="http://web.resource.org/cc/Reproduction" /> | ||
2172 | 352 | <cc:permits | ||
2173 | 353 | rdf:resource="http://web.resource.org/cc/Distribution" /> | ||
2174 | 354 | <cc:requires | ||
2175 | 355 | rdf:resource="http://web.resource.org/cc/Notice" /> | ||
2176 | 356 | <cc:permits | ||
2177 | 357 | rdf:resource="http://web.resource.org/cc/DerivativeWorks" /> | ||
2178 | 358 | <cc:requires | ||
2179 | 359 | rdf:resource="http://web.resource.org/cc/ShareAlike" /> | ||
2180 | 360 | <cc:requires | ||
2181 | 361 | rdf:resource="http://web.resource.org/cc/SourceCode" /> | ||
2182 | 362 | </cc:License> | ||
2183 | 363 | </rdf:RDF> | ||
2184 | 364 | </metadata> | ||
2185 | 365 | <g | ||
2186 | 366 | inkscape:groupmode="layer" | ||
2187 | 367 | id="layer6" | ||
2188 | 368 | inkscape:label="Shadow"> | ||
2189 | 369 | <g | ||
2190 | 370 | style="display:inline" | ||
2191 | 371 | id="g6015" | ||
2192 | 372 | transform="translate(150,-60)"> | ||
2193 | 373 | <rect | ||
2194 | 374 | y="60" | ||
2195 | 375 | x="-150" | ||
2196 | 376 | height="48" | ||
2197 | 377 | width="48" | ||
2198 | 378 | id="rect5504" | ||
2199 | 379 | style="opacity:0;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;display:inline" /> | ||
2200 | 380 | <g | ||
2201 | 381 | transform="matrix(1.0464281,0,0,0.8888889,-151.18572,65.72224)" | ||
2202 | 382 | inkscape:label="Shadow" | ||
2203 | 383 | id="g5508" | ||
2204 | 384 | style="opacity:0.65587045;display:inline"> | ||
2205 | 385 | <g | ||
2206 | 386 | transform="matrix(1.052632,0,0,1.285713,-1.263158,-13.42854)" | ||
2207 | 387 | style="opacity:0.4" | ||
2208 | 388 | id="g5511"> | ||
2209 | 389 | <rect | ||
2210 | 390 | style="opacity:1;fill:url(#radialGradient5794);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
2211 | 391 | id="rect5513" | ||
2212 | 392 | width="5" | ||
2213 | 393 | height="7" | ||
2214 | 394 | x="38" | ||
2215 | 395 | y="40" /> | ||
2216 | 396 | <rect | ||
2217 | 397 | style="opacity:1;fill:url(#radialGradient5796);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
2218 | 398 | id="rect5515" | ||
2219 | 399 | width="5" | ||
2220 | 400 | height="7" | ||
2221 | 401 | x="-10" | ||
2222 | 402 | y="-47" | ||
2223 | 403 | transform="scale(-1,-1)" /> | ||
2224 | 404 | <rect | ||
2225 | 405 | style="opacity:1;fill:url(#linearGradient5798);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
2226 | 406 | id="rect5517" | ||
2227 | 407 | width="28" | ||
2228 | 408 | height="7.0000005" | ||
2229 | 409 | x="10" | ||
2230 | 410 | y="40" /> | ||
2231 | 411 | </g> | ||
2232 | 412 | </g> | ||
2233 | 413 | <g | ||
2234 | 414 | transform="matrix(0.9548466,0,0,0.5555562,-148.98776,79.888875)" | ||
2235 | 415 | inkscape:label="Shadow" | ||
2236 | 416 | id="g5519" | ||
2237 | 417 | style="display:inline"> | ||
2238 | 418 | <g | ||
2239 | 419 | transform="matrix(1.052632,0,0,1.285713,-1.263158,-13.42854)" | ||
2240 | 420 | style="opacity:0.4" | ||
2241 | 421 | id="g5521"> | ||
2242 | 422 | <rect | ||
2243 | 423 | style="opacity:1;fill:url(#radialGradient5800);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
2244 | 424 | id="rect5523" | ||
2245 | 425 | width="5" | ||
2246 | 426 | height="7" | ||
2247 | 427 | x="38" | ||
2248 | 428 | y="40" /> | ||
2249 | 429 | <rect | ||
2250 | 430 | style="opacity:1;fill:url(#radialGradient5802);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
2251 | 431 | id="rect5525" | ||
2252 | 432 | width="5" | ||
2253 | 433 | height="7" | ||
2254 | 434 | x="-10" | ||
2255 | 435 | y="-47" | ||
2256 | 436 | transform="scale(-1,-1)" /> | ||
2257 | 437 | <rect | ||
2258 | 438 | style="opacity:1;fill:url(#linearGradient5804);fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
2259 | 439 | id="rect5527" | ||
2260 | 440 | width="28" | ||
2261 | 441 | height="7.0000005" | ||
2262 | 442 | x="10" | ||
2263 | 443 | y="40" /> | ||
2264 | 444 | </g> | ||
2265 | 445 | </g> | ||
2266 | 446 | <path | ||
2267 | 447 | sodipodi:nodetypes="ccsccccccc" | ||
2268 | 448 | id="path5529" | ||
2269 | 449 | d="M -141.47614,63.5 C -141.47614,63.5 -124,63.5 -122.5,63.5 C -118.62295,63.572942 -116,66 -113.5,68.5 C -111,71 -108.89232,73.752625 -108.5,77.5 C -108.5,79 -108.5,102.47614 -108.5,102.47614 C -108.5,103.59736 -109.40264,104.5 -110.52385,104.5 L -141.47614,104.5 C -142.59736,104.5 -143.5,103.59736 -143.5,102.47614 L -143.5,65.523858 C -143.5,64.402641 -142.59736,63.5 -141.47614,63.5 z" | ||
2270 | 450 | style="fill:url(#radialGradient5843);fill-opacity:1;stroke:url(#linearGradient5845);stroke-width:1;stroke-miterlimit:4;display:inline" /> | ||
2271 | 451 | <path | ||
2272 | 452 | transform="translate(-150,60)" | ||
2273 | 453 | d="M 8.53125,4 C 7.6730803,4 7,4.6730802 7,5.53125 L 7,42.46875 C 7,43.32692 7.6730802,44 8.53125,44 L 39.46875,44 C 40.326919,44 41,43.326918 41,42.46875 C 41,42.46875 41,19 41,17.5 C 41,16.10803 40.513021,13.200521 38.65625,11.34375 C 36.65625,9.34375 35.65625,8.34375 33.65625,6.34375 C 31.799479,4.4869792 28.89197,4 27.5,4 C 26,4 8.53125,4 8.53125,4 z" | ||
2274 | 454 | id="path5531" | ||
2275 | 455 | style="opacity:0.68016196;fill:url(#radialGradient5810);fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;display:inline" | ||
2276 | 456 | inkscape:original="M 8.53125 3.5 C 7.410033 3.5 6.5 4.4100329 6.5 5.53125 L 6.5 42.46875 C 6.5 43.589967 7.4100329 44.5 8.53125 44.5 L 39.46875 44.5 C 40.589967 44.5 41.5 43.589966 41.5 42.46875 C 41.5 42.46875 41.5 19 41.5 17.5 C 41.5 16 41 13 39 11 C 37 9 36 8 34 6 C 32 4 29 3.5 27.5 3.5 C 26 3.5 8.5312499 3.5 8.53125 3.5 z " | ||
2277 | 457 | inkscape:radius="-0.4861359" | ||
2278 | 458 | sodipodi:type="inkscape:offset" /> | ||
2279 | 459 | <path | ||
2280 | 460 | id="rect5857" | ||
2281 | 461 | d="M -138.59375,69.125 C -138.81243,69.125 -139,69.312565 -139,69.53125 C -139,69.749934 -138.81243,69.937499 -138.59375,69.9375 L -117.40625,69.9375 C -117.18757,69.9375 -117,69.749934 -117,69.53125 C -117,69.312566 -117.18757,69.125 -117.40625,69.125 L -138.59375,69.125 z M -138.53125,71.0625 C -138.79094,71.0625 -139,71.271563 -139,71.53125 C -139,71.790937 -138.79094,72 -138.53125,72 L -116.46875,72 C -116.20906,72 -116,71.790937 -116,71.53125 C -116,71.271563 -116.20906,71.0625 -116.46875,71.0625 L -138.53125,71.0625 z M -138.53125,73.0625 C -138.79094,73.0625 -139,73.271563 -139,73.53125 C -139,73.790937 -138.79094,74 -138.53125,74 L -113.34375,74 C -113.08406,74 -112.875,73.790937 -112.875,73.53125 C -112.875,73.271563 -113.08406,73.0625 -113.34375,73.0625 L -138.53125,73.0625 z M -138.53125,75.0625 C -138.79094,75.0625 -139,75.271563 -139,75.53125 C -139,75.790937 -138.79094,76 -138.53125,76 L -113.34375,76 C -113.08406,76 -112.875,75.790937 -112.875,75.53125 C -112.875,75.271563 -113.08406,75.0625 -113.34375,75.0625 L -138.53125,75.0625 z M -138.53125,77.0625 C -138.79094,77.0625 -139,77.271563 -139,77.53125 C -139,77.790937 -138.79094,78 -138.53125,78 L -113.34375,78 C -113.08406,78 -112.875,77.790937 -112.875,77.53125 C -112.875,77.271563 -113.08406,77.0625 -113.34375,77.0625 L -138.53125,77.0625 z" | ||
2282 | 462 | style="opacity:0.15;fill:url(#linearGradient6475);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> | ||
2283 | 463 | <path | ||
2284 | 464 | sodipodi:nodetypes="ccccczc" | ||
2285 | 465 | id="path5533" | ||
2286 | 466 | d="M -122.5,64 C -123.88889,64 -122.54207,64.497088 -121.15625,65.125 C -119.77043,65.752912 -116.18337,68.340052 -117,72 C -112.67669,71.569417 -110.32087,75.122378 -110,76.28125 C -109.67913,77.440122 -109,78.888889 -109,77.5 C -108.97167,73.694419 -111.84543,71.068299 -113.84375,68.84375 C -115.84207,66.619201 -118.84621,64.476761 -122.5,64 z" | ||
2287 | 467 | style="fill:url(#radialGradient5839);fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;display:inline" /> | ||
2288 | 468 | <path | ||
2289 | 469 | sodipodi:nodetypes="ccccc" | ||
2290 | 470 | id="path5535" | ||
2291 | 471 | d="M -121.39912,65.014353 C -120.47682,65.014353 -118.39068,71.210015 -119.31298,75.343603 C -115.01802,74.915844 -110.4596,75.43178 -110,76.28125 C -110.32087,75.122378 -112.67669,71.569417 -117,72 C -116.13534,68.124761 -120.18657,65.382702 -121.39912,65.014353 z" | ||
2292 | 472 | style="opacity:0.87854249;fill:url(#linearGradient5836);fill-opacity:1;stroke:none;stroke-width:1;stroke-miterlimit:4;display:inline" /> | ||
2293 | 473 | <path | ||
2294 | 474 | transform="translate(-90,60)" | ||
2295 | 475 | d="M -51.46875,4.5 C -52.051916,4.5 -52.5,4.9480842 -52.5,5.53125 L -52.5,42.46875 C -52.5,43.051915 -52.051914,43.5 -51.46875,43.5 L -20.53125,43.5 C -19.948085,43.5 -19.5,43.051914 -19.5,42.46875 C -19.5,42.46875 -19.5,19 -19.5,17.5 C -19.5,16.220971 -19.980469,13.394531 -21.6875,11.6875 C -23.6875,9.6875 -24.6875,8.6875 -26.6875,6.6875 C -28.394531,4.9804687 -31.220971,4.5 -32.5,4.5 C -34,4.5 -51.46875,4.5 -51.46875,4.5 z" | ||
2296 | 476 | id="path5537" | ||
2297 | 477 | style="fill:none;fill-opacity:1;stroke:url(#linearGradient5816);stroke-width:1;stroke-miterlimit:4;display:inline" | ||
2298 | 478 | inkscape:original="M -51.46875 3.5 C -52.589967 3.5 -53.5 4.4100329 -53.5 5.53125 L -53.5 42.46875 C -53.5 43.589967 -52.589966 44.5 -51.46875 44.5 L -20.53125 44.5 C -19.410033 44.5 -18.5 43.589966 -18.5 42.46875 C -18.5 42.46875 -18.5 19 -18.5 17.5 C -18.5 16 -19 13 -21 11 C -23 9 -24 8 -26 6 C -28 4 -31 3.5 -32.5 3.5 C -34 3.5 -51.468749 3.5 -51.46875 3.5 z " | ||
2299 | 479 | inkscape:radius="-0.99436891" | ||
2300 | 480 | sodipodi:type="inkscape:offset" /> | ||
2301 | 481 | <g | ||
2302 | 482 | inkscape:r_cy="true" | ||
2303 | 483 | inkscape:r_cx="true" | ||
2304 | 484 | transform="matrix(0.928889,0,0,1,-148.28889,60)" | ||
2305 | 485 | style="opacity:0.15;fill:#000000;display:inline" | ||
2306 | 486 | id="g5539"> | ||
2307 | 487 | <rect | ||
2308 | 488 | ry="0.46875" | ||
2309 | 489 | rx="0.50463516" | ||
2310 | 490 | inkscape:r_cy="true" | ||
2311 | 491 | inkscape:r_cx="true" | ||
2312 | 492 | y="19.0625" | ||
2313 | 493 | x="10" | ||
2314 | 494 | height="0.9375" | ||
2315 | 495 | width="28.125" | ||
2316 | 496 | id="rect5549" | ||
2317 | 497 | style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> | ||
2318 | 498 | <rect | ||
2319 | 499 | style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" | ||
2320 | 500 | id="rect5553" | ||
2321 | 501 | width="28.125" | ||
2322 | 502 | height="0.9375" | ||
2323 | 503 | x="10" | ||
2324 | 504 | y="21.0625" | ||
2325 | 505 | inkscape:r_cx="true" | ||
2326 | 506 | inkscape:r_cy="true" | ||
2327 | 507 | rx="0.50463516" | ||
2328 | 508 | ry="0.46875" /> | ||
2329 | 509 | <rect | ||
2330 | 510 | style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" | ||
2331 | 511 | id="rect5555" | ||
2332 | 512 | width="28.125" | ||
2333 | 513 | height="0.9375" | ||
2334 | 514 | x="10" | ||
2335 | 515 | y="23.0625" | ||
2336 | 516 | inkscape:r_cx="true" | ||
2337 | 517 | inkscape:r_cy="true" | ||
2338 | 518 | rx="0.50463516" | ||
2339 | 519 | ry="0.46875" /> | ||
2340 | 520 | <rect | ||
2341 | 521 | ry="0.46875" | ||
2342 | 522 | rx="0.50463516" | ||
2343 | 523 | inkscape:r_cy="true" | ||
2344 | 524 | inkscape:r_cx="true" | ||
2345 | 525 | y="25.0625" | ||
2346 | 526 | x="10" | ||
2347 | 527 | height="0.9375" | ||
2348 | 528 | width="28.125" | ||
2349 | 529 | id="rect5557" | ||
2350 | 530 | style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> | ||
2351 | 531 | <rect | ||
2352 | 532 | ry="0.46875" | ||
2353 | 533 | rx="0.50463516" | ||
2354 | 534 | inkscape:r_cy="true" | ||
2355 | 535 | inkscape:r_cx="true" | ||
2356 | 536 | y="27.0625" | ||
2357 | 537 | x="10" | ||
2358 | 538 | height="0.9375" | ||
2359 | 539 | width="28.125" | ||
2360 | 540 | id="rect5559" | ||
2361 | 541 | style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> | ||
2362 | 542 | <rect | ||
2363 | 543 | style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" | ||
2364 | 544 | id="rect5561" | ||
2365 | 545 | width="28.125" | ||
2366 | 546 | height="0.9375" | ||
2367 | 547 | x="10" | ||
2368 | 548 | y="29.0625" | ||
2369 | 549 | inkscape:r_cx="true" | ||
2370 | 550 | inkscape:r_cy="true" | ||
2371 | 551 | rx="0.50463516" | ||
2372 | 552 | ry="0.46875" /> | ||
2373 | 553 | <rect | ||
2374 | 554 | style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" | ||
2375 | 555 | id="rect5563" | ||
2376 | 556 | width="28.125" | ||
2377 | 557 | height="0.9375" | ||
2378 | 558 | x="10" | ||
2379 | 559 | y="31.0625" | ||
2380 | 560 | inkscape:r_cx="true" | ||
2381 | 561 | inkscape:r_cy="true" | ||
2382 | 562 | rx="0.50463516" | ||
2383 | 563 | ry="0.46875" /> | ||
2384 | 564 | <rect | ||
2385 | 565 | ry="0.46875" | ||
2386 | 566 | rx="0.50463516" | ||
2387 | 567 | inkscape:r_cy="true" | ||
2388 | 568 | inkscape:r_cx="true" | ||
2389 | 569 | y="33.0625" | ||
2390 | 570 | x="10" | ||
2391 | 571 | height="0.9375" | ||
2392 | 572 | width="28.125" | ||
2393 | 573 | id="rect5565" | ||
2394 | 574 | style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> | ||
2395 | 575 | <rect | ||
2396 | 576 | ry="0.46875" | ||
2397 | 577 | rx="0.50463516" | ||
2398 | 578 | inkscape:r_cy="true" | ||
2399 | 579 | inkscape:r_cx="true" | ||
2400 | 580 | y="35.0625" | ||
2401 | 581 | x="10" | ||
2402 | 582 | height="0.9375" | ||
2403 | 583 | width="28.125" | ||
2404 | 584 | id="rect5567" | ||
2405 | 585 | style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> | ||
2406 | 586 | <rect | ||
2407 | 587 | ry="0.46875" | ||
2408 | 588 | rx="0.50463516" | ||
2409 | 589 | inkscape:r_cy="true" | ||
2410 | 590 | inkscape:r_cx="true" | ||
2411 | 591 | y="37.0625" | ||
2412 | 592 | x="10" | ||
2413 | 593 | height="0.9375" | ||
2414 | 594 | width="13.8125" | ||
2415 | 595 | id="rect5569" | ||
2416 | 596 | style="opacity:1;fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.99999982px;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible" /> | ||
2417 | 597 | </g> | ||
2418 | 598 | </g> | ||
2419 | 599 | </g> | ||
2420 | 600 | <g | ||
2421 | 601 | style="display:inline" | ||
2422 | 602 | inkscape:groupmode="layer" | ||
2423 | 603 | inkscape:label="Base" | ||
2424 | 604 | id="layer1" /> | ||
2425 | 605 | <g | ||
2426 | 606 | inkscape:groupmode="layer" | ||
2427 | 607 | id="layer5" | ||
2428 | 608 | inkscape:label="Text" | ||
2429 | 609 | style="display:inline" /> | ||
2430 | 610 | </svg> |