Hi Cary.<br><br>I have seen it but I would prefer just to add my Input-Class as a Reader to the reactor instead of using the twisted_main_loop. I have just the problem that I have no idea how I make urwid start in the beginning.<br>
<br><div class="gmail_quote">2008/12/28 Cary Hull <span dir="ltr"><<a href="mailto:cary.hull@gmail.com">cary.hull@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Did you look at this?<br>
<a href="http://excess.org/article/2008/09/urwid-gets-twisted-support/" target="_blank">http://excess.org/article/2008/09/urwid-gets-twisted-support/</a><br>
<br>
Otherwise it looks like the error you are seeing there is due to not<br>
setting up a palette.<br>
<br>
-Cary<br>
<div><div></div><div class="Wj3C7c"><br>
On Sat, Dec 27, 2008 at 10:08 AM, Christian Scharkus<br>
<<a href="mailto:mail.sensenmann@googlemail.com">mail.sensenmann@googlemail.com</a>> wrote:<br>
> Hi folks.<br>
><br>
> I've got a new question. After recongnising that the python bindings for<br>
> curses are not fully capable of displaying the unicode-chars I decided to<br>
> drop curses and shifted to urwid. Now I've got some basic questions in the<br>
> matter of urwid and twisted. As you may know I'm using a mvc-pattern and I<br>
> have not discovered a way to combine _and_ start urwid with twisted yet.<br>
> Maybe someone who already worked with urwid can give me a small hint.<br>
><br>
> Code:<br>
><br>
> <a href="http://codepad.org/0Hlvmp1b" target="_blank">http://codepad.org/0Hlvmp1b</a><br>
><br>
> class Input:<br>
> def __init__(self,term):<br>
><br>
> self.term = term<br>
> self.size = self.term.get_cols_rows()<br>
><br>
> self.input = urwid.Edit()<br>
><br>
> self.filler = urwid.Filler(self.input)<br>
><br>
> self.canvas = self.filler.render( self.size, focus=True )<br>
><br>
> self.term.draw_screen(self.size,self.canvas)<br>
><br>
> reactor.addReader(self)<br>
><br>
> def fileno(self):<br>
><br>
> return 0<br>
><br>
> def logPrefix(self):<br>
> return 'CursesClient'<br>
><br>
><br>
> def doRead(self):<br>
> keys = self.term.get_input_nonblocking()<br>
><br>
> for key in keys:<br>
> if key == 'window resize':<br>
><br>
> self.size = self.term.get_cols_rows()<br>
><br>
> elif key == 'enter':<br>
> text = self.input.get_edit_text()<br>
><br>
> controller.sendMsg('dev',text)<br>
><br>
> self.input.set_edit_text('')<br>
><br>
> else:<br>
> self.filler.keypress(self.size, key)<br>
><br>
><br>
> term = urwid.raw_display.Screen()<br>
><br>
> term.run_wrapper(lambda: Input(term))<br>
><br>
><br>
><br>
><br>
> Traceback (most recent call last):<br>
> File "./keckz.py", line 44, in <module><br>
><br>
> f.startKeckz(f.host, f.view)<br>
><br>
> File "./keckz.py", line 38, in startKeckz<br>
><br>
> controllerKeckz.Kekzcontroller(View).startConnection(host,23002)<br>
><br>
> File "/home/arch/keckz/trunk/controllerKeckz.py", line 13, in __init__<br>
><br>
> self.view = interface(self)<br>
><br>
> File "/home/arch/keckz/trunk/urwid_cli.py", line 21, in __init__<br>
><br>
> self.term.run_wrapper(lambda: Input(self.term))<br>
><br>
> File "/usr/lib/python2.6/site-packages/urwid/raw_display.py", line 212, in<br>
> run_wrapper<br>
><br>
> return fn()<br>
> File "/home/arch/keckz/trunk/urwid_cli.py", line 21, in <lambda><br>
><br>
> self.term.run_wrapper(lambda: Input(self.term))<br>
><br>
> File "/home/arch/keckz/trunk/urwid_cli.py", line 55, in __init__<br>
><br>
> self.term.draw_screen(self.size,self.canvas)<br>
><br>
> File "/usr/lib/python2.6/site-packages/urwid/raw_display.py", line 579, in<br>
> draw_screen<br>
><br>
> assert self.palette.has_key(a), `a`<br>
><br>
> AssertionError: None<br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Twisted-Python mailing list<br>
> <a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
> <a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
><br>
><br>
<font color="#888888"><br>
<br>
<br>
--<br>
01100011 01100001 01110010 01111001<br>
<br>
_______________________________________________<br>
Twisted-Python mailing list<br>
<a href="mailto:Twisted-Python@twistedmatrix.com">Twisted-Python@twistedmatrix.com</a><br>
<a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python" target="_blank">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python</a><br>
</font></blockquote></div><br>