Urwid-satext/en
From Goffiwiki
Contents |
Overview
Urwid-satext (Urwid SàT extension) is a library which provide widget on top of urwid. This library was initially made for SàT, but was eventually separated to be used by other projects.
Download
You can download the last version here: ftp://ftp.goffi.org/urwid-satext/urwid_satext.tar.bz2
If you want an older version, you can have it at: ftp://ftp.goffi.org/urwid-satext/
Source code is also available on the mercurial repository: ttp://repos.goffi.org/urwid-satext/
Installation
You can automatically install urwid-satext and his dependencies using easy_install or pip. You will however need to install Python's headers (needed to build Urwid). Indeed, on Debian based distribution, you can type (with the root account):
apt-get install python-pip python-dev pip install "ftp://ftp.goffi.org/urwid-satext/urwid_satext.tar.bz2"
On a *buntu, same commands with sudo:
sudo apt-get install python-pip python-dev sudo pip install "ftp://ftp.goffi.org/urwid-satext/urwid_satext.tar.bz2"
How to use
First, you can check the "examples" directory. Here is a list of widgets provided:
- 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
- FileDialog 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'.