Beispiel #1
0
 def update_timeline(self, tweets):
     log.debug(u'Actualizando el timeline')
     gtk.gdk.threads_enter()
     
     last = self.home.timeline.last
     count = self.home.timeline.update_tweets(tweets)
     
     if count > 0 and self.updating['home']:
         tweet = None
         i = 0
         while 1:
             if tweets[i]['user']['screen_name'] == self.me:
                 if not util.has_tweet(last, tweets[i]):
                     tweet = tweets[i]
                     break
             else:
                 tweet = tweets[i]
                 break
             i += 1
         
         p = self.parse_tweet(tweet)
         icon = self.current_avatar_path(p['avatar'])
         text = util.escape_text(p['text'])
         text = "<b>@%s</b> %s" % (p['username'], text)
         self.notify.new_tweets(count, text, icon)
         
     gtk.gdk.threads_leave()
     self.updating['home'] = False
Beispiel #2
0
    def update_timeline(self, tweets):
        log.debug(u'Actualizando el timeline')
        gtk.gdk.threads_enter()

        last = self.home.timeline.last
        count = self.home.timeline.update_tweets(tweets)

        if count > 0 and self.updating['home']:
            tweet = None
            i = 0
            while 1:
                if tweets[i]['user']['screen_name'] == self.me:
                    if not util.has_tweet(last, tweets[i]):
                        tweet = tweets[i]
                        break
                else:
                    tweet = tweets[i]
                    break
                i += 1

            p = self.parse_tweet(tweet)
            icon = self.current_avatar_path(p['avatar'])
            text = util.escape_text(p['text'])
            text = "<b>@%s</b> %s" % (p['username'], text)
            self.notify.new_tweets(count, text, icon)

        gtk.gdk.threads_leave()
        self.updating['home'] = False
Beispiel #3
0
 def _notify_new_tweets(self, column, tweets, last, count):
     if count <= 0:
         return
     
     tweet = None
     for twt in tweets.items:
         if twt.username != self.me:
             if not util.has_tweet(last, twt):
                 tweet = twt
                 break
     
     if not tweet:
         return
     
     if count == 1:
         tobject = column.single_unit
     else:
         tobject = column.plural_unit
     
     p = self.parse_tweet(tweet)
     icon = self.current_avatar_path(p.avatar)
     twt = util.unescape_text(p.text)
     text = "<b>@%s</b> %s" % (p.username, twt)
     
     self.notify.new_tweets(column.title, count, tobject, text, icon)
     self.indicator.add_update(column.title, count)
     
     if self.read_config_value('Notifications', 'sound') == 'on':
         if column.id == 'replies':
             self.sound.replies()
         elif column.id == 'directs':
             self.sound.directs()
         else:
             self.sound.tweets()
     
     if not self.get_property('is-active'):
         self.tray.set_from_pixbuf(self.load_image('turpial-tray-update.png', True))