qui 0.1.3

A Text User Interface library.


To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

QUI

QUI is a Text User Interface library for the D Language. It is based on adamdruppe's arsd.terminal.

Features:

  1. Widget-based - each widget controls a specfic part of the terminal display, one buggy widget won't mess with the whole terminal.
  2. Easy to get started with
  3. Event-based
  4. Support for mouse events
  5. 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: alt text

Authors:
  • nafees
Dependencies:
utils
Versions:
0.1.3 2018-Jan-19
0.1.2 2017-Aug-06
0.1.1 2017-Jun-15
0.1.0 2017-Apr-25
0.0.1 2017-Apr-23
Show all 6 versions
Download Stats:
  • 0 downloads today

  • 2 downloads this week

  • 2 downloads this month

  • 48 downloads total

Score:
0.8
Short URL:
qui.dub.pm