Discussion:
[Urwid] Showing a dialog on top of a custom widget
Florian Paul Schmidt
2014-01-01 20:59:32 UTC
Permalink
Hi,

I looked through the tutorials and reference documentation for a
while. I'm in early stages of implementing a tracker style midi
sequencer [1][2] (for jack midi, the c++ backend is somewhat complete,
the urwid UI not at all) and while I'm pretty sure about how to
continue for my main pattern view (I will have to handle all input
manually anyways) I'm still not quite sure on how to display an
overlay dialog without that leaking up into the widget hierarchy.

Just as an example: Let's say the user wants to add a track. He
should then be prompted for the name. So ideally I'd like to "overlay"
a single line text edit over the last line (the menu) where the user
can then enter the name. The overlay widget doesn't seem right, since
the program logic to implement that would then leak down all the way
to the root of the widget hierarchy (in my case there's only one
widget for now ;D). Also it doesn't seem to like the top_w to be None..

So surely I must have overlooked something.

[1] https://github.com/fps/teqqer/teqqer.py
[2] Loading Image...

Thanks for your input,
Flo
Florian Paul Schmidt
2014-01-01 21:01:49 UTC
Permalink
Post by Florian Paul Schmidt
[1] https://github.com/fps/teqqer/teqqer.py
Oops, I shouldn't manually edit links:

https://github.com/fps/teqqer/blob/master/teqqer.py

That's the correct one.

Sorry for the noise,
Flo
Ian Ward
2014-01-01 22:25:54 UTC
Permalink
On Wed, Jan 1, 2014 at 3:59 PM, Florian Paul Schmidt
Post by Florian Paul Schmidt
Just as an example: Let's say the user wants to add a track. He
should then be prompted for the name. So ideally I'd like to "overlay"
a single line text edit over the last line (the menu) where the user
can then enter the name. The overlay widget doesn't seem right, since
the program logic to implement that would then leak down all the way
to the root of the widget hierarchy (in my case there's only one
widget for now ;D). Also it doesn't seem to like the top_w to be None..
Hi Florian,

Take a look at examples/pop_up.py.

That example creates a pop-up that is anchored to another widget on
the screen. The trick is using PopUpTarget that inserts an Overlay at
the root of the widget hierarchy when required.
Florian Paul Schmidt
2014-01-02 11:52:25 UTC
Permalink
Post by Ian Ward
Take a look at examples/pop_up.py.
That example creates a pop-up that is anchored to another widget
on the screen. The trick is using PopUpTarget that inserts an
Overlay at the root of the widget hierarchy when required.
I must have been too tired to read. Now it all makes sense..

Flo

Continue reading on narkive:
Loading...