Exemple #1
0
    def get_header(self, status):
        """Return the header text for the status associated with this widget."""
        retweeted = ''
        reply = ''
        retweet_count = ''
        retweeter = ''
        source = self.get_source(status)
        nick = self.get_nick(status)
        timer = self.get_time(status)

        if self.is_reply(status):
            reply = u' \u2709'
        if status.rt:
            retweeted = u" \u267b "
            retweeter = nick
            nick = self.origin_of_retweet(status)

        if self.get_retweet_count(status):
            retweet_count = str(self.get_retweet_count(status))
            
        tyrs.get_completion().add(get_exact_nick(nick))
        header_template = self.conf.params['header_template'] 
        header = unicode(header_template).format(
            time = timer,
            nick = nick,
            reply = reply,
            retweeted = retweeted,
            source = source,
            retweet_count = retweet_count,
            retweeter = retweeter
            )

        return encode(header)
Exemple #2
0
    def get_text(self, status):
        """Return the text for the status associated with this widget."""
        result = []
        text = html_unescape(status.text.replace('\n', ' '))
        if status.rt:
            text = text.split(':')[1:]
            text = ':'.join(text)

        if hasattr(status, 'retweeted_status'):
            if hasattr(status.retweeted_status, 'text') \
                    and len(status.retweeted_status.text) > 0:
                text = status.retweeted_status.text

        myself = self.api.myself.screen_name
        words = text.split(' ')
        for word in words:
            if word:
                word += ' '
                # The word is an HASHTAG ? '#'
                if word[0] == '#':
                    result.append(('hashtag', word))
                elif word[0] == '@':
                    ## The AT TAG is, @myself
                    if word == '@%s ' % myself or word == '@%s: ' % myself:
                        result.append(('highlight_nick', word))
                    ## @anyone
                    else:
                        result.append(('attag', word))
                        tyrs.get_completion().add(get_exact_nick(word))
                        
                else:
                    result.append(word)
        return result
Exemple #3
0
    def __init__(self, init_content='', prompt=''):
        if init_content:
            init_content += ' '
        self.editor = Editor(u'%s (twice enter key to validate or esc) \n>> ' % prompt, init_content)
        self.counter = urwid.Text('0')
        self.editor.completion = tyrs.get_completion()
        widget = urwid.Columns([ ('fixed', 4, self.counter), self.editor])
        urwid.connect_signal(self.editor, 'done', self.send_sigterm)
        urwid.connect_signal(self.editor, 'change', self.update_count)

        self.__super.__init__(widget)
Exemple #4
0
 def __init__(self):
     self.api        = tyrs.get_api()
     self.conf       = tyrs.get_conf()
     self.timelines  = tyrs.get_timelines()
     self.buffers    = tyrs.get_buffers()
     self.completion = tyrs.get_completion()
     self.help = False
     tyrs.set_interface(self)
     self.update_last_read_home()
     self.api.set_interface()
     self.regex_retweet     = re.compile('^RT @\w+:')
     self.stoped = False
     self.buffer           = 'home'
     self.first_update()
     self.main_loop()