qui 0.1.3
A Text User Interface library.
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
QUI
QUI is a Text User Interface library for the D Language.
It is based on adamdruppe's arsd.terminal.
Features:
- Widget-based - each widget controls a specfic part of the terminal display, one buggy widget won't mess with the whole terminal.
- Easy to get started with
- Event-based
- Support for mouse events
- Most, if not all, of the code is commented - Separate docs can be found in docs/ directory
Some examples:
LogWidget and EditLineWidget, being used to input stuff and display it:
import qui.qui;
import qui.widgets;
void main(){
App appInstance = new App;
appInstance.run();
.destroy(appInstance);
}
class App{
private:
QTerminal term;
LogWidget log;
EditLineWidget edit;
public:
this(){
term = new QTerminal("LogWidget and EditLineWidget",LayoutDisplayType.Vertical);
log = new LogWidget;
edit = new EditLineWidget("type something here: ");
// arrange them:
term.addWidget([log,edit]);
// set up event handlers
edit.onKeyboardEvent = &editKeyboardEvent;
// set up colors
log.backgroundColor = hexToColor("FFFFFF");
log.textColor = hexToColor("000000");
// editLine input colors
edit.textColor = hexToColor("000000");
edit.backgroundColor = hexToColor("BFBFBF");
// editLine caption colors
edit.captionBackgroundColor = hexToColor("FFFFFF");
edit.captionTextColor = hexToColor("000000");
}
~this(){
// clean up everyting
.destroy(term);
.destroy(log);
.destroy(edit);
}
/// starts the UI
void run(){
term.run();
}
// event handler for catching Enter key
void editKeyboardEvent(KeyPress key){
if (cast(char)key.key == '\n'){
log.add("Entered: "~edit.text);
edit.text = "";
}
}
}
The result will be something like:
- Registered by Nafees Hassan
- 0.1.3 released 6 years ago
- Nafees10/qui
- MIT
- Copyright © 2017, nafees
- Authors:
- Dependencies:
- utils
- Versions:
-
0.7.1 2023-Apr-22 0.7.0 2023-Apr-12 0.6.2 2023-Jan-12 0.6.1 2022-Oct-16 0.6.0-alpha2 2022-Oct-16 - Download Stats:
-
-
0 downloads today
-
1 downloads this week
-
1 downloads this month
-
317 downloads total
-
- Score:
- 1.1
- Short URL:
- qui.dub.pm