wpm = Widget python manager v0.1
- Install dependencies
pip install -r requirements.txt # None right now, numpy is not needed unless 3d
- Install curses manually
- Go to this repository: http://www.lfd.uci.edu/~gohlke/pythonlibs/
- Download wheel file with your python version, in example: 'curses‑2.2‑cp36‑cp36m‑win_amd64.whl'
- Install it manually with:
python -m pip install curses‑2.2‑cp36‑cp36m‑win_amd64.whl
- Install a compatible shell:
- Windows: git-bash or Cygwin works good.
- GNU/Linux, you can check your colors using
tput colors
- /bin/sh has 8 colors. No recommended.
- /usr/bin/bash has 256 colors. Recommended.
- xterm emulator works fine.
- If you use guake, only 8 colors with 256 terminal, try add to your .bashrc to:
export TERM=xterm-256color
. If you have bug�]777;notify;Command completed;
add in another line:unset PROMPT_COMMAND
too.
- MacOS: xterm-2 is nice.
-
Wpm is a class manage screen and associated widgets, elements and functions. Manager to initialize/respoter terminal, manage widget stack and control all UI.
-
Element is a Dummy interactive class with a low level functionality. It contains a curses WindowClass. Calling its functions can be drawn in different ways.
-
Widget is a interactive class with high level functionality. It have a element with width, height, x and y. Also run function to take I/O control. It ccan generate control and actions externally.
-
TODO: Remove window parameter. Apply with manager all actions a current windows only (easier) or allow to use window parameter (more complicated, more versatile)?
- All data struct shall be classes without constructor.
- Manager will use a internal stack to manage different widgets.
- All operations are applied to last widget.
- Classes shall use heiratch
- Widget types:
- Widget_activity
- Widget_menu (buy_menu example)
- more...
- Widget_button: (button example)
- Widget_popup
- Widget_popup_warning: Warning message, ok button. Yellow or special movie.
- Widget_popup_okcancel: Ask user ok or cancel button.
- Widget_help: Print a message, ok button.
- Widget_activity
- themes: Change different themes to use different colors. (Use a palette, change a color type without affect others)
A element is an object with low level logic. It hierachy from window, adding functions to print inside.
- All element have a status
- It can be draw calling draw method.
A button is a class with 4 states:
- Normal: The button is active. It is selectable.
- Inactive: The button is not selectable.
- Focus: The button is ready to be pushed.
- Pushed: The buttons has been pushed and will release.
A widget is an object with high level logic. All widget can contain one or more elements and a function to take control.
- It can be draw calling draw method. This refresh all child elements. Update first foreground and then front elements.
Style Index of Python Enhancement Proposals
wpm is using curses. But it shall transparent to the users. Users shall not parse exceptions while using wpm, but all problems shall be reported in a error file. CONTRIBUTING: Rebase pulls: git config --global pull.rebase true
Logs are required. Print into a file.
All exceptions shall be in a try, and pass the execution, reporting problem in a error.log
Using Codacy to analyze code status
Using travis to test library