~saurabhanandiit/gtg/exportFixed

« back to all changes in this revision

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

Merge of my work on liblarch newbase and all the backends ported to liblarch
(which mainly means porting the datastore).
One failing test, will check it.

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
 
 
18
 
class GenericTask(object):
19
 
    """GenericTask is the abstract interface that represents a generic task."""
20
 
 
21
 
    def __init__(self, proxy):
22
 
        self.__proxy = proxy
23
 
 
24
 
    def __str__(self):
25
 
        return "Task " + self.title + "(" + self.id + ")"
26
 
 
27
 
    def toString(self):
28
 
        return "Task:\n" + \
29
 
                "\t - Title:    " + self.title         + "\n" + \
30
 
                "\t - ID:       " + self.id            + "\n" + \
31
 
                "\t - Modified: " + str(self.modified) + "\n" + \
32
 
                "\t - Due:      " + str(self.due_date) + "\n" 
33
 
 
34
 
    def copy(self, task):
35
 
        #Minimizing the number of actions will allow a faster RTM plugin
36
 
        # (where GET is fast, but SET is slow)
37
 
        if self.title != task.title:
38
 
            self.title = task.title
39
 
        if self.text != task.text:
40
 
            self.text = task.text
41
 
        if self.status != task.status:
42
 
            self.status = task.status
43
 
        if self.due_date != task.due_date:
44
 
            self.due_date = task.due_date
45
 
 
46
 
    def get_proxy(self):
47
 
        return self.__proxy
48
 
 
49
 
    title = property(lambda self: self._get_title(),
50
 
                     lambda self, arg: self._set_title(arg))
51
 
 
52
 
    id = property(lambda self: self._get_id())
53
 
 
54
 
    text = property(lambda self: self._get_text(),
55
 
                     lambda self, arg: self._set_text(arg))
56
 
 
57
 
    status = property(lambda self: self._get_status(),
58
 
                     lambda self, arg: self._set_status(arg))
59
 
 
60
 
    modified = property(lambda self: self._get_modified())
61
 
 
62
 
    due_date = property(lambda self: self._get_due_date(),
63
 
                     lambda self, arg: self._set_due_date(arg))
64
 
 
65
 
    tags = property(lambda self: self._get_tags(),
66
 
                     lambda self, arg: self._set_tags(arg))
67
 
 
68
 
    self = property(lambda self: self)