Example #1
0
 def start(self):
     try:
         print 'starting timer'
         self.timer.start()
     except AttributeError:
         self.timer = RepeatTimer(300, self.fetch)
         print 'starting timer'
         self.start()
         self.fetch()
Example #2
0
class RssProtocol(object):

    def __init__(self, myacct):
        self.myacct = myacct
        self.filter = RssFeedFilter(myacct.location)
        self.filter.bind('new_data', self.got_data)
        self.myacct.bind('enabled', self.start)
        self.myacct.bind('disabled', self.stop)

    def start(self):
        try:
            print 'starting timer'
            self.timer.start()
        except AttributeError:
            self.timer = RepeatTimer(300, self.fetch)
            print 'starting timer'
            self.start()
            self.fetch()

    def stop(self):
        try:
            print 'stopping timer'
            self.timer.stop()
        except AttributeError:
            pass

    @threaded
    def fetch(self):
        self.filter.update()
        self.myacct._dirty = True

    def got_data(self, items):
        self._dirty = True
        for item in items:
            print 'new rss item', item.title

#-------------------------------------------------

    @property
    def count(self):
        return len(self.filter.items)

    @property
    def feed(self):
        return sorted(self.filter.items)
Example #3
0
class RssProtocol(object):
    def __init__(self, myacct):
        self.myacct = myacct
        self.filter = RssFeedFilter(myacct.location)
        self.filter.bind('new_data', self.got_data)
        self.myacct.bind('enabled', self.start)
        self.myacct.bind('disabled', self.stop)

    def start(self):
        try:
            print 'starting timer'
            self.timer.start()
        except AttributeError:
            self.timer = RepeatTimer(300, self.fetch)
            print 'starting timer'
            self.start()
            self.fetch()

    def stop(self):
        try:
            print 'stopping timer'
            self.timer.stop()
        except AttributeError:
            pass

    @threaded
    def fetch(self):
        self.filter.update()
        self.myacct._dirty = True

    def got_data(self, items):
        self._dirty = True
        for item in items:
            print 'new rss item', item.title


#-------------------------------------------------

    @property
    def count(self):
        return len(self.filter.items)

    @property
    def feed(self):
        return sorted(self.filter.items)
Example #4
0
 def start(self):
     try:
         print 'starting timer'
         self.timer.start()
     except AttributeError:
         self.timer = RepeatTimer(300, self.fetch)
         print 'starting timer'
         self.start()
         self.fetch()