c_toennes10 | 2 Nov 2011 15:51
Picon
Picon
Favicon

Bug in decoration.py

Hi,
I don't know how to open a new ticket in the Trac, so I have to send an 
E-Mail to this list.
In the file "decoration.py" is a little bug:
http://excess.org/urwid/browser/urwid/decoration.py#L807
it should be:
if row < top or row >= maxrow-bottom:
Ian Ward | 2 Nov 2011 15:56
Favicon
Gravatar

Re: Bug in decoration.py

c_toennes10 wrote on 2011-11-02 10:51:
> Hi,
> I don't know how to open a new ticket in the Trac, so I have to send an 

For next time you just need to remove the rmthis- part of the login url.

> E-Mail to this list.
> In the file "decoration.py" is a little bug:
> http://excess.org/urwid/browser/urwid/decoration.py#L807
> it should be:
> if row < top or row >= maxrow-bottom:

Good catch, thanks!

Ian
Kurt Yoder | 16 Nov 2011 19:26
Picon

example of maxrow (or height?)

All,

I am trying to make a text input box containing a long block of text. But this input box must share vertical
space with other widgets, so I don't want it to expand to display everything inside the input box. Is there a
commonly-accepted way to do this? For example, if the screen shows:

widget1
widget2
biginput1
biginput2

can I tell biginput1 and 2 to both constrain themselves to maximum 5 rows? It seems the documentation refers
to "maxrow", but I can't find an example of how to do this.

Is this even the right way to do it, and if so how?

Thanks
Ian Ward | 16 Nov 2011 19:35
Favicon
Gravatar

Re: example of maxrow (or height?)

Hi Kurt,

Kurt Yoder wrote on 2011-11-16 13:26:
> All,
> 
> I am trying to make a text input box containing a long block of text.
> But this input box must share vertical space with other widgets, so I
> don't want it to expand to display everything inside the input box.
> Is there a commonly-accepted way to do this? For example, if the
> screen shows:
> 
> widget1 widget2 biginput1 biginput2
> 
> can I tell biginput1 and 2 to both constrain themselves to maximum 5
> rows? It seems the documentation refers to "maxrow", but I can't find
> an example of how to do this.

What would you like to happen when the content of the text exceeds 5 rows?

> 
> Is this even the right way to do it, and if so how?
Kurt Yoder | 16 Nov 2011 21:28
Picon

Re: example of maxrow (or height?)

On Nov 16, 2011, at 1:35 PM, Ian Ward wrote:

> Hi Kurt,
> 
> Kurt Yoder wrote on 2011-11-16 13:26:
>> All,
>> 
>> I am trying to make a text input box containing a long block of text.
>> But this input box must share vertical space with other widgets, so I
>> don't want it to expand to display everything inside the input box.
>> Is there a commonly-accepted way to do this? For example, if the
>> screen shows:
>> 
>> widget1 widget2 biginput1 biginput2
>> 
>> can I tell biginput1 and 2 to both constrain themselves to maximum 5
>> rows? It seems the documentation refers to "maxrow", but I can't find
>> an example of how to do this.
> 
> What would you like to happen when the content of the text exceeds 5 rows?

I would like the text to be cut off, but "scroll" into view when I place my cursor within and then press the
down/up arrows.

-Kurt
Ian Ward | 16 Nov 2011 23:29
Favicon
Gravatar

Re: example of maxrow (or height?)

Kurt Yoder wrote on 2011-11-16 15:28:
> On Nov 16, 2011, at 1:35 PM, Ian Ward wrote:
> 
>> Hi Kurt,
>>
>> Kurt Yoder wrote on 2011-11-16 13:26:
>>> All,
>>>
>>> I am trying to make a text input box containing a long block of text.
>>> But this input box must share vertical space with other widgets, so I
>>> don't want it to expand to display everything inside the input box.
>>> Is there a commonly-accepted way to do this? For example, if the
>>> screen shows:
>>>
>>> widget1 widget2 biginput1 biginput2
>>>
>>> can I tell biginput1 and 2 to both constrain themselves to maximum 5
>>> rows? It seems the documentation refers to "maxrow", but I can't find
>>> an example of how to do this.
>>
>> What would you like to happen when the content of the text exceeds 5 rows?
> 
> I would like the text to be cut off, but "scroll" into view when I place my cursor within and then press the
down/up arrows.

