~ubuntu-branches/ubuntu/trusty/gtg/trusty

« back to all changes in this revision

Viewing changes to GTG/plugins/evolution_sync/evolutionProxy.py

  • Committer: Package Import Robot
  • Author(s): Luca Falavigna
  • Date: 2012-04-10 23:08:21 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20120410230821-q6it7f4d7elut6pv
Tags: 0.2.9-1
* New upstream release (Closes: #668096).
  - Implement a search text box (Closes: #650279).
  - Window title reflects active tasks (LP: #537096).
  - Fix misbehaviours of the indicator applet (LP: #548836, #676353).
  - Fix crash when selecting notification area plugin twice (LP: #550321).
  - Fix sorting of tasks by date (LP: #556159).
  - Fix excessive delays at startup (LP: #558600).
  - Fix crash with dates having unknown values (LP: #561449).
  - Fix crash issued when pressing delete key (LP: #583103).
  - Keep notification plugin enabled after logoff (LP: #617257).
  - Fix Hamster plugin to work with recent Hamster versions (LP: #620313).
  - No longer use non-unicode strings (LP: #680632).
  - New RTM sync mechanism (LP: #753327).
  - Fix crashes while handling XML storage file (LP: #916474, #917634).
* debian/patches/*:
  - Drop all patches, they have been merged upstream.
* debian/patches/shebang.patch:
  - Fix shebang line.
* debian/patches/manpages.patch:
  - Fix some groff warnings in gtg_new_task man page
* debian/compat:
  - Bump compatibility level to 9.
* debian/control:
  - Bump X-Python-Version to >= 2.6.
  - Add python-liblarch and python-liblarch-gtk to Depends field.
  - Add python-cheetah, python-geoclue, python-gnomekeyring,
    python-launchpadlib and python-suds to Suggests field.
  - Bump Standards-Version to 3.9.3.
* debian/copyright:
  - Refresh copyright information.
  - Format now points to copyright-format site.
* debian/rules:
  - Make gtcli_bash_completion script executable.
* debian/watch:
  - Update watch file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- coding: utf-8 -*-
2
 
# Copyright (c) 2009 - Luca Invernizzi <invernizzi.l@gmail.com>
3
 
#
4
 
# This program is free software: you can redistribute it and/or modify it under
5
 
# the terms of the GNU General Public License as published by the Free Software
6
 
# Foundation, either version 3 of the License, or (at your option) any later
7
 
# version.
8
 
#
9
 
# This program is distributed in the hope that it will be useful, but WITHOUT
10
 
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
 
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12
 
# details.
13
 
#
14
 
# You should have received a copy of the GNU General Public License along with
15
 
# this program.  If not, see <http://www.gnu.org/licenses/>.
16
 
 
17
 
import evolution
18
 
 
19
 
from GTG.core.task import Task
20
 
from GTG.plugins.evolution_sync.evolutionTask import EvolutionTask
21
 
from GTG.plugins.evolution_sync.genericProxy import GenericProxy
22
 
 
23
 
 
24
 
class EvolutionProxy(GenericProxy):
25
 
    
26
 
    __GTG_STATUSES = [Task.STA_ACTIVE,
27
 
                   Task.STA_DONE,
28
 
                   Task.STA_DISMISSED]
29
 
 
30
 
    __EVO_STATUSES = [evolution.ecal.ICAL_STATUS_CONFIRMED,
31
 
                   evolution.ecal.ICAL_STATUS_COMPLETED,
32
 
                   evolution.ecal.ICAL_STATUS_CANCELLED]
33
 
 
34
 
    def __init__(self):
35
 
        super(EvolutionProxy, self).__init__()
36
 
 
37
 
    def generateTaskList(self):
38
 
        task_personal = evolution.ecal.list_task_sources()[0][1]
39
 
        self._evolution_tasks = evolution.ecal.open_calendar_source(task_personal,
40
 
                                   evolution.ecal.CAL_SOURCE_TYPE_TODO)
41
 
        self._gtg_to_evo_status = dict(zip(self.__GTG_STATUSES,
42
 
                                            self.__EVO_STATUSES))
43
 
        self._evo_to_gtg_status = dict(zip(self.__EVO_STATUSES,
44
 
                                            self.__GTG_STATUSES))
45
 
        #Need to find a solution for the statuses GTG doesn't expect:
46
 
        for evo_status in [evolution.ecal.ICAL_STATUS_DRAFT,
47
 
                           evolution.ecal.ICAL_STATUS_FINAL,
48
 
                           evolution.ecal.ICAL_STATUS_INPROCESS,
49
 
                           evolution.ecal.ICAL_STATUS_NEEDSACTION,
50
 
                           evolution.ecal.ICAL_STATUS_NONE,
51
 
                           evolution.ecal.ICAL_STATUS_TENTATIVE,
52
 
                           evolution.ecal.ICAL_STATUS_X]:
53
 
            self._evo_to_gtg_status[evo_status] = Task.STA_ACTIVE
54
 
        self._tasks_list = []
55
 
        for task in self._evolution_tasks.get_all_objects():
56
 
            self._tasks_list.append(EvolutionTask(task, self))
57
 
 
58
 
    def create_new_task(self, title):
59
 
        task = evolution.ecal.ECalComponent(ical=evolution.ecal.CAL_COMPONENT_TODO)
60
 
        self._evolution_tasks.add_object(task)
61
 
        new_task = EvolutionTask(task, self)
62
 
        new_task.title = title
63
 
        self._tasks_list.append(new_task)
64
 
        return new_task
65
 
 
66
 
    def delete_task(self, task):
67
 
        evo_task = task.get_evolution_task()
68
 
        self._evolution_tasks.remove_object(evo_task)
69
 
        self._evolution_tasks.update_object(evo_task)
70
 
 
71
 
    def update_task(self, task):
72
 
        evo_task = task.get_evolution_task()
73
 
        self._evolution_tasks.update_object(evo_task)