3

I alreay can implement chat daemons using gevent and zeromq, but I'd like to make a console UI for them.

My first attempt with ncurses failed, so I tried Urwid and found out that the project nigiri was going exactly what I wanted:

Nigiri UI

I studied the source code, but being unfamiliar with console UI programming, I failed finding out the part that were producing this result (especially since it used multiple tabs), while I guess I have to play with the connect signal.

Does anybody have a snippet that can does this ?

I don't need the whole program, I can handle the communication, the daemons, the options and all the rest myself.

Just the basics to setup the UI, enter some text at the bottom, and asynchronously notify the top panel to add some text while it doesn't block the bottom ouput.

Thanks

Community
  • 1
  • 1
Bite code
  • 578,959
  • 113
  • 301
  • 329

1 Answers1

4

In computing, if you are not smart, you gotta be patient. I just applied the good old try/except keyword to my programming method:

  1. remove something from the source that doesn't relate to my feature
  2. if ok, go to 1 until the is only the essential code remains
  3. if it crashes, understand this part and why it's essential and replace it with a code that suit my needs then go back to 2

I just stripped down the nigiri source code untill it fits in one file.

It works. Now I gotta figure out how to make the urwid and zeromq main loops play nice together.

Bite code
  • 578,959
  • 113
  • 301
  • 329
  • I know this is 3 years old, but can I ask you if you came up with an easy way to do it? This question has been asked a lot, but nobody posted a working answer yet :( Thanks! – laurids Jun 04 '15 at 22:46
  • Here is an update which does not crash on current urwid/Python versions: https://gist.github.com/MarcelWaldvogel/0226812a2213dc8f67ea4cc361836de1 – Marcel Waldvogel May 11 '19 at 15:37