Re: Create pile from list
2009-06-01 16:01:51 GMT
Fabian Braennstroem wrote: > Hi, > > I would like to create a pile from a list of e.g. 'Text' widgets. > Right now, I am doing something like this: > > self.piler=Pile([Button(liste[0]) ,Text(liste[1]) > ,Text(liste[2]),Text(liste[3]) ,Edit(liste[4]) ,Text(liste[5]) > ,Text(liste[6]) ,Text(liste[7]) ,Text(liste[8])]) > > but in general I have no idea about the length of the list, so a loop > over every list item would be needed. Does anyone have an idea? Are you just asking how to make a Text widget for every item in a list? Pile([Text(x) for x in liste]) > And one more question, I am often using a simple 'print' to 'debug' > certain variables, but this does not work in background!? Thanks! The best way of handling debugging at the moment is to use the python logging module to log to a file. printing will disturb urwid's output. There is some interesting work going on in this area, however. Hopefully Andrew will have some code to post soon. Ian
Re: integrated ipython terminal
2009-06-01 16:05:27 GMT
Fabian Braennstroem wrote: > Hi, > > is there a chance to integrate an ipython terminal region in urwid? > There is the beginning of a regular python shell in the example program "shell.py" in the development version. Currently it has display issues because it is using a new mode of output that integrates with the regular command prompt, instead of using the alternate buffer. That display code doesn't work very well yet. Ian
Re: Create pile from list
2009-06-02 05:02:21 GMT
Hi Ian, Ian Ward wrote: > Fabian Braennstroem wrote: >> Hi, >> >> I would like to create a pile from a list of e.g. 'Text' widgets. >> Right now, I am doing something like this: >> >> self.piler=Pile([Button(liste[0]) ,Text(liste[1]) >> ,Text(liste[2]),Text(liste[3]) ,Edit(liste[4]) ,Text(liste[5]) >> ,Text(liste[6]) ,Text(liste[7]) ,Text(liste[8])]) >> >> but in general I have no idea about the length of the list, so a loop >> over every list item would be needed. Does anyone have an idea? > > Are you just asking how to make a Text widget for every item in a list? > Pile([Text(x) for x in liste]) Ah, quite simple... this probably works for every widget as long as there is no mixing between different widgets. > >> And one more question, I am often using a simple 'print' to 'debug' >> certain variables, but this does not work in background!? Thanks! > > The best way of handling debugging at the moment is to use the python > logging module to log to a file. printing will disturb urwid's output. > > There is some interesting work going on in this area, however. > Hopefully Andrew will have some code to post soon.(Continue reading)
How to capture & display output from second application in the background?
2009-06-04 21:38:33 GMT
Hello,
I am trying to figure out how to fork a command in the background and
capture that program's stdout into a listbox, but I'm new to urwid and
programming with threads.
To be specific, my aim is to write a mail client with a urwid front
end that uses offlineimap running in the background to keep my local
mail store in sync with the server. I want to have the output from
offlineimap stored in a hidden listbox for both "wow" factor, and as a
debugging tool.
Here's a small example to show you what I mean:
Tiny program that outputs text like how offlineimap outputs text:
# doubler.py
#!/usr/bin/env python
import time
def godouble():
a = 1
c = 0
while 1:
a *= 2
c += 1
print a
time.sleep(1)
if c > 100: break
if __name__ == '__main__':
godouble()
(Continue reading)ANN: PuDB - the Python Urwid Debugger
2009-06-09 05:34:58 GMT
Hi all, I'm happy to announce the first public release of PuDB, the Python Urwid Debugger. You can get it from its PyPI page, here: http://pypi.python.org/pypi/pudb I'll announce this on python-dev in a few days--first I'd like to seek the feedback of a smaller group of people. :) If anything breaks, feel free to complain. While I'm at it, two questions for Ian: - I'd love to be able to replace the hardcoded sys.stdout in raw_display. Would you take a patch? (This would allow me to implement an option to hijack sys.stdout. This would get rid of the annoying flicker on every program execution step.) - What's the perspective for the next release? PuDB's interface looks even nicer when it can use underline and bold. :) Andreas
_______________________________________________ Urwid mailing list Urwid <at> lists.excess.org http://lists.excess.org/mailman/listinfo/urwid(Continue reading)
Re: ANN: PuDB - the Python Urwid Debugger
2009-06-09 13:53:09 GMT
Hi,
Looks very promising. However, a couple of issues I encountered:
* When using the "q" key to quit, I cannot see any of the characters I enter into the terminal after pudb exits until I reset the terminal using the "reset" command.
* When using the "!" key to invoke a Python shell, I cannot see anything I type and the prompt is not aligned with the left side of the screen. Typing blindly still results in the expected output, which is also not left-aligned.
* For whatever reason, the __file__ variable does not exist when using PuDB, which causes my test program to raise an exception that is not raised when it is executed normally.
I am using the Gnome terminal, Python 2.6, Urwid 0.9.8.4 on Ubuntu 9.04. The program I was running was wicd-client (from wicd) using python -m pudb /usr/lib/wicd/wicd-client.py.
A couple other things that aren't bugs, but should perhaps be considered:
* In the Gnome terminal, F1 is mapped to the terminal's help command, so pressing it does not have the desired effect until terminal's help is disabled. You may wish to consider changing the key from F1 to something else.
* Syntax highlighting is silently disabled if pygments is not installed. Perhaps a short warning or a message the first time the program is run indicating the problem?
Other than those things, it looks very useful. I'm not an expert on Urwid, so I can't give you too much of an idea on how to fix the above problems, but this is the Urwid mailing list, so I expect someone else on here probably can ;)
Let me know if you want screenshots or want me to test something.
Adam
Hi all,
I'm happy to announce the first public release of PuDB, the Python Urwid
Debugger. You can get it from its PyPI page, here:
http://pypi.python.org/pypi/pudb
I'll announce this on python-dev in a few days--first I'd like to seek the
feedback of a smaller group of people. :) If anything breaks, feel free to
complain.
While I'm at it, two questions for Ian:
- I'd love to be able to replace the hardcoded sys.stdout in raw_display.
Would you take a patch? (This would allow me to implement an option to hijack
sys.stdout. This would get rid of the annoying flicker on every program
execution step.)
- What's the perspective for the next release? PuDB's interface looks even
nicer when it can use underline and bold. :)
Andreas
_______________________________________________
Urwid mailing list
Urwid <at> lists.excess.org
http://lists.excess.org/mailman/listinfo/urwid
_______________________________________________ Urwid mailing list Urwid <at> lists.excess.org http://lists.excess.org/mailman/listinfo/urwid
Re: ANN: PuDB - the Python Urwid Debugger
2009-06-09 14:53:00 GMT
On Dienstag 09 Juni 2009, you wrote: > * When using the "q" key to quit, I cannot see any of the characters I > enter into the terminal after pudb exits until I reset the terminal using > the "reset" command. Is the program you're debugging using urwid as well? I saw some urwid code in wicd. If so, pudb and your code are fighting over the use of the alternate buffer, and the result is likely garbage. Fixing his depends on the "output hijacking" I mentioned. It's kind of ironic that Urwid code would be the one type of code which pudb doesn't usefully debug. :) If you're not using urwid (or other curses stuff), then I don't know. I can't reproduce this on "regular" code. > * When using the "!" key to invoke a Python shell, I cannot see anything I > type and the prompt is not aligned with the left side of the screen. Typing > blindly still results in the expected output, which is also not > left-aligned. Likely the same issue as above. > * For whatever reason, the __file__ variable does not exist when using > PuDB, which causes my test program to raise an exception that is not raised > when it is executed normally. Fixed. > I am using the Gnome terminal, Python 2.6, Urwid 0.9.8.4 on Ubuntu 9.04. > The program I was running was wicd-client (from wicd) using python -m pudb > /usr/lib/wicd/wicd-client.py. > > A couple other things that aren't bugs, but should perhaps be considered: > * In the Gnome terminal, F1 is mapped to the terminal's help command, so > pressing it does not have the desired effect until terminal's help is > disabled. You may wish to consider changing the key from F1 to something > else. Fixed. > * Syntax highlighting is silently disabled if pygments is not installed. > Perhaps a short warning or a message the first time the program is run > indicating the problem? Fixed. (Currently, this is "every time the program is run".) > Other than those things, it looks very useful. I'm not an expert on Urwid, > so I can't give you too much of an idea on how to fix the above problems, > but this is the Urwid mailing list, so I expect someone else on here > probably can ;) I've rolled 0.90.4 with the above fixes. Andreas
_______________________________________________ Urwid mailing list Urwid <at> lists.excess.org http://lists.excess.org/mailman/listinfo/urwid
Re: ANN: PuDB - the Python Urwid Debugger
2009-06-09 15:08:58 GMT
> Is the program you're debugging using urwid as well? Not the part that I was testing it on. I can reproduce it on the debug_me.py file included with the tarball as well, using the 0.90.3 release in both gnome-terminal and xterm. I'll give it a try with the 0.90.4 release tomorrow and let you know. Adam On Tue, Jun 9, 2009 at 10:53 PM, Andreas Klöckner <lists <at> informa.tiker.net>wrote: > On Dienstag 09 Juni 2009, you wrote: > > * When using the "q" key to quit, I cannot see any of the characters I > > enter into the terminal after pudb exits until I reset the terminal using > > the "reset" command. > > Is the program you're debugging using urwid as well? I saw some urwid code > in > wicd. If so, pudb and your code are fighting over the use of the alternate > buffer, and the result is likely garbage. Fixing his depends on the "output > hijacking" I mentioned. It's kind of ironic that Urwid code would be the > one > type of code which pudb doesn't usefully debug. :) > > If you're not using urwid (or other curses stuff), then I don't know. I > can't > reproduce this on "regular" code. > > > * When using the "!" key to invoke a Python shell, I cannot see anything > I > > type and the prompt is not aligned with the left side of the screen. > Typing > > blindly still results in the expected output, which is also not > > left-aligned. > > Likely the same issue as above. > > > * For whatever reason, the __file__ variable does not exist when using > > PuDB, which causes my test program to raise an exception that is not > raised > > when it is executed normally. > > Fixed. > > > I am using the Gnome terminal, Python 2.6, Urwid 0.9.8.4 on Ubuntu 9.04
_______________________________________________ Urwid mailing list Urwid <at> lists.excess.org http://lists.excess.org/mailman/listinfo/urwid
Re: ANN: PuDB - the Python Urwid Debugger
2009-06-09 15:18:29 GMT
On Dienstag 09 Juni 2009, Adam Blackburn wrote: > > Is the program you're debugging using urwid as well? > > Not the part that I was testing it on. I can reproduce it on the > debug_me.py file included with the tarball as well, using the 0.90.3 > release in both gnome-terminal and xterm. I'll give it a try with the > 0.90.4 release tomorrow and let you know. .4 will be the same .3. Ian, any idea why that might be happening? Andreas
_______________________________________________ Urwid mailing list Urwid <at> lists.excess.org http://lists.excess.org/mailman/listinfo/urwid
RSS Feed