Пример #1
0
    def reset_fav_rt_ico(self, path, fav=True, rt=True):
        if path != None:
            status = self.get_status(path)
            if TwitterTools.isretweet(status):
                status = self.twitter.statuses[status.retweeted_status.id]

            if fav:
                self.store[path][5] = self.favico_on if status.favorited else self.favico_off
            if rt:
                self.store[path][6] = self.rtico_on if status.retweeted else self.rtico_off
Пример #2
0
    def status_pack(self, i):
        status = self.twitter.statuses[i]
        background = None
        footer = ""

        name = status.user.screen_name

        if TwitterTools.isretweet(status):
            rtstatus = status
            status = self.twitter.statuses[status.retweeted_status.id]
            # status.favorited = False # FIX? rtstatus.favorited
            name = "%s <span foreground='#333333'><small>- Retweeted by %s</small></span>" % (
                status.user.screen_name,
                rtstatus.user.screen_name,
            )

        if status.user.id in self.twitter.followers or status.user.id == self.twitter.my_id:
            # Bold screen_name if follower
            tmpl = "<b>%s</b>\n%s"
        elif not self.twitter.followers:
            tmpl = "<b><i>%s</i></b>\n%s"
        else:
            # or gray
            tmpl = "<span foreground='#666666'><b>%s</b></span>\n%s"

        # status decoration
        text = TwitterTools.get_decoration_text(status)
        # screen_name + text
        message = tmpl % (name, text)
        # replace no entity & -> &amp;
        message = TwitterTools.replace_amp(message)

        # deleted
        if "deleted" in status:
            message = "<span foreground='#666666'><s>%s</s></span>" % message

        # Faved by
        if "faved_by" in status and status["faved_by"]:
            footer += "\n<small>Faved by: %s</small>" % (
                ", ".join([self.twitter.users[u].screen_name for u in status["faved_by"]])
            )

        # geo tag
        if status["place"]:
            footer += "\n<small>Place: %s</small>" % (status["place"]["full_name"])

        if footer:
            message = "%s\n%s" % (message, footer)

        # Favorite, RT
        favico = self.favico_on if status.favorited else self.favico_off
        rtico = self.rtico_on if status.retweeted else self.rtico_off

        return (self.iconstore.get(status.user), message, long(i), long(status.user.id), background, favico, rtico)
Пример #3
0
 def _destroy_tweet_in_thread(self, status):
     self.api_wrapper(self.api.status_destroy, status.id)
     status["deleted"] = True
     if TwitterTools.isretweet(status):
         self.statuses[status.retweeted_status.id]["retweeted"] = False