Merge lp:~pcabido/gtg/geolocalized-tasks into lp:~gtg/gtg/old-trunk
- geolocalized-tasks
- Merge into old-trunk
Proposed by
Paulo Cabido
Status: | Merged |
---|---|
Approved by: | Paulo Cabido |
Approved revision: | 316 |
Merge reported by: | Paulo Cabido |
Merged at revision: | not available |
Proposed branch: | lp:~pcabido/gtg/geolocalized-tasks |
Merge into: | lp:~gtg/gtg/old-trunk |
Diff against target: | None lines |
To merge this branch: | bzr merge lp:~pcabido/gtg/geolocalized-tasks |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paulo Cabido (community) | Approve | ||
Review via email: mp+10211@code.launchpad.net |
Commit message
Added filtering capabilities
- Filter callbacks were added to the task browser
- Filters were also added to the requester
- filter callbacks can be registered via the plugin api
Updated the geolocalized-tasks plugins
Description of the change
To post a comment you must log in.
Revision history for this message
Paulo Cabido (pcabido) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'CHANGELOG' |
2 | --- CHANGELOG 2009-07-30 14:30:27 +0000 |
3 | +++ CHANGELOG 2009-08-11 12:18:20 +0000 |
4 | @@ -1,5 +1,8 @@ |
5 | - * Fixed #406851, incorrect behaviour marking a dismissed task as done by Patrick Coleman |
6 | - * Added accelerators to the task editor by Patrick Coleman |
7 | + * Added filtering capabilities by Paulo Cabido |
8 | + - Filter callbacks were added to the task browser |
9 | + - Filters were also added to the requester |
10 | + * Fixed #406851, incorrect behaviour marking a dismissed task as done by Patrick Coleman |
11 | + * Added accelerators to the task editor by Patrick Coleman |
12 | * Add plugin engine by Paulo Cabido |
13 | * When GTG is already running, use DBUS to raise existing instance rather than failing silently |
14 | * Refactorization and PEP8ification work by Jonathan Lange |
15 | |
16 | === modified file 'GTG/core/plugins/api.py' |
17 | --- GTG/core/plugins/api.py 2009-08-01 00:35:25 +0000 |
18 | +++ GTG/core/plugins/api.py 2009-08-11 17:59:33 +0000 |
19 | @@ -19,8 +19,9 @@ |
20 | import gtk |
21 | |
22 | class PluginAPI: |
23 | - def __init__(self, window, config, wTree, requester, taskview, workview_task_filter, \ |
24 | - tagpopup, tagview, task=None, textview=None): |
25 | + def __init__(self, window, config, wTree, requester, taskview,\ |
26 | + filter_cbs, tagpopup, tagview, task=None,\ |
27 | + textview=None): |
28 | # private vars |
29 | self.__window = window |
30 | self.config = config |
31 | @@ -28,11 +29,12 @@ |
32 | self.__requester = requester |
33 | |
34 | self.taskview = taskview |
35 | - self.__workview_task_filter = workview_task_filter |
36 | |
37 | self.__tagpopup = tagpopup |
38 | self.tagview = tagview |
39 | |
40 | + self.__filter_cbs = filter_cbs |
41 | + |
42 | if task: |
43 | self.task = task |
44 | |
45 | @@ -98,6 +100,10 @@ |
46 | # passes the requester to the plugin |
47 | def get_requester(self): |
48 | return self.__requester |
49 | + |
50 | + # connects a function to a requester signal |
51 | + def requester_connect(self, action, func): |
52 | + self.__requester.connect(action, func) |
53 | |
54 | # changes the tasks TreeStore |
55 | def change_task_tree_store(self, treestore): |
56 | @@ -121,13 +127,19 @@ |
57 | def get_task_title(self): |
58 | return self.task.get_title() |
59 | |
60 | - # adds a tag, updated the text buffer, inserting the tag at the end of |
61 | - # the task |
62 | + # inserts a tag in the textview |
63 | # this method only works for the onTaskOpened method |
64 | - def add_tag(self, tag): |
65 | + def insert_tag(self, tag): |
66 | + itera = self.textview.get_insert() |
67 | + if itera.starts_line() : |
68 | + self.textview.insert_text("@" + tag,itera) |
69 | + else : |
70 | + self.textview.insert_text(" @" + tag,itera) |
71 | + self.textview.grab_focus() |
72 | + |
73 | + # adds a tag to a task |
74 | + def add_tag(self, tag): |
75 | self.task.add_tag("@" + tag) |
76 | - #self.textview.insert_text("@" + tag) |
77 | - self.textview.insert_tag("@" + tag) |
78 | |
79 | # adds a attribute to a tag |
80 | # this method only works for the onTaskOpened method |
81 | @@ -167,7 +179,7 @@ |
82 | selected = self.tagview.get_selection() |
83 | model, iter = selected.get_selected() |
84 | tag = model.get_value(iter, 0) |
85 | - return tag |
86 | + return self.__requester.get_tag(tag) |
87 | |
88 | # returns the task view in the main window (task browser) |
89 | def get_taskview(self): |
90 | @@ -186,7 +198,28 @@ |
91 | def get_config(self): |
92 | return self.config |
93 | |
94 | - # add's a tid to the workview filter |
95 | - def add_task_to_workview_filter(self, tid): |
96 | - self.__workview_task_filter.append(tid) |
97 | - |
98 | + # add's a tid to the filter |
99 | + def add_task_to_filter(self, tid): |
100 | + self.__requester.add_task_to_filter(tid) |
101 | + |
102 | + # removes a tid from the filter |
103 | + def remove_task_from_filter(self, tid): |
104 | + self.__requester.remove_task_from_filter(tid) |
105 | + |
106 | + # adds a tag (tag name) to the filter |
107 | + def add_tag_to_filter(self, tag): |
108 | + self.__requester.add_tag_to_filter(tag) |
109 | + |
110 | + # removes a tag (tag name) from the filter |
111 | + def remove_tag_from_filter(self, tag): |
112 | + self.__requester.remove_tag_from_filter(tag) |
113 | + |
114 | + # register a callback with the filter callbacks |
115 | + def register_filter_cb(self, func): |
116 | + if func not in self.__filter_cbs: |
117 | + self.__filter_cbs.append(func) |
118 | + |
119 | + # unregister a callback from the filter callbacks |
120 | + def unregister_filter_cb(self, func): |
121 | + if func in self.__filter_cbs: |
122 | + self.__filter_cbs.remove(func) |
123 | |
124 | === modified file 'GTG/core/plugins/engine.py' |
125 | --- GTG/core/plugins/engine.py 2009-08-06 21:58:24 +0000 |
126 | +++ GTG/core/plugins/engine.py 2009-08-10 01:39:40 +0000 |
127 | @@ -69,6 +69,7 @@ |
128 | missing.append(str(e).split(" ")[3]) |
129 | error = True |
130 | except Exception, e: |
131 | + print e |
132 | error = True |
133 | |
134 | # check DBus dependencies |
135 | |
136 | === modified file 'GTG/core/requester.py' |
137 | --- GTG/core/requester.py 2009-08-05 12:34:03 +0000 |
138 | +++ GTG/core/requester.py 2009-08-10 00:44:54 +0000 |
139 | @@ -38,6 +38,12 @@ |
140 | def __init__(self, datastore): |
141 | """Construct a L{Requester}.""" |
142 | self.ds = datastore |
143 | + |
144 | + #filter |
145 | + self.filter = {} |
146 | + self.filter["tasks"] = [] |
147 | + self.filter["tags"] = [] |
148 | + |
149 | gobject.GObject.__init__(self) |
150 | |
151 | ############# Signals ######################### |
152 | @@ -152,6 +158,30 @@ |
153 | if task: |
154 | l_tasks.append(tid) |
155 | return l_tasks |
156 | + |
157 | + ############# Filters ######################### |
158 | + def set_filter(self, filter): |
159 | + self.filter = filter |
160 | + |
161 | + def get_filter(self): |
162 | + return self.filter |
163 | + |
164 | + def add_task_to_filter(self, tid): |
165 | + if tid not in self.filter["tasks"]: |
166 | + self.filter["tasks"].append(tid) |
167 | + |
168 | + def remove_task_from_filter(self, tid): |
169 | + if tid in self.filter["tasks"]: |
170 | + self.filter["tasks"].remove(tid) |
171 | + |
172 | + def add_tag_to_filter(self, tag): |
173 | + if tag not in self.filter["tags"]: |
174 | + self.filter["tags"].append(tag) |
175 | + |
176 | + def remove_tag_from_filter(self, tag): |
177 | + if tid in self.filter["tags"]: |
178 | + self.filter["tags"].remove(tag) |
179 | + ############# Filters ######################### |
180 | |
181 | def get_active_tasks_list(self, tags=None, notag_only=False, |
182 | started_only=True, is_root=False, |
183 | @@ -179,15 +209,37 @@ |
184 | temp_tasks = self.get_active_tasks_list( |
185 | tags=tags, notag_only=notag_only, started_only=True, |
186 | is_root=False, workable=False) |
187 | + |
188 | + #remove from temp_tasks the filtered out tasks |
189 | + #for tid in temp_tasks: |
190 | + # if tid in self.filter["tasks"]: |
191 | + # temp_tasks.remove(tid) |
192 | + # else: |
193 | + # for filter_tag in self.get_task(tid).get_tags(): |
194 | + # if filter_tag.get_attribute("name") in self.filter["tags"]: |
195 | + # print self.get_task(tid).get_title() |
196 | + # temp_tasks.remove(tid) |
197 | + # break |
198 | + |
199 | # Now we verify that the tasks are workable and don't have a |
200 | # nonwork_tag. |
201 | for tid in temp_tasks: |
202 | + filtered_tag = False |
203 | t = self.get_task(tid) |
204 | - if t and t.is_workable(): |
205 | - if len(nonwork_tag) == 0: |
206 | - l_tasks.append(tid) |
207 | - elif not t.has_tags(nonwork_tag): |
208 | - l_tasks.append(tid) |
209 | + if t and t.is_workable() and (tid not in self.filter["tasks"]): |
210 | + for filter_tag in t.get_tags(): |
211 | + if filter_tag.get_attribute("name") in self.filter["tags"]: |
212 | + #print t.get_title() |
213 | + temp_tasks.remove(tid) |
214 | + filtered_tag = True |
215 | + |
216 | + if not filtered_tag: |
217 | + if len(nonwork_tag) == 0: |
218 | + #print t.get_title() |
219 | + l_tasks.append(tid) |
220 | + elif not t.has_tags(nonwork_tag): |
221 | + #print t.get_title() |
222 | + l_tasks.append(tid) |
223 | return l_tasks |
224 | else: |
225 | active = ["Active"] |
226 | |
227 | === modified file 'GTG/plugins/geolocalized-tasks.gtg-plugin' |
228 | --- GTG/plugins/geolocalized-tasks.gtg-plugin 2009-08-05 22:33:44 +0000 |
229 | +++ GTG/plugins/geolocalized-tasks.gtg-plugin 2009-08-15 17:58:22 +0000 |
230 | @@ -1,8 +1,8 @@ |
231 | [GTG Plugin] |
232 | Module=geolocalized_tasks |
233 | Name=Geolocalized Tasks |
234 | -Description=This plugin adds geolocalized tasks to GTG!.\nWARNING: This plugin is still heavy development. |
235 | +Description=This plugin adds geolocalized tasks to GTG!.\nWARNING: This plugin is still under heavy development. |
236 | Authors=Paulo Cabido <paulo.cabido@gmail.com> |
237 | -Version=0.1 |
238 | +Version=0.1.1 |
239 | Dependencies=configobj,Geoclue,clutter,cluttergtk,champlain,champlaingtk |
240 | Enabled=False |
241 | |
242 | === modified file 'GTG/plugins/geolocalized_tasks/geolocalized.glade' |
243 | --- GTG/plugins/geolocalized_tasks/geolocalized.glade 2009-08-05 09:46:56 +0000 |
244 | +++ GTG/plugins/geolocalized_tasks/geolocalized.glade 2009-08-15 17:58:22 +0000 |
245 | @@ -1,790 +1,517 @@ |
246 | -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> |
247 | -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> |
248 | - |
249 | +<?xml version="1.0"?> |
250 | <glade-interface> |
251 | - |
252 | -<widget class="GtkDialog" id="SetTaskLocation"> |
253 | - <property name="visible">True</property> |
254 | - <property name="title" translatable="yes">Set the task's location</property> |
255 | - <property name="type">GTK_WINDOW_TOPLEVEL</property> |
256 | - <property name="window_position">GTK_WIN_POS_NONE</property> |
257 | - <property name="modal">False</property> |
258 | - <property name="resizable">True</property> |
259 | - <property name="destroy_with_parent">False</property> |
260 | - <property name="decorated">True</property> |
261 | - <property name="skip_taskbar_hint">False</property> |
262 | - <property name="skip_pager_hint">False</property> |
263 | - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> |
264 | - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> |
265 | - <property name="focus_on_map">True</property> |
266 | - <property name="urgency_hint">False</property> |
267 | - <property name="has_separator">True</property> |
268 | - |
269 | - <child internal-child="vbox"> |
270 | - <widget class="GtkVBox" id="dialog-vbox2"> |
271 | - <property name="visible">True</property> |
272 | - <property name="homogeneous">False</property> |
273 | - <property name="spacing">0</property> |
274 | - |
275 | - <child internal-child="action_area"> |
276 | - <widget class="GtkHButtonBox" id="dialog-action_area2"> |
277 | - <property name="visible">True</property> |
278 | - <property name="layout_style">GTK_BUTTONBOX_END</property> |
279 | - |
280 | - <child> |
281 | - <widget class="GtkButton" id="cancelbutton2"> |
282 | - <property name="visible">True</property> |
283 | - <property name="can_default">True</property> |
284 | - <property name="can_focus">True</property> |
285 | - <property name="label">gtk-cancel</property> |
286 | - <property name="use_stock">True</property> |
287 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
288 | - <property name="focus_on_click">True</property> |
289 | - <property name="response_id">-6</property> |
290 | - </widget> |
291 | - </child> |
292 | - |
293 | - <child> |
294 | - <widget class="GtkButton" id="okbutton2"> |
295 | - <property name="visible">True</property> |
296 | - <property name="can_default">True</property> |
297 | - <property name="can_focus">True</property> |
298 | - <property name="label">gtk-ok</property> |
299 | - <property name="use_stock">True</property> |
300 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
301 | - <property name="focus_on_click">True</property> |
302 | - <property name="response_id">-5</property> |
303 | - </widget> |
304 | - </child> |
305 | - </widget> |
306 | - <packing> |
307 | - <property name="padding">0</property> |
308 | - <property name="expand">False</property> |
309 | - <property name="fill">True</property> |
310 | - <property name="pack_type">GTK_PACK_END</property> |
311 | - </packing> |
312 | - </child> |
313 | - |
314 | - <child> |
315 | - <widget class="GtkVBox" id="vbox_map"> |
316 | - <property name="width_request">400</property> |
317 | - <property name="visible">True</property> |
318 | - <property name="homogeneous">False</property> |
319 | - <property name="spacing">0</property> |
320 | - |
321 | - <child> |
322 | - <widget class="GtkToolbar" id="toolbar2"> |
323 | - <property name="visible">True</property> |
324 | - <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> |
325 | - <property name="toolbar_style">GTK_TOOLBAR_BOTH</property> |
326 | - <property name="tooltips">True</property> |
327 | - <property name="show_arrow">True</property> |
328 | - |
329 | - <child> |
330 | - <widget class="GtkToolButton" id="btn_zoom_in"> |
331 | - <property name="visible">True</property> |
332 | - <property name="stock_id">gtk-zoom-in</property> |
333 | - <property name="visible_horizontal">True</property> |
334 | - <property name="visible_vertical">True</property> |
335 | - <property name="is_important">False</property> |
336 | - </widget> |
337 | - <packing> |
338 | - <property name="expand">False</property> |
339 | - <property name="homogeneous">True</property> |
340 | - </packing> |
341 | - </child> |
342 | - |
343 | - <child> |
344 | - <widget class="GtkToolButton" id="btn_zoom_out"> |
345 | - <property name="visible">True</property> |
346 | - <property name="stock_id">gtk-zoom-out</property> |
347 | - <property name="visible_horizontal">True</property> |
348 | - <property name="visible_vertical">True</property> |
349 | - <property name="is_important">False</property> |
350 | - </widget> |
351 | - <packing> |
352 | - <property name="expand">False</property> |
353 | - <property name="homogeneous">True</property> |
354 | - </packing> |
355 | - </child> |
356 | - </widget> |
357 | - <packing> |
358 | - <property name="padding">0</property> |
359 | - <property name="expand">False</property> |
360 | - <property name="fill">False</property> |
361 | - </packing> |
362 | - </child> |
363 | - |
364 | - <child> |
365 | - <widget class="GtkVBox" id="vbox_map"> |
366 | - <property name="visible">True</property> |
367 | - <property name="homogeneous">False</property> |
368 | - <property name="spacing">0</property> |
369 | - |
370 | - <child> |
371 | - <placeholder/> |
372 | - </child> |
373 | - </widget> |
374 | - <packing> |
375 | - <property name="padding">0</property> |
376 | - <property name="expand">True</property> |
377 | - <property name="fill">True</property> |
378 | - </packing> |
379 | - </child> |
380 | - |
381 | - <child> |
382 | - <widget class="GtkVBox" id="vbox_opt"> |
383 | - <property name="visible">True</property> |
384 | - <property name="homogeneous">False</property> |
385 | - <property name="spacing">0</property> |
386 | - |
387 | - <child> |
388 | - <widget class="GtkTable" id="tabela_set_task"> |
389 | - <property name="visible">True</property> |
390 | - <property name="n_rows">2</property> |
391 | - <property name="n_columns">2</property> |
392 | - <property name="homogeneous">False</property> |
393 | - <property name="row_spacing">0</property> |
394 | - <property name="column_spacing">0</property> |
395 | - |
396 | - <child> |
397 | - <widget class="GtkRadioButton" id="radiobutton1"> |
398 | - <property name="width_request">198</property> |
399 | - <property name="visible">True</property> |
400 | - <property name="can_focus">True</property> |
401 | - <property name="label" translatable="yes">Associate with new tag</property> |
402 | - <property name="use_underline">True</property> |
403 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
404 | - <property name="focus_on_click">True</property> |
405 | - <property name="active">False</property> |
406 | - <property name="inconsistent">False</property> |
407 | - <property name="draw_indicator">True</property> |
408 | - </widget> |
409 | - <packing> |
410 | - <property name="left_attach">0</property> |
411 | - <property name="right_attach">1</property> |
412 | - <property name="top_attach">0</property> |
413 | - <property name="bottom_attach">1</property> |
414 | - <property name="x_options">fill</property> |
415 | - <property name="y_options"></property> |
416 | - </packing> |
417 | - </child> |
418 | - |
419 | - <child> |
420 | - <widget class="GtkRadioButton" id="radiobutton2"> |
421 | - <property name="visible">True</property> |
422 | - <property name="can_focus">True</property> |
423 | - <property name="label" translatable="yes">Associate with existing tag</property> |
424 | - <property name="use_underline">True</property> |
425 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
426 | - <property name="focus_on_click">True</property> |
427 | - <property name="active">False</property> |
428 | - <property name="inconsistent">False</property> |
429 | - <property name="draw_indicator">True</property> |
430 | - <property name="group">radiobutton1</property> |
431 | - </widget> |
432 | - <packing> |
433 | - <property name="left_attach">0</property> |
434 | - <property name="right_attach">1</property> |
435 | - <property name="top_attach">1</property> |
436 | - <property name="bottom_attach">2</property> |
437 | - <property name="x_options">fill</property> |
438 | - <property name="y_options"></property> |
439 | - </packing> |
440 | - </child> |
441 | - |
442 | - <child> |
443 | - <widget class="GtkEntry" id="txt_new_tag"> |
444 | - <property name="visible">True</property> |
445 | - <property name="can_focus">True</property> |
446 | - <property name="editable">True</property> |
447 | - <property name="visibility">True</property> |
448 | - <property name="max_length">0</property> |
449 | - <property name="text" translatable="yes"></property> |
450 | - <property name="has_frame">True</property> |
451 | - <property name="invisible_char">●</property> |
452 | - <property name="activates_default">False</property> |
453 | - </widget> |
454 | - <packing> |
455 | - <property name="left_attach">1</property> |
456 | - <property name="right_attach">2</property> |
457 | - <property name="top_attach">0</property> |
458 | - <property name="bottom_attach">1</property> |
459 | - <property name="y_options"></property> |
460 | - </packing> |
461 | - </child> |
462 | - |
463 | - <child> |
464 | - <widget class="GtkComboBoxEntry" id="cmb_existing_tag"> |
465 | - <property name="visible">True</property> |
466 | - <property name="add_tearoffs">False</property> |
467 | - <property name="has_frame">True</property> |
468 | - <property name="focus_on_click">True</property> |
469 | - </widget> |
470 | - <packing> |
471 | - <property name="left_attach">1</property> |
472 | - <property name="right_attach">2</property> |
473 | - <property name="top_attach">1</property> |
474 | - <property name="bottom_attach">2</property> |
475 | - <property name="x_options">fill</property> |
476 | - <property name="y_options"></property> |
477 | - </packing> |
478 | - </child> |
479 | - </widget> |
480 | - <packing> |
481 | - <property name="padding">0</property> |
482 | - <property name="expand">True</property> |
483 | - <property name="fill">True</property> |
484 | - </packing> |
485 | - </child> |
486 | - </widget> |
487 | - <packing> |
488 | - <property name="padding">2</property> |
489 | - <property name="expand">False</property> |
490 | - <property name="fill">False</property> |
491 | - </packing> |
492 | - </child> |
493 | - </widget> |
494 | - <packing> |
495 | - <property name="padding">0</property> |
496 | - <property name="expand">False</property> |
497 | - <property name="fill">False</property> |
498 | - </packing> |
499 | - </child> |
500 | - </widget> |
501 | - </child> |
502 | -</widget> |
503 | - |
504 | -<widget class="GtkDialog" id="TagLocation"> |
505 | - <property name="visible">True</property> |
506 | - <property name="title" translatable="yes"></property> |
507 | - <property name="type">GTK_WINDOW_TOPLEVEL</property> |
508 | - <property name="window_position">GTK_WIN_POS_NONE</property> |
509 | - <property name="modal">False</property> |
510 | - <property name="resizable">True</property> |
511 | - <property name="destroy_with_parent">False</property> |
512 | - <property name="decorated">True</property> |
513 | - <property name="skip_taskbar_hint">False</property> |
514 | - <property name="skip_pager_hint">False</property> |
515 | - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> |
516 | - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> |
517 | - <property name="focus_on_map">True</property> |
518 | - <property name="urgency_hint">False</property> |
519 | - <property name="has_separator">True</property> |
520 | - |
521 | - <child internal-child="vbox"> |
522 | - <widget class="GtkVBox" id="dialog-vbox3"> |
523 | - <property name="visible">True</property> |
524 | - <property name="homogeneous">False</property> |
525 | - <property name="spacing">0</property> |
526 | - |
527 | - <child internal-child="action_area"> |
528 | - <widget class="GtkHButtonBox" id="dialog-action_area3"> |
529 | - <property name="visible">True</property> |
530 | - <property name="layout_style">GTK_BUTTONBOX_END</property> |
531 | - |
532 | - <child> |
533 | - <widget class="GtkButton" id="cancelbutton3"> |
534 | - <property name="visible">True</property> |
535 | - <property name="can_default">True</property> |
536 | - <property name="can_focus">True</property> |
537 | - <property name="label">gtk-cancel</property> |
538 | - <property name="use_stock">True</property> |
539 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
540 | - <property name="focus_on_click">True</property> |
541 | - <property name="response_id">-6</property> |
542 | - </widget> |
543 | - </child> |
544 | - |
545 | - <child> |
546 | - <widget class="GtkButton" id="okbutton3"> |
547 | - <property name="visible">True</property> |
548 | - <property name="can_default">True</property> |
549 | - <property name="can_focus">True</property> |
550 | - <property name="label">gtk-ok</property> |
551 | - <property name="use_stock">True</property> |
552 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
553 | - <property name="focus_on_click">True</property> |
554 | - <property name="response_id">-5</property> |
555 | - </widget> |
556 | - </child> |
557 | - </widget> |
558 | - <packing> |
559 | - <property name="padding">0</property> |
560 | - <property name="expand">False</property> |
561 | - <property name="fill">True</property> |
562 | - <property name="pack_type">GTK_PACK_END</property> |
563 | - </packing> |
564 | - </child> |
565 | - |
566 | - <child> |
567 | - <widget class="GtkVBox" id="vbox3"> |
568 | - <property name="visible">True</property> |
569 | - <property name="homogeneous">False</property> |
570 | - <property name="spacing">0</property> |
571 | - |
572 | - <child> |
573 | - <widget class="GtkToolbar" id="toolbar3"> |
574 | - <property name="visible">True</property> |
575 | - <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> |
576 | - <property name="toolbar_style">GTK_TOOLBAR_BOTH</property> |
577 | - <property name="tooltips">True</property> |
578 | - <property name="show_arrow">True</property> |
579 | - |
580 | - <child> |
581 | - <widget class="GtkToolButton" id="btn_zoom_in"> |
582 | - <property name="visible">True</property> |
583 | - <property name="stock_id">gtk-zoom-in</property> |
584 | - <property name="visible_horizontal">True</property> |
585 | - <property name="visible_vertical">True</property> |
586 | - <property name="is_important">False</property> |
587 | - </widget> |
588 | - <packing> |
589 | - <property name="expand">False</property> |
590 | - <property name="homogeneous">True</property> |
591 | - </packing> |
592 | - </child> |
593 | - |
594 | - <child> |
595 | - <widget class="GtkToolButton" id="btn_zoom_out"> |
596 | - <property name="visible">True</property> |
597 | - <property name="stock_id">gtk-zoom-out</property> |
598 | - <property name="visible_horizontal">True</property> |
599 | - <property name="visible_vertical">True</property> |
600 | - <property name="is_important">False</property> |
601 | - </widget> |
602 | - <packing> |
603 | - <property name="expand">False</property> |
604 | - <property name="homogeneous">True</property> |
605 | - </packing> |
606 | - </child> |
607 | - </widget> |
608 | - <packing> |
609 | - <property name="padding">0</property> |
610 | - <property name="expand">False</property> |
611 | - <property name="fill">False</property> |
612 | - </packing> |
613 | - </child> |
614 | - |
615 | - <child> |
616 | - <widget class="GtkVBox" id="vbox_map"> |
617 | - <property name="width_request">400</property> |
618 | - <property name="visible">True</property> |
619 | - <property name="homogeneous">False</property> |
620 | - <property name="spacing">0</property> |
621 | - |
622 | - <child> |
623 | - <placeholder/> |
624 | - </child> |
625 | - </widget> |
626 | - <packing> |
627 | - <property name="padding">0</property> |
628 | - <property name="expand">True</property> |
629 | - <property name="fill">True</property> |
630 | - </packing> |
631 | - </child> |
632 | - </widget> |
633 | - <packing> |
634 | - <property name="padding">0</property> |
635 | - <property name="expand">False</property> |
636 | - <property name="fill">False</property> |
637 | - </packing> |
638 | - </child> |
639 | - </widget> |
640 | - </child> |
641 | -</widget> |
642 | - |
643 | -<widget class="GtkDialog" id="Preferences"> |
644 | - <property name="width_request">350</property> |
645 | - <property name="visible">True</property> |
646 | - <property name="title" translatable="yes">Geolocalized-tasks Preferences</property> |
647 | - <property name="type">GTK_WINDOW_TOPLEVEL</property> |
648 | - <property name="window_position">GTK_WIN_POS_NONE</property> |
649 | - <property name="modal">False</property> |
650 | - <property name="resizable">True</property> |
651 | - <property name="destroy_with_parent">False</property> |
652 | - <property name="decorated">True</property> |
653 | - <property name="skip_taskbar_hint">False</property> |
654 | - <property name="skip_pager_hint">False</property> |
655 | - <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> |
656 | - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> |
657 | - <property name="focus_on_map">True</property> |
658 | - <property name="urgency_hint">False</property> |
659 | - <property name="has_separator">True</property> |
660 | - |
661 | - <child internal-child="vbox"> |
662 | - <widget class="GtkVBox" id="dialog-vbox4"> |
663 | - <property name="visible">True</property> |
664 | - <property name="homogeneous">False</property> |
665 | - <property name="spacing">0</property> |
666 | - |
667 | - <child internal-child="action_area"> |
668 | - <widget class="GtkHButtonBox" id="dialog-action_area4"> |
669 | - <property name="visible">True</property> |
670 | - <property name="layout_style">GTK_BUTTONBOX_END</property> |
671 | - |
672 | - <child> |
673 | - <widget class="GtkButton" id="cancelbutton4"> |
674 | - <property name="visible">True</property> |
675 | - <property name="can_default">True</property> |
676 | - <property name="can_focus">True</property> |
677 | - <property name="label">gtk-cancel</property> |
678 | - <property name="use_stock">True</property> |
679 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
680 | - <property name="focus_on_click">True</property> |
681 | - <property name="response_id">-6</property> |
682 | - </widget> |
683 | - </child> |
684 | - |
685 | - <child> |
686 | - <widget class="GtkButton" id="okbutton4"> |
687 | - <property name="visible">True</property> |
688 | - <property name="can_default">True</property> |
689 | - <property name="can_focus">True</property> |
690 | - <property name="label">gtk-ok</property> |
691 | - <property name="use_stock">True</property> |
692 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
693 | - <property name="focus_on_click">True</property> |
694 | - <property name="response_id">-5</property> |
695 | - </widget> |
696 | - </child> |
697 | - </widget> |
698 | - <packing> |
699 | - <property name="padding">0</property> |
700 | - <property name="expand">False</property> |
701 | - <property name="fill">True</property> |
702 | - <property name="pack_type">GTK_PACK_END</property> |
703 | - </packing> |
704 | - </child> |
705 | - |
706 | - <child> |
707 | - <widget class="GtkVBox" id="vbox4"> |
708 | - <property name="visible">True</property> |
709 | - <property name="homogeneous">False</property> |
710 | - <property name="spacing">0</property> |
711 | - |
712 | - <child> |
713 | - <widget class="GtkFrame" id="frame3"> |
714 | - <property name="border_width">3</property> |
715 | - <property name="visible">True</property> |
716 | - <property name="label_xalign">0</property> |
717 | - <property name="label_yalign">0.5</property> |
718 | - <property name="shadow_type">GTK_SHADOW_NONE</property> |
719 | - |
720 | - <child> |
721 | - <widget class="GtkAlignment" id="alignment3"> |
722 | - <property name="visible">True</property> |
723 | - <property name="xalign">0.5</property> |
724 | - <property name="yalign">0.5</property> |
725 | - <property name="xscale">1</property> |
726 | - <property name="yscale">1</property> |
727 | - <property name="top_padding">0</property> |
728 | - <property name="bottom_padding">0</property> |
729 | - <property name="left_padding">12</property> |
730 | - <property name="right_padding">0</property> |
731 | - |
732 | - <child> |
733 | - <widget class="GtkHBox" id="hbox4"> |
734 | - <property name="visible">True</property> |
735 | - <property name="homogeneous">False</property> |
736 | - <property name="spacing">0</property> |
737 | - |
738 | - <child> |
739 | - <widget class="GtkComboBoxEntry" id="cmb_accuracy"> |
740 | - <property name="visible">True</property> |
741 | - <property name="items" translatable="yes">Country |
742 | -Region |
743 | -Locality |
744 | -Postalcode |
745 | -Street |
746 | -Detailed</property> |
747 | - <property name="add_tearoffs">False</property> |
748 | - <property name="has_frame">True</property> |
749 | - <property name="focus_on_click">True</property> |
750 | - </widget> |
751 | - <packing> |
752 | - <property name="padding">0</property> |
753 | - <property name="expand">False</property> |
754 | - <property name="fill">False</property> |
755 | - </packing> |
756 | - </child> |
757 | - </widget> |
758 | - </child> |
759 | - </widget> |
760 | - </child> |
761 | - |
762 | - <child> |
763 | - <widget class="GtkLabel" id="label5"> |
764 | - <property name="visible">True</property> |
765 | - <property name="label" translatable="yes"><b>Accuracy</b></property> |
766 | - <property name="use_underline">False</property> |
767 | - <property name="use_markup">True</property> |
768 | - <property name="justify">GTK_JUSTIFY_LEFT</property> |
769 | - <property name="wrap">False</property> |
770 | - <property name="selectable">False</property> |
771 | - <property name="xalign">0.5</property> |
772 | - <property name="yalign">0.5</property> |
773 | - <property name="xpad">0</property> |
774 | - <property name="ypad">0</property> |
775 | - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> |
776 | - <property name="width_chars">-1</property> |
777 | - <property name="single_line_mode">False</property> |
778 | - <property name="angle">0</property> |
779 | - </widget> |
780 | - <packing> |
781 | - <property name="type">label_item</property> |
782 | - </packing> |
783 | - </child> |
784 | - </widget> |
785 | - <packing> |
786 | - <property name="padding">0</property> |
787 | - <property name="expand">False</property> |
788 | - <property name="fill">False</property> |
789 | - </packing> |
790 | - </child> |
791 | - |
792 | - <child> |
793 | - <widget class="GtkFrame" id="frame4"> |
794 | - <property name="border_width">3</property> |
795 | - <property name="visible">True</property> |
796 | - <property name="label_xalign">0</property> |
797 | - <property name="label_yalign">0.5</property> |
798 | - <property name="shadow_type">GTK_SHADOW_NONE</property> |
799 | - |
800 | - <child> |
801 | - <widget class="GtkAlignment" id="alignment4"> |
802 | - <property name="visible">True</property> |
803 | - <property name="xalign">0.5</property> |
804 | - <property name="yalign">0.5</property> |
805 | - <property name="xscale">1</property> |
806 | - <property name="yscale">1</property> |
807 | - <property name="top_padding">0</property> |
808 | - <property name="bottom_padding">0</property> |
809 | - <property name="left_padding">12</property> |
810 | - <property name="right_padding">0</property> |
811 | - |
812 | - <child> |
813 | - <widget class="GtkHBox" id="hbox5"> |
814 | - <property name="visible">True</property> |
815 | - <property name="homogeneous">False</property> |
816 | - <property name="spacing">0</property> |
817 | - |
818 | - <child> |
819 | - <widget class="GtkVBox" id="vbox5"> |
820 | - <property name="visible">True</property> |
821 | - <property name="homogeneous">False</property> |
822 | - <property name="spacing">0</property> |
823 | - |
824 | - <child> |
825 | - <widget class="GtkCheckButton" id="check_network"> |
826 | - <property name="visible">True</property> |
827 | - <property name="can_focus">True</property> |
828 | - <property name="label" translatable="yes">Use network</property> |
829 | - <property name="use_underline">True</property> |
830 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
831 | - <property name="focus_on_click">True</property> |
832 | - <property name="active">False</property> |
833 | - <property name="inconsistent">False</property> |
834 | - <property name="draw_indicator">True</property> |
835 | - </widget> |
836 | - <packing> |
837 | - <property name="padding">0</property> |
838 | - <property name="expand">False</property> |
839 | - <property name="fill">False</property> |
840 | - </packing> |
841 | - </child> |
842 | - |
843 | - <child> |
844 | - <widget class="GtkCheckButton" id="check_cellphone"> |
845 | - <property name="visible">True</property> |
846 | - <property name="can_focus">True</property> |
847 | - <property name="label" translatable="yes">Use cellphone (if available)</property> |
848 | - <property name="use_underline">True</property> |
849 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
850 | - <property name="focus_on_click">True</property> |
851 | - <property name="active">False</property> |
852 | - <property name="inconsistent">False</property> |
853 | - <property name="draw_indicator">True</property> |
854 | - </widget> |
855 | - <packing> |
856 | - <property name="padding">0</property> |
857 | - <property name="expand">False</property> |
858 | - <property name="fill">False</property> |
859 | - </packing> |
860 | - </child> |
861 | - |
862 | - <child> |
863 | - <widget class="GtkCheckButton" id="check_gps"> |
864 | - <property name="visible">True</property> |
865 | - <property name="can_focus">True</property> |
866 | - <property name="label" translatable="yes">Use gps (if available)</property> |
867 | - <property name="use_underline">True</property> |
868 | - <property name="relief">GTK_RELIEF_NORMAL</property> |
869 | - <property name="focus_on_click">True</property> |
870 | - <property name="active">False</property> |
871 | - <property name="inconsistent">False</property> |
872 | - <property name="draw_indicator">True</property> |
873 | - </widget> |
874 | - <packing> |
875 | - <property name="padding">0</property> |
876 | - <property name="expand">False</property> |
877 | - <property name="fill">False</property> |
878 | - </packing> |
879 | - </child> |
880 | - </widget> |
881 | - <packing> |
882 | - <property name="padding">0</property> |
883 | - <property name="expand">True</property> |
884 | - <property name="fill">True</property> |
885 | - </packing> |
886 | - </child> |
887 | - </widget> |
888 | - </child> |
889 | - </widget> |
890 | - </child> |
891 | - |
892 | - <child> |
893 | - <widget class="GtkLabel" id="label6"> |
894 | - <property name="visible">True</property> |
895 | - <property name="label" translatable="yes"><b>Location Determination Method</b></property> |
896 | - <property name="use_underline">False</property> |
897 | - <property name="use_markup">True</property> |
898 | - <property name="justify">GTK_JUSTIFY_LEFT</property> |
899 | - <property name="wrap">False</property> |
900 | - <property name="selectable">False</property> |
901 | - <property name="xalign">0.5</property> |
902 | - <property name="yalign">0.5</property> |
903 | - <property name="xpad">0</property> |
904 | - <property name="ypad">0</property> |
905 | - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> |
906 | - <property name="width_chars">-1</property> |
907 | - <property name="single_line_mode">False</property> |
908 | - <property name="angle">0</property> |
909 | - </widget> |
910 | - <packing> |
911 | - <property name="type">label_item</property> |
912 | - </packing> |
913 | - </child> |
914 | - </widget> |
915 | - <packing> |
916 | - <property name="padding">0</property> |
917 | - <property name="expand">True</property> |
918 | - <property name="fill">True</property> |
919 | - </packing> |
920 | - </child> |
921 | - |
922 | - <child> |
923 | - <widget class="GtkFrame" id="frame5"> |
924 | - <property name="border_width">3</property> |
925 | - <property name="visible">True</property> |
926 | - <property name="label_xalign">0</property> |
927 | - <property name="label_yalign">0.5</property> |
928 | - <property name="shadow_type">GTK_SHADOW_NONE</property> |
929 | - |
930 | - <child> |
931 | - <widget class="GtkAlignment" id="alignment5"> |
932 | - <property name="visible">True</property> |
933 | - <property name="xalign">0.5</property> |
934 | - <property name="yalign">0.5</property> |
935 | - <property name="xscale">1</property> |
936 | - <property name="yscale">1</property> |
937 | - <property name="top_padding">0</property> |
938 | - <property name="bottom_padding">0</property> |
939 | - <property name="left_padding">12</property> |
940 | - <property name="right_padding">0</property> |
941 | - |
942 | - <child> |
943 | - <widget class="GtkHBox" id="hbox3"> |
944 | - <property name="visible">True</property> |
945 | - <property name="homogeneous">False</property> |
946 | - <property name="spacing">0</property> |
947 | - |
948 | - <child> |
949 | - <widget class="GtkSpinButton" id="spin_proximityfactor"> |
950 | - <property name="visible">True</property> |
951 | - <property name="can_focus">True</property> |
952 | - <property name="climb_rate">1</property> |
953 | - <property name="digits">1</property> |
954 | - <property name="numeric">False</property> |
955 | - <property name="update_policy">GTK_UPDATE_ALWAYS</property> |
956 | - <property name="snap_to_ticks">False</property> |
957 | - <property name="wrap">False</property> |
958 | - <property name="adjustment">5 1 100 0.10000000149 10 10</property> |
959 | - </widget> |
960 | - <packing> |
961 | - <property name="padding">0</property> |
962 | - <property name="expand">False</property> |
963 | - <property name="fill">False</property> |
964 | - </packing> |
965 | - </child> |
966 | - |
967 | - <child> |
968 | - <widget class="GtkLabel" id="label8"> |
969 | - <property name="visible">True</property> |
970 | - <property name="label" translatable="yes">km</property> |
971 | - <property name="use_underline">False</property> |
972 | - <property name="use_markup">False</property> |
973 | - <property name="justify">GTK_JUSTIFY_LEFT</property> |
974 | - <property name="wrap">False</property> |
975 | - <property name="selectable">False</property> |
976 | - <property name="xalign">0.5</property> |
977 | - <property name="yalign">0.5</property> |
978 | - <property name="xpad">4</property> |
979 | - <property name="ypad">0</property> |
980 | - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> |
981 | - <property name="width_chars">-1</property> |
982 | - <property name="single_line_mode">False</property> |
983 | - <property name="angle">0</property> |
984 | - </widget> |
985 | - <packing> |
986 | - <property name="padding">0</property> |
987 | - <property name="expand">False</property> |
988 | - <property name="fill">False</property> |
989 | - </packing> |
990 | - </child> |
991 | - </widget> |
992 | - </child> |
993 | - </widget> |
994 | - </child> |
995 | - |
996 | - <child> |
997 | - <widget class="GtkLabel" id="label7"> |
998 | - <property name="visible">True</property> |
999 | - <property name="label" translatable="yes"><b>Proximity Factor</b></property> |
1000 | - <property name="use_underline">False</property> |
1001 | - <property name="use_markup">True</property> |
1002 | - <property name="justify">GTK_JUSTIFY_LEFT</property> |
1003 | - <property name="wrap">False</property> |
1004 | - <property name="selectable">False</property> |
1005 | - <property name="xalign">0.5</property> |
1006 | - <property name="yalign">0.5</property> |
1007 | - <property name="xpad">0</property> |
1008 | - <property name="ypad">0</property> |
1009 | - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> |
1010 | - <property name="width_chars">-1</property> |
1011 | - <property name="single_line_mode">False</property> |
1012 | - <property name="angle">0</property> |
1013 | - </widget> |
1014 | - <packing> |
1015 | - <property name="type">label_item</property> |
1016 | - </packing> |
1017 | - </child> |
1018 | - </widget> |
1019 | - <packing> |
1020 | - <property name="padding">0</property> |
1021 | - <property name="expand">True</property> |
1022 | - <property name="fill">True</property> |
1023 | - </packing> |
1024 | - </child> |
1025 | - </widget> |
1026 | - <packing> |
1027 | - <property name="padding">0</property> |
1028 | - <property name="expand">True</property> |
1029 | - <property name="fill">True</property> |
1030 | - </packing> |
1031 | - </child> |
1032 | - </widget> |
1033 | - </child> |
1034 | -</widget> |
1035 | - |
1036 | + <!-- interface-requires gtk+ 2.16 --> |
1037 | + <!-- interface-naming-policy toplevel-contextual --> |
1038 | + <widget class="GtkDialog" id="SetTaskLocation"> |
1039 | + <property name="visible">True</property> |
1040 | + <property name="title" translatable="yes">Set the task's location</property> |
1041 | + <property name="type_hint">dialog</property> |
1042 | + <child internal-child="vbox"> |
1043 | + <widget class="GtkVBox" id="dialog-vbox2"> |
1044 | + <property name="visible">True</property> |
1045 | + <child> |
1046 | + <widget class="GtkVBox" id="vbox"> |
1047 | + <property name="width_request">400</property> |
1048 | + <property name="visible">True</property> |
1049 | + <child> |
1050 | + <widget class="GtkToolbar" id="toolbar2"> |
1051 | + <property name="visible">True</property> |
1052 | + <property name="toolbar_style">both</property> |
1053 | + <child> |
1054 | + <widget class="GtkToolButton" id="btn_zoom_in"> |
1055 | + <property name="visible">True</property> |
1056 | + <property name="stock_id">gtk-zoom-in</property> |
1057 | + </widget> |
1058 | + <packing> |
1059 | + <property name="expand">False</property> |
1060 | + <property name="homogeneous">True</property> |
1061 | + </packing> |
1062 | + </child> |
1063 | + <child> |
1064 | + <widget class="GtkToolButton" id="btn_zoom_out"> |
1065 | + <property name="visible">True</property> |
1066 | + <property name="stock_id">gtk-zoom-out</property> |
1067 | + </widget> |
1068 | + <packing> |
1069 | + <property name="expand">False</property> |
1070 | + <property name="homogeneous">True</property> |
1071 | + </packing> |
1072 | + </child> |
1073 | + </widget> |
1074 | + <packing> |
1075 | + <property name="expand">False</property> |
1076 | + <property name="fill">False</property> |
1077 | + <property name="position">0</property> |
1078 | + </packing> |
1079 | + </child> |
1080 | + <child> |
1081 | + <widget class="GtkVBox" id="vbox_map"> |
1082 | + <property name="visible">True</property> |
1083 | + <child> |
1084 | + <placeholder/> |
1085 | + </child> |
1086 | + </widget> |
1087 | + <packing> |
1088 | + <property name="position">1</property> |
1089 | + </packing> |
1090 | + </child> |
1091 | + <child> |
1092 | + <widget class="GtkVBox" id="vbox_opt"> |
1093 | + <property name="visible">True</property> |
1094 | + <child> |
1095 | + <widget class="GtkTable" id="tabela_set_task"> |
1096 | + <property name="visible">True</property> |
1097 | + <property name="n_rows">2</property> |
1098 | + <property name="n_columns">2</property> |
1099 | + <child> |
1100 | + <widget class="GtkRadioButton" id="radiobutton1"> |
1101 | + <property name="label" translatable="yes">Associate with new tag</property> |
1102 | + <property name="width_request">198</property> |
1103 | + <property name="visible">True</property> |
1104 | + <property name="can_focus">True</property> |
1105 | + <property name="receives_default">False</property> |
1106 | + <property name="use_underline">True</property> |
1107 | + <property name="draw_indicator">True</property> |
1108 | + </widget> |
1109 | + <packing> |
1110 | + <property name="x_options">GTK_FILL</property> |
1111 | + <property name="y_options"></property> |
1112 | + </packing> |
1113 | + </child> |
1114 | + <child> |
1115 | + <widget class="GtkRadioButton" id="radiobutton2"> |
1116 | + <property name="label" translatable="yes">Associate with existing tag</property> |
1117 | + <property name="visible">True</property> |
1118 | + <property name="can_focus">True</property> |
1119 | + <property name="receives_default">False</property> |
1120 | + <property name="use_underline">True</property> |
1121 | + <property name="draw_indicator">True</property> |
1122 | + <property name="group">radiobutton1</property> |
1123 | + </widget> |
1124 | + <packing> |
1125 | + <property name="top_attach">1</property> |
1126 | + <property name="bottom_attach">2</property> |
1127 | + <property name="x_options">GTK_FILL</property> |
1128 | + <property name="y_options"></property> |
1129 | + </packing> |
1130 | + </child> |
1131 | + <child> |
1132 | + <widget class="GtkEntry" id="txt_new_tag"> |
1133 | + <property name="visible">True</property> |
1134 | + <property name="can_focus">True</property> |
1135 | + <property name="invisible_char">●</property> |
1136 | + </widget> |
1137 | + <packing> |
1138 | + <property name="left_attach">1</property> |
1139 | + <property name="right_attach">2</property> |
1140 | + <property name="y_options"></property> |
1141 | + </packing> |
1142 | + </child> |
1143 | + <child> |
1144 | + <widget class="GtkComboBoxEntry" id="cmb_existing_tag"> |
1145 | + <property name="visible">True</property> |
1146 | + </widget> |
1147 | + <packing> |
1148 | + <property name="left_attach">1</property> |
1149 | + <property name="right_attach">2</property> |
1150 | + <property name="top_attach">1</property> |
1151 | + <property name="bottom_attach">2</property> |
1152 | + <property name="x_options">GTK_FILL</property> |
1153 | + <property name="y_options"></property> |
1154 | + </packing> |
1155 | + </child> |
1156 | + </widget> |
1157 | + <packing> |
1158 | + <property name="position">0</property> |
1159 | + </packing> |
1160 | + </child> |
1161 | + </widget> |
1162 | + <packing> |
1163 | + <property name="expand">False</property> |
1164 | + <property name="fill">False</property> |
1165 | + <property name="padding">2</property> |
1166 | + <property name="position">2</property> |
1167 | + </packing> |
1168 | + </child> |
1169 | + </widget> |
1170 | + <packing> |
1171 | + <property name="expand">False</property> |
1172 | + <property name="fill">False</property> |
1173 | + <property name="position">2</property> |
1174 | + </packing> |
1175 | + </child> |
1176 | + <child internal-child="action_area"> |
1177 | + <widget class="GtkHButtonBox" id="dialog_action_area_btn"> |
1178 | + <property name="visible">True</property> |
1179 | + <property name="layout_style">end</property> |
1180 | + <child> |
1181 | + <widget class="GtkButton" id="btn_cancel"> |
1182 | + <property name="label">gtk-cancel</property> |
1183 | + <property name="response_id">-6</property> |
1184 | + <property name="visible">True</property> |
1185 | + <property name="can_focus">True</property> |
1186 | + <property name="can_default">True</property> |
1187 | + <property name="receives_default">False</property> |
1188 | + <property name="use_stock">True</property> |
1189 | + </widget> |
1190 | + <packing> |
1191 | + <property name="expand">False</property> |
1192 | + <property name="fill">False</property> |
1193 | + <property name="position">0</property> |
1194 | + </packing> |
1195 | + </child> |
1196 | + <child> |
1197 | + <widget class="GtkButton" id="btn_ok"> |
1198 | + <property name="label">gtk-ok</property> |
1199 | + <property name="response_id">-5</property> |
1200 | + <property name="visible">True</property> |
1201 | + <property name="can_focus">True</property> |
1202 | + <property name="can_default">True</property> |
1203 | + <property name="receives_default">False</property> |
1204 | + <property name="use_stock">True</property> |
1205 | + </widget> |
1206 | + <packing> |
1207 | + <property name="expand">False</property> |
1208 | + <property name="fill">False</property> |
1209 | + <property name="position">1</property> |
1210 | + </packing> |
1211 | + </child> |
1212 | + <child> |
1213 | + <widget class="GtkButton" id="btn_close"> |
1214 | + <property name="label" translatable="yes">gtk-close</property> |
1215 | + <property name="visible">True</property> |
1216 | + <property name="can_focus">True</property> |
1217 | + <property name="receives_default">True</property> |
1218 | + <property name="use_stock">True</property> |
1219 | + </widget> |
1220 | + <packing> |
1221 | + <property name="expand">False</property> |
1222 | + <property name="fill">False</property> |
1223 | + <property name="position">2</property> |
1224 | + </packing> |
1225 | + </child> |
1226 | + </widget> |
1227 | + <packing> |
1228 | + <property name="expand">False</property> |
1229 | + <property name="pack_type">end</property> |
1230 | + <property name="position">0</property> |
1231 | + </packing> |
1232 | + </child> |
1233 | + </widget> |
1234 | + </child> |
1235 | + </widget> |
1236 | + <widget class="GtkDialog" id="TagLocation"> |
1237 | + <property name="visible">True</property> |
1238 | + <property name="type_hint">dialog</property> |
1239 | + <child internal-child="vbox"> |
1240 | + <widget class="GtkVBox" id="dialog-vbox3"> |
1241 | + <property name="visible">True</property> |
1242 | + <child> |
1243 | + <widget class="GtkVBox" id="vbox3"> |
1244 | + <property name="visible">True</property> |
1245 | + <child> |
1246 | + <widget class="GtkToolbar" id="toolbar3"> |
1247 | + <property name="visible">True</property> |
1248 | + <property name="toolbar_style">both</property> |
1249 | + <child> |
1250 | + <widget class="GtkToolButton" id="btn_zoom_in"> |
1251 | + <property name="visible">True</property> |
1252 | + <property name="stock_id">gtk-zoom-in</property> |
1253 | + </widget> |
1254 | + <packing> |
1255 | + <property name="expand">False</property> |
1256 | + <property name="homogeneous">True</property> |
1257 | + </packing> |
1258 | + </child> |
1259 | + <child> |
1260 | + <widget class="GtkToolButton" id="btn_zoom_out"> |
1261 | + <property name="visible">True</property> |
1262 | + <property name="stock_id">gtk-zoom-out</property> |
1263 | + </widget> |
1264 | + <packing> |
1265 | + <property name="expand">False</property> |
1266 | + <property name="homogeneous">True</property> |
1267 | + </packing> |
1268 | + </child> |
1269 | + </widget> |
1270 | + <packing> |
1271 | + <property name="expand">False</property> |
1272 | + <property name="fill">False</property> |
1273 | + <property name="position">0</property> |
1274 | + </packing> |
1275 | + </child> |
1276 | + <child> |
1277 | + <widget class="GtkVBox" id="vbox_map"> |
1278 | + <property name="width_request">400</property> |
1279 | + <property name="visible">True</property> |
1280 | + <child> |
1281 | + <placeholder/> |
1282 | + </child> |
1283 | + </widget> |
1284 | + <packing> |
1285 | + <property name="position">1</property> |
1286 | + </packing> |
1287 | + </child> |
1288 | + </widget> |
1289 | + <packing> |
1290 | + <property name="expand">False</property> |
1291 | + <property name="fill">False</property> |
1292 | + <property name="position">2</property> |
1293 | + </packing> |
1294 | + </child> |
1295 | + <child internal-child="action_area"> |
1296 | + <widget class="GtkHButtonBox" id="dialog-action_area3"> |
1297 | + <property name="visible">True</property> |
1298 | + <property name="layout_style">end</property> |
1299 | + <child> |
1300 | + <widget class="GtkButton" id="cancelbutton3"> |
1301 | + <property name="label">gtk-cancel</property> |
1302 | + <property name="response_id">-6</property> |
1303 | + <property name="visible">True</property> |
1304 | + <property name="can_focus">True</property> |
1305 | + <property name="can_default">True</property> |
1306 | + <property name="receives_default">False</property> |
1307 | + <property name="use_stock">True</property> |
1308 | + </widget> |
1309 | + <packing> |
1310 | + <property name="expand">False</property> |
1311 | + <property name="fill">False</property> |
1312 | + <property name="position">0</property> |
1313 | + </packing> |
1314 | + </child> |
1315 | + <child> |
1316 | + <widget class="GtkButton" id="okbutton3"> |
1317 | + <property name="label">gtk-ok</property> |
1318 | + <property name="response_id">-5</property> |
1319 | + <property name="visible">True</property> |
1320 | + <property name="can_focus">True</property> |
1321 | + <property name="can_default">True</property> |
1322 | + <property name="receives_default">False</property> |
1323 | + <property name="use_stock">True</property> |
1324 | + </widget> |
1325 | + <packing> |
1326 | + <property name="expand">False</property> |
1327 | + <property name="fill">False</property> |
1328 | + <property name="position">1</property> |
1329 | + </packing> |
1330 | + </child> |
1331 | + </widget> |
1332 | + <packing> |
1333 | + <property name="expand">False</property> |
1334 | + <property name="pack_type">end</property> |
1335 | + <property name="position">0</property> |
1336 | + </packing> |
1337 | + </child> |
1338 | + </widget> |
1339 | + </child> |
1340 | + </widget> |
1341 | + <widget class="GtkDialog" id="Preferences"> |
1342 | + <property name="width_request">350</property> |
1343 | + <property name="visible">True</property> |
1344 | + <property name="title" translatable="yes">Geolocalized-tasks Preferences</property> |
1345 | + <property name="type_hint">dialog</property> |
1346 | + <child internal-child="vbox"> |
1347 | + <widget class="GtkVBox" id="dialog-vbox4"> |
1348 | + <property name="visible">True</property> |
1349 | + <child> |
1350 | + <widget class="GtkVBox" id="vbox4"> |
1351 | + <property name="visible">True</property> |
1352 | + <child> |
1353 | + <widget class="GtkFrame" id="frame4"> |
1354 | + <property name="visible">True</property> |
1355 | + <property name="border_width">3</property> |
1356 | + <property name="label_xalign">0</property> |
1357 | + <property name="shadow_type">none</property> |
1358 | + <child> |
1359 | + <widget class="GtkAlignment" id="alignment4"> |
1360 | + <property name="visible">True</property> |
1361 | + <property name="left_padding">12</property> |
1362 | + <child> |
1363 | + <widget class="GtkHBox" id="hbox5"> |
1364 | + <property name="visible">True</property> |
1365 | + <child> |
1366 | + <widget class="GtkVBox" id="vbox5"> |
1367 | + <property name="visible">True</property> |
1368 | + <property name="orientation">vertical</property> |
1369 | + <child> |
1370 | + <widget class="GtkCheckButton" id="check_network"> |
1371 | + <property name="label" translatable="yes">Use network</property> |
1372 | + <property name="visible">True</property> |
1373 | + <property name="can_focus">True</property> |
1374 | + <property name="receives_default">False</property> |
1375 | + <property name="use_underline">True</property> |
1376 | + <property name="draw_indicator">True</property> |
1377 | + </widget> |
1378 | + <packing> |
1379 | + <property name="expand">False</property> |
1380 | + <property name="fill">False</property> |
1381 | + <property name="position">0</property> |
1382 | + </packing> |
1383 | + </child> |
1384 | + <child> |
1385 | + <widget class="GtkCheckButton" id="check_cellphone"> |
1386 | + <property name="label" translatable="yes">Use cellphone</property> |
1387 | + <property name="visible">True</property> |
1388 | + <property name="can_focus">True</property> |
1389 | + <property name="receives_default">False</property> |
1390 | + <property name="use_underline">True</property> |
1391 | + <property name="draw_indicator">True</property> |
1392 | + </widget> |
1393 | + <packing> |
1394 | + <property name="expand">False</property> |
1395 | + <property name="fill">False</property> |
1396 | + <property name="position">1</property> |
1397 | + </packing> |
1398 | + </child> |
1399 | + <child> |
1400 | + <widget class="GtkCheckButton" id="check_gps"> |
1401 | + <property name="label" translatable="yes">Use gps</property> |
1402 | + <property name="visible">True</property> |
1403 | + <property name="can_focus">True</property> |
1404 | + <property name="receives_default">False</property> |
1405 | + <property name="use_underline">True</property> |
1406 | + <property name="draw_indicator">True</property> |
1407 | + </widget> |
1408 | + <packing> |
1409 | + <property name="expand">False</property> |
1410 | + <property name="fill">False</property> |
1411 | + <property name="position">2</property> |
1412 | + </packing> |
1413 | + </child> |
1414 | + </widget> |
1415 | + <packing> |
1416 | + <property name="position">0</property> |
1417 | + </packing> |
1418 | + </child> |
1419 | + </widget> |
1420 | + </child> |
1421 | + </widget> |
1422 | + </child> |
1423 | + <child> |
1424 | + <widget class="GtkLabel" id="label6"> |
1425 | + <property name="visible">True</property> |
1426 | + <property name="label" translatable="yes"><b>Location Determination Method</b></property> |
1427 | + <property name="use_markup">True</property> |
1428 | + </widget> |
1429 | + <packing> |
1430 | + <property name="type">label_item</property> |
1431 | + </packing> |
1432 | + </child> |
1433 | + </widget> |
1434 | + <packing> |
1435 | + <property name="position">0</property> |
1436 | + </packing> |
1437 | + </child> |
1438 | + <child> |
1439 | + <widget class="GtkFrame" id="frame5"> |
1440 | + <property name="visible">True</property> |
1441 | + <property name="border_width">3</property> |
1442 | + <property name="label_xalign">0</property> |
1443 | + <property name="shadow_type">none</property> |
1444 | + <child> |
1445 | + <widget class="GtkAlignment" id="alignment5"> |
1446 | + <property name="visible">True</property> |
1447 | + <property name="left_padding">12</property> |
1448 | + <child> |
1449 | + <widget class="GtkHBox" id="hbox3"> |
1450 | + <property name="visible">True</property> |
1451 | + <child> |
1452 | + <widget class="GtkSpinButton" id="spin_proximityfactor"> |
1453 | + <property name="visible">True</property> |
1454 | + <property name="can_focus">True</property> |
1455 | + <property name="invisible_char">●</property> |
1456 | + <property name="adjustment">5 1 100 0.10000000149 10 10</property> |
1457 | + <property name="climb_rate">1</property> |
1458 | + <property name="digits">1</property> |
1459 | + </widget> |
1460 | + <packing> |
1461 | + <property name="expand">False</property> |
1462 | + <property name="fill">False</property> |
1463 | + <property name="position">0</property> |
1464 | + </packing> |
1465 | + </child> |
1466 | + <child> |
1467 | + <widget class="GtkLabel" id="label8"> |
1468 | + <property name="visible">True</property> |
1469 | + <property name="xpad">4</property> |
1470 | + <property name="label" translatable="yes"><small>Distance in kilometers from |
1471 | +the current location.</small></property> |
1472 | + <property name="use_markup">True</property> |
1473 | + </widget> |
1474 | + <packing> |
1475 | + <property name="expand">False</property> |
1476 | + <property name="fill">False</property> |
1477 | + <property name="position">1</property> |
1478 | + </packing> |
1479 | + </child> |
1480 | + </widget> |
1481 | + </child> |
1482 | + </widget> |
1483 | + </child> |
1484 | + <child> |
1485 | + <widget class="GtkLabel" id="label7"> |
1486 | + <property name="visible">True</property> |
1487 | + <property name="label" translatable="yes"><b>Proximity Factor</b></property> |
1488 | + <property name="use_markup">True</property> |
1489 | + </widget> |
1490 | + <packing> |
1491 | + <property name="type">label_item</property> |
1492 | + </packing> |
1493 | + </child> |
1494 | + </widget> |
1495 | + <packing> |
1496 | + <property name="position">1</property> |
1497 | + </packing> |
1498 | + </child> |
1499 | + </widget> |
1500 | + <packing> |
1501 | + <property name="position">2</property> |
1502 | + </packing> |
1503 | + </child> |
1504 | + <child internal-child="action_area"> |
1505 | + <widget class="GtkHButtonBox" id="dialog-action_area4"> |
1506 | + <property name="visible">True</property> |
1507 | + <property name="layout_style">end</property> |
1508 | + <child> |
1509 | + <widget class="GtkButton" id="cancelbutton4"> |
1510 | + <property name="label">gtk-cancel</property> |
1511 | + <property name="response_id">-6</property> |
1512 | + <property name="visible">True</property> |
1513 | + <property name="can_focus">True</property> |
1514 | + <property name="can_default">True</property> |
1515 | + <property name="receives_default">False</property> |
1516 | + <property name="use_stock">True</property> |
1517 | + </widget> |
1518 | + <packing> |
1519 | + <property name="expand">False</property> |
1520 | + <property name="fill">False</property> |
1521 | + <property name="position">0</property> |
1522 | + </packing> |
1523 | + </child> |
1524 | + <child> |
1525 | + <widget class="GtkButton" id="okbutton4"> |
1526 | + <property name="label">gtk-ok</property> |
1527 | + <property name="response_id">-5</property> |
1528 | + <property name="visible">True</property> |
1529 | + <property name="can_focus">True</property> |
1530 | + <property name="can_default">True</property> |
1531 | + <property name="receives_default">False</property> |
1532 | + <property name="use_stock">True</property> |
1533 | + </widget> |
1534 | + <packing> |
1535 | + <property name="expand">False</property> |
1536 | + <property name="fill">False</property> |
1537 | + <property name="position">1</property> |
1538 | + </packing> |
1539 | + </child> |
1540 | + </widget> |
1541 | + <packing> |
1542 | + <property name="expand">False</property> |
1543 | + <property name="pack_type">end</property> |
1544 | + <property name="position">0</property> |
1545 | + </packing> |
1546 | + </child> |
1547 | + </widget> |
1548 | + </child> |
1549 | + </widget> |
1550 | </glade-interface> |
1551 | |
1552 | === modified file 'GTG/plugins/geolocalized_tasks/geolocalized_tasks.py' |
1553 | --- GTG/plugins/geolocalized_tasks/geolocalized_tasks.py 2009-08-05 22:33:44 +0000 |
1554 | +++ GTG/plugins/geolocalized_tasks/geolocalized_tasks.py 2009-08-15 21:33:29 +0000 |
1555 | @@ -34,11 +34,17 @@ |
1556 | from GTG.core.plugins.engine import PluginEngine |
1557 | |
1558 | class geolocalizedTasks: |
1559 | + PLUGIN_NAME = 'Geolocalized Tasks' |
1560 | + PLUGIN_AUTHORS = 'Paulo Cabido <paulo.cabido@gmail.com>' |
1561 | + PLUGIN_VERSION = '0.1' |
1562 | + PLUGIN_DESCRIPTION = 'This plugin adds geolocalized tasks to GTG!.\n \ |
1563 | + WARNING: This plugin is still heavy development.' |
1564 | + |
1565 | + PLUGIN_ENABLED = True |
1566 | |
1567 | def __init__(self): |
1568 | self.geoclue = Geoclue.DiscoverLocation() |
1569 | - self.geoclue.init() |
1570 | - self.location = self.geoclue.get_location_info() |
1571 | + self.geoclue.connect(self.location_changed) |
1572 | |
1573 | self.plugin_path = os.path.dirname(os.path.abspath(__file__)) |
1574 | self.glade_file = os.path.join(self.plugin_path, "geolocalized.glade") |
1575 | @@ -49,16 +55,10 @@ |
1576 | # toolbar button for the new Location view |
1577 | # create the pixbuf with the icon and it's size. |
1578 | # 24,24 is the TaskEditor's toolbar icon size |
1579 | - image_geolocalization_path = os.path.join(self.plugin_path, "icons/hicolor/24x24/geolocalization.png") |
1580 | - pixbuf_geolocalization = gtk.gdk.pixbuf_new_from_file_at_size(image_geolocalization_path, 24, 24) |
1581 | - |
1582 | - image_assign_location_path = os.path.join(self.plugin_path, "icons/hicolor/16x16/assign-location.png") |
1583 | - pixbug_assign_location = gtk.gdk.pixbuf_new_from_file_at_size(image_assign_location_path, 16, 16) |
1584 | - |
1585 | - # create the image and associate the pixbuf |
1586 | - self.icon_geolocalization = gtk.Image() |
1587 | - self.icon_geolocalization.set_from_pixbuf(pixbuf_geolocalization) |
1588 | - self.icon_geolocalization.show() |
1589 | + image_assign_location_path = os.path.join(self.plugin_path,\ |
1590 | + "icons/hicolor/16x16/assign-location.png") |
1591 | + pixbug_assign_location = gtk.gdk.pixbuf_new_from_file_at_size(image_assign_location_path,\ |
1592 | + 16, 16) |
1593 | |
1594 | image_assign_location = gtk.Image() |
1595 | image_assign_location.set_from_pixbuf(pixbug_assign_location) |
1596 | @@ -69,21 +69,28 @@ |
1597 | self.context_item.set_image(image_assign_location) |
1598 | # TODO: add a short cut to the menu |
1599 | |
1600 | - # toolbar button for the location_view |
1601 | - self.btn_location_view = gtk.ToggleToolButton() |
1602 | - self.btn_location_view.set_icon_widget(self.icon_geolocalization) |
1603 | - self.btn_location_view.set_label("Location View") |
1604 | - |
1605 | self.PROXIMITY_FACTOR = 5 # 5 km |
1606 | - self.LOCATION_ACCURACY = 3 # Locality |
1607 | - self.LOCATION_DETERMINATION_METHOD = ["network", "gps", "cellphone"] |
1608 | - #for provider in self.geoclue.get_available_providers(): |
1609 | - # if provider['position'] and (provider['provider'] != "Example Provider" and provider['provider'] != "Plazes"): |
1610 | - # self.LOCATION_DETERMINATION_METHOD.append(provider["provider"]) |
1611 | - |
1612 | + #self.LOCATION_ACCURACY = 3 # Locality |
1613 | + self.LOCATION_DETERMINATION_METHOD = [] # "network", "gps", "cellphone" |
1614 | |
1615 | + for provider in self.geoclue.get_available_providers(): |
1616 | + if provider['name'].lower() == "hostip": |
1617 | + if self.geoclue.provider_status(provider['object']) == "available" or\ |
1618 | + self.geoclue.provider_status(provider['object']) == "acquiring": |
1619 | + self.LOCATION_DETERMINATION_METHOD.append("network") |
1620 | + elif provider['name'].lower() == "gpsd" or provider['name'].lower() == "gypsy": |
1621 | + if self.geoclue.provider_status(provider['object']) == "available" or\ |
1622 | + self.geoclue.provider_status(provider['object']) == "acquiring": |
1623 | + self.LOCATION_DETERMINATION_METHOD.append("gps") |
1624 | + elif provider['name'].lower() == "gsmloc": |
1625 | + if self.geoclue.provider_status(provider['object']) == "available" or\ |
1626 | + self.geoclue.provider_status(provider['object']) == "acquiring": |
1627 | + self.LOCATION_DETERMINATION_METHOD.append("cellphone") |
1628 | + |
1629 | |
1630 | def activate(self, plugin_api): |
1631 | + self.plugin_api = plugin_api |
1632 | + |
1633 | self.menu_item.connect('activate', self.on_geolocalized_preferences, plugin_api) |
1634 | plugin_api.add_menu_item(self.menu_item) |
1635 | |
1636 | @@ -95,15 +102,74 @@ |
1637 | if self.config.has_key("geolocalized-tasks"): |
1638 | if self.config["geolocalized-tasks"].has_key("proximity_factor"): |
1639 | self.PROXIMITY_FACTOR = self.config["geolocalized-tasks"]["proximity_factor"] |
1640 | - |
1641 | - if self.config["geolocalized-tasks"].has_key("accuracy"): |
1642 | - self.LOCATION_ACCURACY = self.config["geolocalized-tasks"]["accuracy"] |
1643 | |
1644 | if self.config["geolocalized-tasks"].has_key("location_determination_method"): |
1645 | - self.LOCATION_DETERMINATION_METHOD = self.config["geolocalized-tasks"]["location_determination_method"] |
1646 | - |
1647 | - # filter the tasks location for the workview |
1648 | - self.filter_workview_by_location(plugin_api) |
1649 | + self.LOCATION_DETERMINATION_METHOD =\ |
1650 | + self.config["geolocalized-tasks"]["location_determination_method"] |
1651 | + |
1652 | + providers = self.geoclue.get_available_providers() |
1653 | + provider_name_list = [] |
1654 | + |
1655 | + for provider in providers: |
1656 | + provider_name_list.append(provider['name'].lower()) |
1657 | + |
1658 | + # verify the location determination method |
1659 | + for method in self.LOCATION_DETERMINATION_METHOD: |
1660 | + if method == "network": |
1661 | + if "hostip" in provider_name_list: |
1662 | + for provider in providers: |
1663 | + if provider['name'].lower() == "hostip": |
1664 | + if self.geoclue.provider_status(provider['object']) == "error" or\ |
1665 | + self.geoclue.provider_status(provider['object']) == "unavailable": |
1666 | + if "network" in self.LOCATION_DETERMINATION_METHOD: |
1667 | + self.LOCATION_DETERMINATION_METHOD.remove("network") |
1668 | + break |
1669 | + else: |
1670 | + self.LOCATION_DETERMINATION_METHOD.remove("network") |
1671 | + elif method == "gps": |
1672 | + if "gpsd" in provider_name_list or "gypsy" in provider_name_list: |
1673 | + for provider in providers: |
1674 | + if provider['name'].lower() == "gpsd" or provider['name'].lower() == "gypsy": |
1675 | + if self.geoclue.provider_status(provider['object']) == "error" or\ |
1676 | + self.geoclue.provider_status(provider['object']) == "unavailable": |
1677 | + if "gps" in self.LOCATION_DETERMINATION_METHOD: |
1678 | + self.LOCATION_DETERMINATION_METHOD.remove("gps") |
1679 | + break |
1680 | + else: |
1681 | + self.LOCATION_DETERMINATION_METHOD.remove("gps") |
1682 | + elif method == "cellphone": |
1683 | + if "gsmloc" in provider_name_list: |
1684 | + for provider in providers: |
1685 | + if provider['name'].lower() == "gsmloc": |
1686 | + if self.geoclue.provider_status(provider['object']) == "error" or\ |
1687 | + self.geoclue.provider_status(provider['object']) == "unavailable": |
1688 | + if "cellphone" in self.LOCATION_DETERMINATION_METHOD: |
1689 | + self.LOCATION_DETERMINATION_METHOD.remove("cellphone") |
1690 | + break |
1691 | + else: |
1692 | + self.LOCATION_DETERMINATION_METHOD.remove("cellphone") |
1693 | + |
1694 | + try: |
1695 | + if len(self.LOCATION_DETERMINATION_METHOD) == 1 and\ |
1696 | + "network" in self.LOCATION_DETERMINATION_METHOD: |
1697 | + self.geoclue.init() |
1698 | + elif len(self.LOCATION_DETERMINATION_METHOD) == 1 and\ |
1699 | + "cellphone" in self.LOCATION_DETERMINATION_METHOD: |
1700 | + self.geoclue.init(resource=(1 << 1)) |
1701 | + elif len(self.LOCATION_DETERMINATION_METHOD) == 1 and\ |
1702 | + "gps" in self.LOCATION_DETERMINATION_METHOD: |
1703 | + self.geoclue.init(resource=(1 << 2)) |
1704 | + else: |
1705 | + self.geoclue.init(resource=((1 << 10) - 1)) |
1706 | + except Exception, e: |
1707 | + self.geoclue.init(resource=0) |
1708 | + |
1709 | + |
1710 | + self.location = self.geoclue.get_location_info() |
1711 | + self.location_filter = [] |
1712 | + |
1713 | + # registers the filter callback method |
1714 | + plugin_api.register_filter_cb(self.task_location_filter) |
1715 | |
1716 | def deactivate(self, plugin_api): |
1717 | plugin_api.remove_menu_item(self.menu_item) |
1718 | @@ -112,10 +178,35 @@ |
1719 | |
1720 | self.config["geolocalized-tasks"] = {} |
1721 | self.config["geolocalized-tasks"]["proximity_factor"] = self.PROXIMITY_FACTOR |
1722 | - self.config["geolocalized-tasks"]["accuracy"] = self.LOCATION_ACCURACY |
1723 | - self.config["geolocalized-tasks"]["location_determination_method"] = self.LOCATION_DETERMINATION_METHOD |
1724 | + self.config["geolocalized-tasks"]["location_determination_method"] =\ |
1725 | + self.LOCATION_DETERMINATION_METHOD |
1726 | + |
1727 | + # remove the filters |
1728 | + for tid in self.location_filter: |
1729 | + plugin_api.remove_task_from_filter(tid) |
1730 | + |
1731 | + # unregister the filter callback |
1732 | + plugin_api.unregister_filter_cb(self.task_location_filter) |
1733 | + |
1734 | + |
1735 | |
1736 | def onTaskOpened(self, plugin_api): |
1737 | + image_geolocalization_path = os.path.join(self.plugin_path,\ |
1738 | + "icons/hicolor/24x24/geolocalization.png") |
1739 | + pixbuf_geolocalization = gtk.gdk.pixbuf_new_from_file_at_size(image_geolocalization_path, |
1740 | + 24, |
1741 | + 24) |
1742 | + |
1743 | + # create the image and associate the pixbuf |
1744 | + self.icon_geolocalization = gtk.Image() |
1745 | + self.icon_geolocalization.set_from_pixbuf(pixbuf_geolocalization) |
1746 | + self.icon_geolocalization.show() |
1747 | + |
1748 | + # toolbar button for the location_view |
1749 | + self.btn_location_view = gtk.ToggleToolButton() |
1750 | + self.btn_location_view.set_icon_widget(self.icon_geolocalization) |
1751 | + self.btn_location_view.set_label("Location View") |
1752 | + |
1753 | plugin_api.add_task_toolbar_item(gtk.SeparatorToolItem()) |
1754 | |
1755 | btn_set_location = gtk.ToolButton() |
1756 | @@ -124,34 +215,70 @@ |
1757 | btn_set_location.connect('clicked', self.set_task_location, plugin_api) |
1758 | plugin_api.add_task_toolbar_item(btn_set_location) |
1759 | |
1760 | - # the task location filter |
1761 | - def filter_workview_by_location(self, plugin_api): |
1762 | - # TODO: if the location has a delay in being calculated it may not exist at |
1763 | - # this point |
1764 | - if self.location.has_key("latitude") and self.location.has_key("longitude"): |
1765 | - tasks = plugin_api.get_all_tasks() |
1766 | - |
1767 | - tasks_with_location = [] |
1768 | - tasks_without_location = [] |
1769 | - |
1770 | - for tid in tasks: |
1771 | - task = plugin_api.get_task(tid) |
1772 | + def location_changed(self): |
1773 | + # TODO: This should refresh the task ang tag list |
1774 | + # update the location |
1775 | + self.location = self.geoclue.get_location_info() |
1776 | + # reset the filters |
1777 | + self.location_filter = [] |
1778 | + |
1779 | + # filters by location only one task |
1780 | + def task_location_filter(self, tid): |
1781 | + has_location = False |
1782 | + task = self.plugin_api.get_task(tid) |
1783 | + if task.get_status() == "Active": |
1784 | + if task.is_workable(): |
1785 | tags = task.get_tags() |
1786 | + |
1787 | + #check if it has the location set |
1788 | for tag in tags: |
1789 | if "location" in tag.get_all_attributes(): |
1790 | - tasks_with_location.append(task) |
1791 | - else: |
1792 | - tasks_without_location.append(task) |
1793 | + has_location = True |
1794 | |
1795 | - for task in tasks_with_location: |
1796 | - if task.is_workable(): |
1797 | - tags = task.get_tags() |
1798 | + if has_location: |
1799 | + # do the actual filter |
1800 | for tag in tags: |
1801 | - if tag.get_attribute("location"): |
1802 | - position = eval(tag.get_attribute("location")) |
1803 | - if not self.geoclue.compare_position(position[0], position[1], float(self.PROXIMITY_FACTOR)): |
1804 | - plugin_api.add_task_to_workview_filter(task.get_id()) |
1805 | - |
1806 | + if tag.get_attribute("location"): |
1807 | + position = eval(tag.get_attribute("location")) |
1808 | + if not self.geoclue.compare_position(position[0], |
1809 | + position[1], |
1810 | + float(self.PROXIMITY_FACTOR) |
1811 | + ): |
1812 | + self.plugin_api.add_task_to_filter(tid) |
1813 | + if tid not in self.location_filter: |
1814 | + self.location_filter.append(tid) |
1815 | + return False |
1816 | + return True |
1817 | + |
1818 | + |
1819 | + # the task location filter (for all tasks) |
1820 | + # DEPRECATED |
1821 | + #def filter_workview_by_location(self): |
1822 | + # if self.location.has_key("latitude") and self.location.has_key("longitude"): |
1823 | + # # TODO: if the location has a delay in being calculated it may not exist at |
1824 | + # # this point |
1825 | + # tasks = self.plugin_api.get_all_tasks() |
1826 | + # |
1827 | + # tasks_with_location = [] |
1828 | + # tasks_without_location = [] |
1829 | + # |
1830 | + # for tid in tasks: |
1831 | + # task = self.plugin_api.get_task(tid) |
1832 | + # tags = task.get_tags() |
1833 | + # for tag in tags: |
1834 | + # if "location" in tag.get_all_attributes(): |
1835 | + # tasks_with_location.append(task) |
1836 | + # else: |
1837 | + # tasks_without_location.append(task) |
1838 | + # |
1839 | + # for task in tasks_with_location: |
1840 | + # if task.is_workable(): |
1841 | + # tags = task.get_tags() |
1842 | + # for tag in tags: |
1843 | + # if tag.get_attribute("location"): |
1844 | + # position = eval(tag.get_attribute("location")) |
1845 | + # if not self.geoclue.compare_position(position[0], position[1], float(self.PROXIMITY_FACTOR)): |
1846 | + # self.plugin_api.add_task_to_filter(task.get_id()) |
1847 | |
1848 | #=== GEOLOCALIZED PREFERENCES=================================================== |
1849 | def on_geolocalized_preferences(self, widget, plugin_api): |
1850 | @@ -160,27 +287,92 @@ |
1851 | dialog.connect("response", self.preferences_close) |
1852 | plugin_api.set_parent_window(dialog) |
1853 | |
1854 | - cmb_accuracy = wTree.get_widget("cmb_accuracy") |
1855 | - for i in range(len(cmb_accuracy.get_model())): |
1856 | - if str(self.accuracy_to_value(cmb_accuracy.get_model()[i][0])) == str(self.LOCATION_ACCURACY): |
1857 | - cmb_accuracy.set_active(i) |
1858 | - cmb_accuracy.connect("changed", self.cmb_accuracy_changed) |
1859 | - self.tmp_location_accuracy = self.LOCATION_ACCURACY |
1860 | - |
1861 | check_network = wTree.get_widget("check_network") |
1862 | check_cellphone = wTree.get_widget("check_cellphone") |
1863 | check_gps = wTree.get_widget("check_gps") |
1864 | |
1865 | - if "network" in self.LOCATION_DETERMINATION_METHOD: |
1866 | - check_network.set_active(True) |
1867 | - |
1868 | - if "cellphone" in self.LOCATION_DETERMINATION_METHOD: |
1869 | - check_cellphone.set_active(True) |
1870 | - |
1871 | - if "gps" in self.LOCATION_DETERMINATION_METHOD: |
1872 | - check_gps.set_active(True) |
1873 | - |
1874 | - |
1875 | + providers = self.geoclue.get_available_providers() |
1876 | + provider_name_list = [] |
1877 | + |
1878 | + for provider in providers: |
1879 | + provider_name_list.append(provider['name'].lower()) |
1880 | + |
1881 | + if "hostip" not in provider_name_list: |
1882 | + check_network.set_active(False) |
1883 | + check_network.set_sensitive(False) |
1884 | + else: |
1885 | + if "network" in self.LOCATION_DETERMINATION_METHOD: |
1886 | + for provider in providers: |
1887 | + if provider['name'].lower() == "hostip": |
1888 | + if self.geoclue.provider_status(provider['object']) == "available" or\ |
1889 | + self.geoclue.provider_status(provider['object']) == "acquiring": |
1890 | + check_network.set_active(True) |
1891 | + break |
1892 | + else: |
1893 | + check_network.set_active(False) |
1894 | + check_network.set_sensitive(False) |
1895 | + break |
1896 | + else: |
1897 | + for provider in providers: |
1898 | + if provider['name'].lower() == "hostip": |
1899 | + if self.geoclue.provider_status(provider['object']) == "error" or\ |
1900 | + self.geoclue.provider_status(provider['object']) == "unavailable": |
1901 | + check_network.set_active(False) |
1902 | + check_network.set_sensitive(False) |
1903 | + break |
1904 | + |
1905 | + if "gsmloc" not in provider_name_list: |
1906 | + check_cellphone.set_active(False) |
1907 | + check_cellphone.set_sensitive(False) |
1908 | + else: |
1909 | + if "cellphone" in self.LOCATION_DETERMINATION_METHOD: |
1910 | + for provider in providers: |
1911 | + if provider['name'].lower() == "gsmloc": |
1912 | + if self.geoclue.provider_status(provider['object']) == "available" or\ |
1913 | + self.geoclue.provider_status(provider['object']) == "acquiring": |
1914 | + check_cellphone.set_active(True) |
1915 | + break |
1916 | + else: |
1917 | + check_cellphone.set_active(False) |
1918 | + check_cellphone.set_sensitive(False) |
1919 | + break |
1920 | + else: |
1921 | + for provider in providers: |
1922 | + if provider['name'].lower() == "gsmloc": |
1923 | + if self.geoclue.provider_status(provider['object']) == "error" or\ |
1924 | + self.geoclue.provider_status(provider['object']) == "unavailable": |
1925 | + check_cellphone.set_active(False) |
1926 | + check_cellphone.set_sensitive(False) |
1927 | + break |
1928 | + |
1929 | + # TODO: separate gypsy from gpsd |
1930 | + if "gpsd" not in provider_name_list: |
1931 | + if "gypsy" not in provider_name_list: |
1932 | + check_gps.set_active(False) |
1933 | + check_gps.set_sensitive(False) |
1934 | + else: |
1935 | + if "gps" in self.LOCATION_DETERMINATION_METHOD: |
1936 | + for provider in providers: |
1937 | + if provider['name'].lower() == "gpsd" or\ |
1938 | + provider['name'].lower() == "gypsy": |
1939 | + if self.geoclue.provider_status(provider['object']) == "available" or\ |
1940 | + self.geoclue.provider_status(provider['object']) == "acquiring": |
1941 | + check_gps.set_active(True) |
1942 | + break |
1943 | + else: |
1944 | + check_gps.set_active(False) |
1945 | + check_gps.set_sensitive(False) |
1946 | + break |
1947 | + else: |
1948 | + for provider in providers: |
1949 | + if provider['name'].lower() == "gpsd" or\ |
1950 | + provider['name'].lower() == "gypsy": |
1951 | + if self.geoclue.provider_status(provider['object']) == "error" or\ |
1952 | + self.geoclue.provider_status(provider['object']) == "unavailable": |
1953 | + check_gps.set_active(False) |
1954 | + check_gps.set_sensitive(False) |
1955 | + break |
1956 | + |
1957 | spin_proximityfactor = wTree.get_widget("spin_proximityfactor") |
1958 | spin_proximityfactor.set_value(float(self.PROXIMITY_FACTOR)) |
1959 | spin_proximityfactor.connect("changed", self.spin_proximityfactor_changed) |
1960 | @@ -188,53 +380,11 @@ |
1961 | |
1962 | dialog.show_all() |
1963 | |
1964 | - # converts the accuracy to a value |
1965 | - def accuracy_to_value(self, accuracy): |
1966 | - if not accuracy: |
1967 | - return 0 |
1968 | - elif accuracy.lower() == "Country".lower(): |
1969 | - return 1 |
1970 | - elif accuracy.lower() == "Region".lower(): |
1971 | - return 2 |
1972 | - elif accuracy.lower() == "Locality".lower(): |
1973 | - return 3 |
1974 | - elif accuracy.lower() == "Postalcode".lower(): |
1975 | - return 4 |
1976 | - elif accuracy.lower() == "Street".lower(): |
1977 | - return 5 |
1978 | - elif accuracy.lower() == "Detailed".lower(): |
1979 | - return 6 |
1980 | - return 0 |
1981 | - |
1982 | - # converts the value of a accuracy to the accuracy |
1983 | - def value_to_accuracy(self, value): |
1984 | - if not value: |
1985 | - return None |
1986 | - elif value == 1: |
1987 | - return "Country" |
1988 | - elif value == 2: |
1989 | - return "Region" |
1990 | - elif value == 3: |
1991 | - return "Locality" |
1992 | - elif value == 4: |
1993 | - return "Postalcode" |
1994 | - elif value == 5: |
1995 | - return "Street" |
1996 | - elif value == 6: |
1997 | - return "Detailed" |
1998 | - return None |
1999 | - |
2000 | - def cmb_accuracy_changed(self, comboboxentry): |
2001 | - index = comboboxentry.get_active() |
2002 | - model = comboboxentry.get_model() |
2003 | - self.tmp_location_accuracy = self.accuracy_to_value(model[index][0]) |
2004 | - |
2005 | def spin_proximityfactor_changed(self, spinbutton): |
2006 | self.tmp_proximityfactor = spinbutton.get_value() |
2007 | |
2008 | def preferences_close(self, dialog, response=None): |
2009 | - if response == gtk.RESPONSE_OK: |
2010 | - self.LOCATION_ACCURACY = self.tmp_location_accuracy |
2011 | + if response == gtk.RESPONSE_OK: |
2012 | self.PROXIMITY_FACTOR = float(self.tmp_proximityfactor) |
2013 | dialog.destroy() |
2014 | else: |
2015 | @@ -244,22 +394,25 @@ |
2016 | |
2017 | #=== SET TASK LOCATION ========================================================= |
2018 | def set_task_location(self, widget, plugin_api, location=None): |
2019 | - location = self.geoclue.get_location_info() |
2020 | - self.plugin_api = plugin_api |
2021 | - |
2022 | wTree = gtk.glade.XML(self.glade_file, "SetTaskLocation") |
2023 | dialog = wTree.get_widget("SetTaskLocation") |
2024 | - self.plugin_api.set_parent_window(dialog) |
2025 | + plugin_api.set_parent_window(dialog) |
2026 | |
2027 | btn_zoom_in = wTree.get_widget("btn_zoom_in") |
2028 | btn_zoom_out = wTree.get_widget("btn_zoom_out") |
2029 | |
2030 | + dialog_action_area_btn = wTree.get_widget("dialog_action_area_btn") |
2031 | + btn_ok = wTree.get_widget("btn_ok") |
2032 | + btn_cancel = wTree.get_widget("btn_cancel") |
2033 | + btn_close = wTree.get_widget("btn_close") |
2034 | + |
2035 | self.radiobutton1 = wTree.get_widget("radiobutton1") |
2036 | self.radiobutton2 = wTree.get_widget("radiobutton2") |
2037 | self.txt_new_tag = wTree.get_widget("txt_new_tag") |
2038 | self.cmb_existing_tag = wTree.get_widget("cmb_existing_tag") |
2039 | |
2040 | tabela = wTree.get_widget("tabela_set_task") |
2041 | + |
2042 | vbox_map = wTree.get_widget("vbox_map") |
2043 | vbox_opt = wTree.get_widget("vbox_opt") |
2044 | |
2045 | @@ -306,11 +459,18 @@ |
2046 | # Possibility, use a color from another tag |
2047 | pass |
2048 | |
2049 | - self.marker_list.append(layer.add_marker(plugin_api.get_task_title(), tag['location'][0], tag['location'][1], color)) |
2050 | + self.marker_list.append(layer.add_marker(plugin_api.get_task_title(), |
2051 | + tag['location'][0], |
2052 | + tag['location'][1], |
2053 | + color) |
2054 | + ) |
2055 | else: |
2056 | try: |
2057 | - if location['longitude'] and location['latitude']: |
2058 | - self.marker_list.append(layer.add_marker(plugin_api.get_task_title(), location['latitude'], location['longitude'])) |
2059 | + if self.location['longitude'] and self.location['latitude']: |
2060 | + self.marker_list.append(layer.add_marker(plugin_api.get_task_title(), |
2061 | + self.location['latitude'], |
2062 | + self.location['longitude']) |
2063 | + ) |
2064 | except: |
2065 | self.marker_list.append(layer.add_marker(plugin_api.get_task_title(), None, None)) |
2066 | |
2067 | @@ -322,13 +482,15 @@ |
2068 | if not task_has_location: |
2069 | # method that will change the marker's position |
2070 | champlain_view.set_reactive(True) |
2071 | - champlain_view.connect("button-release-event", self.champlain_change_marker, champlain_view) |
2072 | + champlain_view.connect("button-release-event",\ |
2073 | + self.champlain_change_marker,\ |
2074 | + champlain_view) |
2075 | |
2076 | layer.show_all() |
2077 | |
2078 | if task_has_location: |
2079 | champlain_view.set_property("zoom-level", 9) |
2080 | - elif location: |
2081 | + elif self.location: |
2082 | champlain_view.set_property("zoom-level", 5) |
2083 | else: |
2084 | champlain_view.set_property("zoom-level", 1) |
2085 | @@ -343,7 +505,15 @@ |
2086 | # connect the toolbar buttons for zoom |
2087 | btn_zoom_in.connect("clicked", self.zoom_in, champlain_view) |
2088 | btn_zoom_out.connect("clicked", self.zoom_out, champlain_view) |
2089 | - dialog.connect("response", self.set_task_location_close) |
2090 | + |
2091 | + if task_has_location: |
2092 | + dialog_action_area_btn.remove(btn_ok) |
2093 | + dialog_action_area_btn.remove(btn_cancel) |
2094 | + dialog.connect("response", self.task_location_close) |
2095 | + else: |
2096 | + dialog_action_area_btn.remove(btn_close) |
2097 | + # show a close button or the ok/cancel |
2098 | + dialog.connect("response", self.set_task_location_close, plugin_api) |
2099 | |
2100 | #if there is no location set, we want to set it |
2101 | if not task_has_location: |
2102 | @@ -376,12 +546,15 @@ |
2103 | champlain_view.center_on(marker_position[0], marker_position[1]) |
2104 | else: |
2105 | try: |
2106 | - if location['longitude'] and location['latitude']: |
2107 | - champlain_view.center_on(location['latitude'], location['longitude']) |
2108 | + if self.location['longitude'] and self.location['latitude']: |
2109 | + champlain_view.center_on(self.location['latitude'], self.location['longitude']) |
2110 | except: |
2111 | pass |
2112 | |
2113 | - def set_task_location_close(self, dialog, response=None): |
2114 | + def task_location_close(self, dialog, response=None): |
2115 | + dialog.destroy() |
2116 | + |
2117 | + def set_task_location_close(self, dialog, response=None, plugin_api=None): |
2118 | if response == gtk.RESPONSE_OK: |
2119 | # ok |
2120 | # tries to get the radiobuttons value, witch may not exist |
2121 | @@ -393,29 +566,30 @@ |
2122 | |
2123 | # because users sometimes make mistakes, I'll check if the tag exists |
2124 | tmp_tag = "" |
2125 | - for tag in self.plugin_api.get_tags(): |
2126 | + for tag in plugin_api.get_tags(): |
2127 | t = "@" + self.txt_new_tag.get_text().replace("@", "") |
2128 | if tag.get_attribute("name") == t: |
2129 | tmp_tag = t |
2130 | if tmp_tag: |
2131 | - self.plugin_api.add_tag_attribute(self.txt_new_tag.get_text().replace("@", ""), |
2132 | + plugin_api.add_tag_attribute(self.txt_new_tag.get_text().replace("@", ""), |
2133 | "location", |
2134 | marker_position) |
2135 | else: |
2136 | - self.plugin_api.add_tag(self.txt_new_tag.get_text().replace("@", "")) |
2137 | - self.plugin_api.add_tag_attribute("@" + self.txt_new_tag.get_text().replace("@", ""), |
2138 | + plugin_api.insert_tag(self.txt_new_tag.get_text().replace("@", "")) |
2139 | + plugin_api.add_tag_attribute("@" + self.txt_new_tag.get_text().replace("@", ""), |
2140 | "location", |
2141 | marker_position) |
2142 | dialog.destroy() |
2143 | else: |
2144 | - self.errorDialog(dialog, "Error: No tag defined", "The tag has to be defined so that the location can be associated with it.") |
2145 | + # does nothing, no tag set. |
2146 | + pass |
2147 | else: |
2148 | # radiobutton2 |
2149 | marker_position = (self.marker_list[0].get_property('latitude'), self.marker_list[0].get_property('longitude')) |
2150 | index = self.cmb_existing_tag.get_active() |
2151 | model = self.cmb_existing_tag.get_model() |
2152 | - self.plugin_api.add_tag_attribute(model[index][0], "location", marker_position) |
2153 | - dialog.destroy() |
2154 | + plugin_api.add_tag_attribute(model[index][0], "location", marker_position) |
2155 | + dialog.destroy() |
2156 | else: |
2157 | # cancel |
2158 | dialog.destroy() |
2159 | @@ -430,19 +604,16 @@ |
2160 | #=== SET TASK LOCATION ========================================================= |
2161 | |
2162 | #=== TAG VIEW CONTEXT MENU ===================================================== |
2163 | - def on_contextmenu_tag_location(self, widget, plugin_api): |
2164 | - location = self.geoclue.get_location_info() |
2165 | - self.plugin_api_context = plugin_api |
2166 | - |
2167 | + def on_contextmenu_tag_location(self, widget, plugin_api): |
2168 | wTree = gtk.glade.XML(self.glade_file, "TagLocation") |
2169 | dialog = wTree.get_widget("TagLocation") |
2170 | - self.plugin_api_context.set_parent_window(dialog) |
2171 | + plugin_api.set_parent_window(dialog) |
2172 | |
2173 | btn_zoom_in = wTree.get_widget("btn_zoom_in") |
2174 | btn_zoom_out = wTree.get_widget("btn_zoom_out") |
2175 | vbox_map = wTree.get_widget("vbox_map") |
2176 | |
2177 | - tag = self.plugin_api_context.get_tagpopup_tag() |
2178 | + tag = plugin_api.get_tagpopup_tag() |
2179 | dialog.set_title(tag.get_attribute("name") + "'s Location") |
2180 | |
2181 | # get the tag's location |
2182 | @@ -467,8 +638,8 @@ |
2183 | marker_tag = layer.add_marker(tag.get_attribute("name"), tag_location[0], tag_location[1], tag_color) |
2184 | else: |
2185 | try: |
2186 | - if location['longitude'] and location['latitude']: |
2187 | - marker_tag = layer.add_marker(tag.get_attribute("name"), location['latitude'], location['longitude'], tag_color) |
2188 | + if self.location['longitude'] and self.location['latitude']: |
2189 | + marker_tag = layer.add_marker(tag.get_attribute("name"), self.location['latitude'], self.location['longitude'], tag_color) |
2190 | except: |
2191 | marker_tag = layer.add_marker(tag.get_attribute("name"), None, None) |
2192 | |
2193 | @@ -484,7 +655,7 @@ |
2194 | |
2195 | if tag_location: |
2196 | champlain_view.set_property("zoom-level", 9) |
2197 | - elif location: |
2198 | + elif self.location: |
2199 | champlain_view.set_property("zoom-level", 5) |
2200 | else: |
2201 | champlain_view.set_property("zoom-level", 1) |
2202 | @@ -508,8 +679,8 @@ |
2203 | champlain_view.center_on(marker_position[0], marker_position[1]) |
2204 | else: |
2205 | try: |
2206 | - if location['longitude'] and location['latitude']: |
2207 | - champlain_view.center_on(location['latitude'], location['longitude']) |
2208 | + if self.location['longitude'] and self.location['latitude']: |
2209 | + champlain_view.center_on(self.location['latitude'], self.location['longitude']) |
2210 | except: |
2211 | pass |
2212 | |
2213 | @@ -547,19 +718,4 @@ |
2214 | r, g, b = colorstring[:2], colorstring[2:4], colorstring[4:] |
2215 | r, g, b = [int(n, 16) for n in (r, g, b)] |
2216 | return clutter.Color(r, g, b) |
2217 | - |
2218 | - # error dialog |
2219 | - def errorDialog(self, parent, header, msg): |
2220 | - """ |
2221 | - Show an error message. |
2222 | - """ |
2223 | - |
2224 | - dialog = gtk.MessageDialog(parent, |
2225 | - flags=gtk.DIALOG_MODAL, |
2226 | - type=gtk.MESSAGE_ERROR, |
2227 | - buttons=gtk.BUTTONS_CLOSE) |
2228 | - dialog.set_title("") |
2229 | - dialog.set_markup("<big><b>%s</b></big>\n\n%s" % (header, msg)) |
2230 | - dialog.realize() |
2231 | - dialog.run() |
2232 | - dialog.destroy() |
2233 | \ No newline at end of file |
2234 | + |
2235 | \ No newline at end of file |
2236 | |
2237 | === modified file 'GTG/taskbrowser/browser.py' |
2238 | --- GTG/taskbrowser/browser.py 2009-08-11 11:15:14 +0000 |
2239 | +++ GTG/taskbrowser/browser.py 2009-08-11 12:19:20 +0000 |
2240 | @@ -142,8 +142,8 @@ |
2241 | self.priv["ctasklist"]["sort_order"] = gtk.SORT_ASCENDING |
2242 | self.priv['selected_rows'] = None |
2243 | self.priv['workview'] = False |
2244 | - #self.priv['noteview'] = False |
2245 | - self.priv['workview_task_filter'] = [] |
2246 | + #self.priv['noteview'] = False |
2247 | + self.priv['filter_cbs'] = [] |
2248 | |
2249 | def _init_icon_theme(self): |
2250 | icon_dirs = [GTG.DATA_DIR, os.path.join(GTG.DATA_DIR, "icons")] |
2251 | @@ -437,8 +437,8 @@ |
2252 | self.plugins = self.pengine.LoadPlugins() |
2253 | |
2254 | # initializes the plugin api class |
2255 | - self.plugin_api = PluginAPI(self.window, self.config, self.wTree, self.req, \ |
2256 | - self.task_tv, self.priv['workview_task_filter'], \ |
2257 | + self.plugin_api = PluginAPI(self.window, self.config, self.wTree,\ |
2258 | + self.req, self.task_tv, self.priv['filter_cbs'],\ |
2259 | self.tagpopup, self.tags_tv, None, None) |
2260 | |
2261 | if self.plugins: |
2262 | @@ -737,15 +737,19 @@ |
2263 | """ |
2264 | |
2265 | tag_list, notag_only = self.get_selected_tags() |
2266 | - |
2267 | - if task in self.priv['workview_task_filter']: |
2268 | - return False |
2269 | |
2270 | if not task.has_tags(tag_list=tag_list, notag_only=notag_only): |
2271 | return False |
2272 | |
2273 | if self.priv['workview']: |
2274 | res = True |
2275 | + |
2276 | + # filter tasks view callbacks |
2277 | + for cb in self.priv['filter_cbs']: |
2278 | + res = cb(task.get_id()) |
2279 | + if res == False: |
2280 | + return False |
2281 | + |
2282 | for t in task.get_tags(): |
2283 | if t.get_attribute("nonworkview"): |
2284 | res = res and (not eval(t.get_attribute("nonworkview"))) |
2285 | @@ -867,6 +871,14 @@ |
2286 | ### SIGNAL CALLBACKS ########################################################## |
2287 | # Typically, reaction to user input & interactions with the GUI |
2288 | # |
2289 | + def register_filter_callback(self, cb): |
2290 | + if cb not in self.priv['filter_cbs']: |
2291 | + self.priv['filter_cbs'].append(cb) |
2292 | + |
2293 | + def unregister_filter_callback(self, cb): |
2294 | + if cb in self.priv['filter_cbs']: |
2295 | + self.priv['filter_cbs'].remove(cb) |
2296 | + |
2297 | def on_move(self, widget, data): |
2298 | xpos, ypos = self.window.get_position() |
2299 | self.priv["window_xpos"] = xpos |
2300 | |
2301 | === modified file 'GTG/taskeditor/editor.py' |
2302 | --- GTG/taskeditor/editor.py 2009-08-11 11:12:44 +0000 |
2303 | +++ GTG/taskeditor/editor.py 2009-08-11 12:19:20 +0000 |
2304 | @@ -158,7 +158,8 @@ |
2305 | # plugins |
2306 | self.plugins = plugins |
2307 | self.pengine = PluginEngine(PLUGIN_DIR) |
2308 | - self.te_plugin_api = PluginAPI(self.window, None, self.wTree, self.req, None, None, None, None, task, self.textview) |
2309 | + self.te_plugin_api = PluginAPI(self.window, None, self.wTree, self.req, |
2310 | + None, None, None, None, task, self.textview) |
2311 | self.pengine.onTaskLoad(self.plugins, self.te_plugin_api) |
2312 | |
2313 | #Putting the refresh callback at the end make the start a lot faster |