Ian Ward | 8 Jul 01:44 2005

patch-0.8.8.1 fix for ListBox.set_focus

ListBox.set_focus will cause an assertion if focus is being changed to
an off-screen widget and the coming_from parameter is not set.  This
patch fixes the bug:

http://excess.org/urwid/patch-0.8.8.1.diff

Ian

cantabile | 19 Jul 13:44 2005
Picon

[Fwd: Find focused Edit]


-------------- next part --------------
An embedded message was scrubbed...
From: cantabile <cantabile.03 <at> wanadoo.fr>
Subject: Find focused Edit
Date: Tue, 19 Jul 2005 17:23:37 +0200
Size: 854
Url: http://lists.excess.org/pipermail/urwid/attachments/20050719/5d14b5b7/FindfocusedEdit.mht

Ian Ward | 19 Jul 17:26 2005

[Fwd: Find focused Edit]

cantabile wrote:

 >Hi all,
 >
 >I'm trying end write a urwid based gui for server tools install.
 >I have several Edit's piled (with Pile() of course) in Columns.
 >Now, I'd like to display some help for each Edit in the frame footer.
 >I'm aware that get_focus() exists, but in that case, it gives back a
 >Column instead of the Edit.
 >How could I do to get the highlighted / focused Edit to display its
 >help, or the app. to retrieve the highlighted Edit when it changes ?
 >
 >Thanks for your help.
 >

Columns and Pile objects also have get_focus() methods that you can use 
to drill down to the Edit widget.  To make your code generic with 
respect to the containing Columns and Pile widgets you could use a 
"while hasattr( w, 'get_focus' ): w = w.get_focus()" loop to drill down.

Ian

cantabile | 19 Jul 18:44 2005
Picon

[Fwd: Find focused Edit]

Ian Ward a ?crit :

> cantabile wrote:
>
> >Hi all,
> >
> >I'm trying end write a urwid based gui for server tools install.
> >I have several Edit's piled (with Pile() of course) in Columns.
> >Now, I'd like to display some help for each Edit in the frame footer.
> >I'm aware that get_focus() exists, but in that case, it gives back a
> >Column instead of the Edit.
> >How could I do to get the highlighted / focused Edit to display its
> >help, or the app. to retrieve the highlighted Edit when it changes ?
> >
> >Thanks for your help.
> >
>
> Columns and Pile objects also have get_focus() methods that you can 
> use to drill down to the Edit widget.  To make your code generic with 
> respect to the containing Columns and Pile widgets you could use a 
> "while hasattr( w, 'get_focus' ): w = w.get_focus()" loop to drill down.
>
> Ian
>
>
> _______________________________________________
> Urwid mailing list
> Urwid <at> lists.excess.org
> http://lists.excess.org/mailman/listinfo/urwid
>
(Continue reading)

cantabile | 20 Jul 00:24 2005
Picon

[Fwd: Find focused Edit]

Ian Ward a ?crit :

> cantabile wrote:
>
> >Hi all,
> >
> >I'm trying end write a urwid based gui for server tools install.
> >I have several Edit's piled (with Pile() of course) in Columns.
> >Now, I'd like to display some help for each Edit in the frame footer.
> >I'm aware that get_focus() exists, but in that case, it gives back a
> >Column instead of the Edit.
> >How could I do to get the highlighted / focused Edit to display its
> >help, or the app. to retrieve the highlighted Edit when it changes ?
> >
> >Thanks for your help.
> >
>
> Columns and Pile objects also have get_focus() methods that you can 
> use to drill down to the Edit widget.  To make your code generic with 
> respect to the containing Columns and Pile widgets you could use a 
> "while hasattr( w, 'get_focus' ): w = w.get_focus()" loop to drill down.
>
> Ian
>
>
> _______________________________________________
> Urwid mailing list
> Urwid <at> lists.excess.org
> http://lists.excess.org/mailman/listinfo/urwid
>
(Continue reading)

Ian Ward | 21 Jul 01:54 2005

[Fwd: Find focused Edit]

cantabile wrote:
 >
 > Another idea : is it possible that wrapping the edits in 
urwid.Padding and urwid.AttrWrap stops the loop before it reaches the 
urwid.Edit itself ?

Yes, I think that is what is happening.  The Edit is within an AttrWrap, 
which is in a Padding widget.  The Padding and AttrWrap widgets keep the 
widgets they contain in members called "w".

However, this won't help you get to your help text because that is in 
your "It" class, not in the Edit widget.

I think the best thing would be to turn your It class into a widget, and 
use it directly.  You could either:
1. implement the methods shown in 
http://excess.org/urwid/reference.html#Widget_interface_definition with 
stubs that make calls to self.padd.methodname, or
2. have your It class inherit from urwid.Padding, and remove the padd 
member from your It class. (your get method could return self)
Either way once you drill down through your Columns and Padding widgets 
you will find your It object, with the help text you need.

Ian

(Sorry for the slow response, I'm at OLS this week)

cantabile | 30 Jul 08:54 2005
Picon

multi-screen app ?

Hi,
I'd like to extend the program I'm writing to a multi screen interface, 
wizard-like.
So far, I know how to draw screen but not how to clear it.
What would be the best way to get that kind of app (say : we change 
wizard page when user inputs F2, for example) ?

Thanks.

Ian Ward | 30 Jul 13:09 2005

multi-screen app ?

cantabile wrote:

> Hi,
> I'd like to extend the program I'm writing to a multi screen 
> interface, wizard-like.
> So far, I know how to draw screen but not how to clear it.
> What would be the best way to get that kind of app (say : we change 
> wizard page when user inputs F2, for example) ?
>
> Thanks.

To switch between different screens you can render a different top-level 
widget depending on which screen you want to display and pass that 
canvas to draw_screen(..).

If you want to have different screens that share the same top level 
Frame widget then you can change its body widget like this:
my_top_frame.body = some_other_body
where some_other_body is a listbox or other box widget.  Then when you 
render the top Frame widget its contents will have changed.

Ian

cantabile | 30 Jul 13:15 2005
Picon

[Fwd: Find focused Edit]

Ian Ward a ?crit :

> Ian Ward wrote:
>
> Let me know if my message is difficult to understand.. I can post some 
> code if you like.
>
> Ian
>
Hi again,
Well, I followed the second method :

class It(urwid.Padding):
     def __init__(self, titre, valeur):
       self.widget = urwid.Edit(('editcp', titre + " : "), valeur)
       urwid.Padding.__init__(self,urwid.AttrWrap(self.widget, 
'editbx','editfc')\
                              , ('fixed left',3), ('fixed right',1), 
MIDCOL)
   def get(self):
       return self

   def getval(self):
       return self.widget.get_edit_text()

   # code cut ...

Then, in my run loop, I'm drilling down like this :

                       w, pos = self.listbox.get_focus()
(Continue reading)

cantabile | 30 Jul 13:17 2005
Picon

[Fwd: Re: multi-screen app ?]


-------------- next part --------------
An embedded message was scrubbed...
From: cantabile <cantabile.03 <at> wanadoo.fr>
Subject: Re: [Urwid] multi-screen app ?
Date: Sat, 30 Jul 2005 17:14:59 +0200
Size: 1609
Url: http://lists.excess.org/pipermail/urwid/attachments/20050730/cf8548df/Urwidmulti-screenapp.mht


Gmane