summaryrefslogblamecommitdiffstats
path: root/item.py
blob: c39a1ead486dc2cd44c260f96534d06a7f6484ed (plain) (tree)
1
2
3
4
5

                       


                     








                                                                          


                         




                                    















                                                                         
# -*- coding: utf-8 -*-

class item:
    readOnly = ['id']
    
    def __init__(self, title=None, created=None, priority=None, row=None):
        if row == None:
            self.__dict__['id'] = -1
            self.title = title
            self.created = created
            self.priority = priority
        else:
            self.__init__(row[1], row[2], row[3])
            self.__dict__['id'] = row[0]

    def setId(self, id):
        if self.id == -1:
            self.__dict__['id'] = id

    def getId(self):
        return self.id
    
    def getTitle(self):
        return self.title

    def getCreatedAt(self):
        return self.created

    def getPriority(self):
        return self.priority

    def __setattr__(self, name, value):
        if name not in item.readOnly:
            if name not in self.__dict__ or self.__dict__[name] != value:
                self.__dict__[name] = value
            
                if 'observer' in self.__dict__:
                    self.observer.notifyChange(self)