Example #1
0
    def __str__(self):
        to_join = []
        for key in sorted(self.param_dict.keys()):
            temp = str(key) + ":" + str(self.param_dict[key])
            to_join.append(temp)

        return "(" + string.join(to_join, "_") + ")"

        return helper.shorten(str(sorted(self.param_dict.iteritems())))
Example #2
0
 def get_name(self, object_key, to_reindex=global_stuff.to_reindex):
     if not self.super_shorten():
         assert False
         if not self.makes_index():
             return helper.shorten(str(object_key))
         elif not to_reindex:
             return helper.shorten(str(object_key))
         else:
             # pdb.set_trace()
             assert self.maker.object_key_to_index.has(object_key, to_reindex) == True
             return str(self.maker.object_key_to_index.get(object_key))
     else:
         if not self.makes_index():
             return helper.super_shorten(str(object_key))
         elif not to_reindex:
             return helper.super_shorten(str(object_key))
         else:
             # pdb.set_trace()
             assert self.maker.object_key_to_index.has(object_key, to_reindex) == True
             return global_stuff.super_shorten(str(self.maker.object_key_to_index.get(object_key)))
Example #3
0
    def rebuild(self):
        cols = []
        formatstring = config.get('general', 'timestamp_format')
        newest = self.thread.get_newest_date()
        if formatstring:
            datestring = newest.strftime(formatstring)
        else:
            datestring = pretty_datetime(newest).rjust(10)
        self.date_w = urwid.AttrMap(urwid.Text(datestring), 'threadline_date')
        cols.append(('fixed', len(datestring), self.date_w))

        mailcountstring = "(%d)" % self.thread.get_total_messages()
        self.mailcount_w = urwid.AttrMap(urwid.Text(mailcountstring),
                                   'threadline_mailcount')
        cols.append(('fixed', len(mailcountstring), self.mailcount_w))

        tags = self.thread.get_tags()
        tags.sort()
        for tag in tags:
            tw = TagWidget(tag)
            self.tag_widgets.append(tw)
            cols.append(('fixed', tw.width(), tw))

        authors = self.thread.get_authors() or '(None)'
        maxlength = config.getint('general', 'authors_maxlength')
        authorsstring = shorten(authors, maxlength).strip()
        self.authors_w = urwid.AttrMap(urwid.Text(authorsstring),
                                       'threadline_authors')
        cols.append(('fixed', len(authorsstring), self.authors_w))

        subjectstring = self.thread.get_subject().strip()
        self.subject_w = urwid.AttrMap(urwid.Text(subjectstring, wrap='clip'),
                                 'threadline_subject')
        if subjectstring:
            cols.append(('fixed', len(subjectstring), self.subject_w))

        if self.display_content:
            msgs = self.thread.get_messages().keys()
            msgs.sort()
            lastcontent = ' '.join([m.get_text_content() for m in msgs])
            contentstring = lastcontent.replace('\n', ' ').strip()
            self.content_w = urwid.AttrMap(urwid.Text(contentstring,
                                                      wrap='clip'),
                                           'threadline_content')
            cols.append(self.content_w)

        self.columns = urwid.Columns(cols, dividechars=1)
        self.original_widget = self.columns