[Urwid] SàT: XMPP client with urwid frontend + smalls remarks about urwid

goffi goffi at goffi.org
Mon Aug 23 03:32:36 EDT 2010


On 21/08/10 20:51, Ian Ward wrote:
> I've added a link to it from
> http://excess.org/urwid/wiki/ApplicationList  and marked it "ALPHA".
> Please update the link as you see fit.
>
>


cool, thx :)

> That's great to see.  Is there any chance you would license that file
> more permissively so that parts of it might become part of Urwid? (Urwid
> is LGPLv2)
>


Well, I will keep my main project under GPL v3, but I can understand the 
need of LGPL for a library, so what can I do is separate the widgets in 
a library, and release it under LGPL. BTW, why are you using LGPL v2 
instead of v3 ?

I would really be happy to see theses widgets part of Urwid, but I think 
the code need some work to reach your coding standard and to follow your 
coding style (it use a mix of CamelCase and underline_names as I use 
CamelCase for function names, and Urwid use underlines), it probably 
need a review from Urwid devs.

In addition, I use some stuff specific to my project, which need to be a 
little more generic (for example the code to render focus is really 
ugly). I put below a list of the available widgets. Please also note 
that I'm currently travelling, until next December, so I'm not easily 
available on IRC (I don't always have an Internet connexion), so the 
best is probably to contact me by mail.

Widgets made for SàT:
- Password: an Edit widget with an additional 'hidden_char' argument, 
this character (default '*') is showed instead of real text

- SurroundedText: Text centred on a repeated character (like a Divider, 
but with a text in the centre). I was mainly needing this for the 
LabelLine decorator (see below)

- AdvancedEdit: an Edit widget which the following added keys:
               - C-a: like 'home'
               - C-e: like 'end'
               - C-k: remove everything on the right of the cursor
               - C-w: remove the word on the left
               - Shif-[tab]: completion (I didn't used [tab] alone as 
it's already used to change focus)
    The completion use a callback defined by user, and an arg is used to 
keep track of the last completion (so if you press shift-[tab] several 
times you will roll between possible completions).

- SelectableText: a text which, as name suggest, can be selected (useful 
for e.g. making list of choices). You can define an other text/attribute 
when the text is selected (for example change the background color).

- ClickableText: a text which emit a "click" signal when [enter] is 
pressed (or mouse left button) on it

- CustomButton: quite similar to Button, but doesn't expand to all 
available room, and you can change left and right border (it was needed 
for tabs container). It can also give it's rendering size.

- GenericList/List: a wannabe List selection widget, but need work.

- NotificationBar: probably too involved with Primitivus (the urwid 
frontend for SàT) to be useful for somebody else

- MenuBox/Menu/MenuRoller: widgets to make menus (which works with 
mouse) which a box who appears to select items. You have one menu that 
you can roll with the MenuRoller (I did this to save place on screen). 
The best to understand is probably to try Primitivus or see the screenshots.

- GenericDialog/InputDialog/ConfirmDialog/Alert: common simple dialogs.

- ColumnsRoller: Put all widgets on 1 row (never more), and instead of 
hiding them when there is not enough room, it show an arrow to move 
between them (not sure to be clear !).

- FocusFrame: just a frame where you can change Focus between 
header/body/footer by pressing [tab] (except if [tab] is already used by 
one widget)

- TabsContainer: As name suggest, it's a container (often called 
"Notebook" in GUI toolkits) where you can associate tabs with "pages" 
and select them by clicking/pressing on it. When you click on a tab, the 
"page" (widget) associated with it will be showed

- LabelLine: Like LineBox except that you can change the top with a 
label (by using SurroundedText). I'm using it to save space (the title 
is on the decorator and doesn't take another line).

- VerticalSeparator: Draw a line (or any character) on the left and/or 
right of a widget

and the FilesViewer widget use lot of the above widgets and has the 
following features:
     - a path line on the top with all the features of AdvancedEdit, 
where C-w delete smartly one path part (e.g.: '/home/toto' + C-w ==> 
'/home').
	When you change a path, if it's a dir, the files list is automatically 
updated.
	If you press '~' as first character, '/home/[username]' will appear 
automatically.
	Completion works: for exemple if you are in '/home', press shit-[tab] 
to roll between user names.
     - a bookmark part on the left: it try to read gtk and kde's 
bookmarks and show them. It can be nice to have a way to add our own 
bookmarks.
     - the right part show files: the directory on the top, and the 
files below. Pressing 'meta-d' go in directories, 'meta-f' go in files. 
meta-h (un)hide hidden files. If you write the first characters of a 
file, you will go directly on it. For e.g. if you are in '/usr', 
pressing 'g' and 'a' will go on 'games'.

cheers
Goffi



More information about the Urwid mailing list