Hey,

Is the Columns widget the only way to squish several text widgets into
a single row? The Column widget formats text the way I want it
(basically), but focus now constrained to just one small part of the
row rather than the whole row.

I'm trying to make the index view more legible in my email app by
adding in colors (ie- white for unread messages, grey for read
messages), labels being another color, sample text being another
color, and starred emails being yet another color. In addition I want
to give each field of information a fixed number of columns so
information like the date and the number of messages in a conversation
is always in the same location.

I've gotten the desired effect by using columns of fixed size and
setting wrap in the text widgets to 'clip'. However as I mentioned
previously, only the date now highlights with the focus attribute
instead of the whole line.

Is there another way I can get the same effect, or possibly get the
focus highlight to apply to the entire row?

Here's my very messy set_label method if it helps at all:
********************************
    def set_label(self, label):
        self.label = label
        #w = urwid.Text( label, wrap='clip' )
        if type(label) is tuple:
            __ddate = label[0]
            try: __ddate = urwid.AttrWrap( urwid.Text(__ddate[1],
align='right'), __ddate[0], 'focus')
            except:
                screen.tui.stop()
                print __ddate
                print label
                import sys
                sys.exit()
            __dsender = label[1]
            __dsender = urwid.AttrWrap( urwid.Text(__dsender,
wrap='clip'), 'body', 'focus')
            #__dsender = urwid.AttrWrap( urwid.Text(__dsender[1],
align='left', wrap='clip'), __dsender[0], 'focus')
            __dcontained = label[2]
            __dcontained = urwid.AttrWrap( urwid.Text(__dcontained[1],
align='center'), __dcontained[0], 'focus')
            #__dsubject = label[3]
            #__dsubject = urwid.AttrWrap( urwid.Text(__dsubject[1],
wrap='clip'), __dsubject[0], 'focus')
            #__dlabels = label[4]
            #__dlabels = urwid.AttrWrap( urwid.Text(__dlabels[1],
wrap='clip'), __dlabels[0], 'focus')
            #__dpreview = label[5]
            #__dpreview = urwid.AttrWrap( urwid.Text(__dpreview[1],
wrap='clip'), __dpreview[0], 'focus')
            __rest = list(label[3:])
            if not __rest[-1][1]: del __rest[-1]
            if not __rest[1][1]: del __rest[1]
            __rest = urwid.AttrWrap( urwid.Text(__rest, wrap='clip'),
'body', 'focus')

            #w = urwid.Text(

            w = urwid.Columns([
                ('fixed', 10, __ddate),
                ('fixed', 30, __dsender),
                ('fixed', 5, __dcontained),
                __rest],
                #('weight', 1, __dpreview)],
                dividechars=1, min_width=4)

            #w = urwid.WidgetWrap(w)
                #urwid.Text( label[4], wrap='clip' ),
                #urwid.Text( label[5], wrap='clip' )],

        else:
            w = urwid.Text(label)

        self.w = urwid.AttrWrap( w, 'body', 'focus' )
        self._invalidate()
**************************************

Dominic


_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid

Reply via email to