diff options
Diffstat (limited to 'item.py')
-rw-r--r-- | item.py | 21 |
1 files changed, 17 insertions, 4 deletions
@@ -1,22 +1,32 @@ # -*- coding: utf-8 -*- +import time class item: readOnly = ['id'] - def __init__(self, title=None, created=None, priority=None, description=None, completed=None, row=None): + def __init__(self, title=None, created=None, priority=None, description=None, completed=None, removed=None, row=None): + self.__dict__['id'] = -1 + if title != None: - self.__dict__['id'] = -1 self.title = title self.created = created self.priority = priority self.description = description self.completed = completed - else: + self.removed = removed + elif row != None: id = row[0] - + row.__delitem__(0) apply(self.__init__, row) self.__dict__['id'] = id + else: + self.title = '' + self.created = time.time() + self.priority = '' + self.description = '' + self.completed = 0 + self.removed = 0 def setId(self, id): if self.id == -1: @@ -40,6 +50,9 @@ class item: def getCompleted(self): return self.completed + def getRemoved(self): + return self.removed + def __setattr__(self, name, value): if name not in item.readOnly: if name not in self.__dict__ or self.__dict__[name] != value: |