Here's an example that does that:

urwid.MainLoop(
    urwid.Filler(
        urwid.BoxAdapter(
(Continue reading)

Kurt Yoder | 17 Nov 2011 00:19
Picon

Re: example of maxrow (or height?)


On Nov 16, 2011, at 5:29 PM, Ian Ward wrote:

<snip>
> 
> urwid.MainLoop(
>    urwid.Filler(
>        urwid.BoxAdapter(
>            urwid.Filler(
>                urwid.Edit(u"Type lots:", u"", multiline=True),
>                'top'),
>            5),
>        'top')
>    ).run()
> 
> You likely just need the BoxAdapter and inner Filler.
> 
> Ian

Very nice, it works perfectly (yes, I had to *only* use the inner BoxAdapter/Filler, otherwise I got an error).

Thank you!
Yassen Damyanov | 24 Nov 2011 18:12
Picon
Favicon

Lots of progress bars (help pls)

Hello Ian and community!

I'm new to urwid; trying to compose an application that needs to show lots (LOTS!) of progress bars at the
same time. Could be some 10 to 20, of them, depending on external factors.

I've been digging into urwid for a couple of days already but with a limited success. So I decided to ask for
some help:

(1) Would anyone suggest a widget class (or configuration of classes) that would let progress bars order
themselves let's say 5 or 6 per row (all should be the same width). (A snippet of code would be highly appreciated.)

(2) I would like that composite to have a border built using pseudo-graphical characters on a utf-8
console. Any suggestions for a suitable decorator (or how to build one) ?

Thank you in advance!
Yassen
Ian Ward | 27 Nov 2011 00:52
Favicon
Gravatar

Re: Lots of progress bars (help pls)

Yassen Damyanov wrote on 2011-11-24 12:12:
> Hello Ian and community!
> 
> I'm new to urwid; trying to compose an application that needs to show
> lots (LOTS!) of progress bars at the same time. Could be some 10 to
> 20, of them, depending on external factors.
> 
> I've been digging into urwid for a couple of days already but with a
> limited success. So I decided to ask for some help:
> 
> (1) Would anyone suggest a widget class (or configuration of classes)
> that would let progress bars order themselves let's say 5 or 6 per
> row (all should be the same width). (A snippet of code would be
> highly appreciated.)

You want to make a grid of progress bars?  You might be able to extend
GridFlow to do that sort of thing.

> 
> (2) I would like that composite to have a border built using
> pseudo-graphical characters on a utf-8 console. Any suggestions for a
> suitable decorator (or how to build one) ?

Try reading the LineBox code and modify or extend to taste.

Ian
the grugq | 27 Nov 2011 01:46
Picon

vterm.Terminal patches to enable easier subclassing

Hey,

I've been working on an Urwid application that uses the vterm.Terminal widget 
and integrates properly with Twisted. I've already submitted some minor patches 
to make the raw_display.Screen() object more friendly to subclassing, now I'd 
like to get the Terminal() patched as well. 

The issue is that Terminal assumes the self.master attribute is a file 
descriptor and it will inline calls to os.read()/os.write() on this attribute. 
If the attribute is anything other than a file descriptor, it will raise an 
exception and die. This makes it convoluted to have the master attribute as a 
ProcessProtocol, which is the simplest solution for a Twisted application 
subclassing and implementing the Terminal.

The best solution, from my POV, is to have all access to the the self.master 
attribute wrapped in method calls which can be overwritten. There are two 
options, either make the Terminal widget know how to do I/O on self.master, or 
make self.master an object. That is, either:

# original code:
  os.write(self.master, buf)

# terminal knows too much, code:
  self.write_master(buf)

# I can't believe master's a file(), code:
  self.master.write(buf)

In the attached patch I've implemented the latter approach. I promote the master 
to a file() object (with disabled buffering and non-blocking enabled, so it 
(Continue reading)


Gmane