a python terminal gui?

Subject: a python terminal gui?

Date: Fri, 20 May 2011 11:47:41 +0100

To: notmuch-list

Cc:

From: Patrick Totzke


Hi all,

First of all, Thanks to everybody involved in the project. Using notmuch is
good fun and I totally agree that the spin-off/rewrite of sup is a great idea.
However, as a vim user I feel that the one thing that's truly missing is a 
maintainable, feature-rich commandline GUI. Let's change that.
I'm aware of existing proposed guis: vala-notmuch, notsomuch, I have also seen 
a minimal non-oop python gui that doesn't use the python bindings and whose name 
I forgot.

This is a proposal for a terminal gui, written in python.
Currently, it is more a sketch of a framework, so let me explain the key ideas here:

* I use python because I personally am heavily biased in the python vs. ruby discussion:
  I've been working with python for a while and have never used ruby anywhere else than 
  for my sup-mail config. I find rubys syntax highly unintuitive, had (and still have)
  problems to install/work with up-to-date ruby-gems on my ubuntu system.
  Also, I read somewhereâ„¢ that sup is based on a email library that is no longer maintained.
  I know these are only my personal, non representative and maybe uninformed impressions,
  but I have the feeling that I'm not alone here.
  On the other hand, cnotmuch and all other libs I (plan to) use in this project
  were easy_installed without any problems.

* I want a gui that looks and feels like sup, without the ugly parts.

* use libraries wherever possible. Therefore, instead of
  programming raw curses, I go for the urwid toolkit: It's a bit like gtk,
  you create a bunch of widgets and put them together in a tree-like structure
  and the library handles redrawing the screen and redirecting key presses etc.
  I'm aware of some arguments against urwid (PEP8 compatibility, slow py3k awareness),
  but consider the advantages:
   - no boring and error-prone ncurses hacking
   - possibly multiple frontends (curses, web)
   - correct display of unicode chars
   - a lot of ready-made widgets are available (textboxes, selectable lists). There's even
     an additional widget-lib called urwid-sat that defines widgets for password inputs etc.
   - ready made colour theming for mono/16/256 colours.
   
  one might also look around for a mutt/abook contact lib

You can find the code at here: https://github.com/pazz/notmuch-gui 
Obviously, there is a lot that's missing, but I think having this framework makes it easier
for anyone to contribute. For example, to be able to display mails,
one could code a urwid.Widget that can display a given email.message.Message.
That widget will then be used in a widget that displays a whole notmuch.thread
which we could put inside a new buffer class that extends my ng.buffer.Buffer
So far, there are only two modi (ng.buffer.Buffer subclasses):
a bufferlist and one to display thread search results.

I consider all of this to be a proof-of-concept, any part of this proposal
is up for discussion. I'd be interested in any feedback whatsoever, and happy
to delegate work to anybody willing to contribute. I'm aware that the code
is not pretty, probably not the sleekest oop design and non-conforming 
with a lot of conventions. Hit me :)

Cheers,
/pazz

signature.asc (application/pgp-signature)

Thread: