lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Hi, everyone!

I'm here to announce AbsTK. The Abstract ToolKit is a widget toolkit for GUI and TUI (text-based user interface) applications. It allows you to, with the same source code, build a UI that runs on GUI (GTK) and TUI (Curses). AbsTK is written in Lua and uses lgi and lcurses bindings.


Install it through LuaRocks:
    luarocks install abstk

API Reference:


The goal of AbsTK is producing wizard-like applications that can run with and without a desktop environment (DE). It's worth it for machines that don't have any DE installed, but also, for instance, installers in which you may prefer a light-weight text-mode (curses) interface, instead of using a GUI.

Although the toolkit focus is on building Wizards, individual Screens can also be produced. Actually, building Screens is the main part of building a Wizard. Wizards are no much more than a group of ordered Screens.

The routine is really minimalistic, but, as stated in the previous paragraph, has two modes. To create a Screen, you initialize it and populate it with widgets. If your UI is a single Screen, just run it. If it's a Wizard, repeat the first process to produce all the Screens. When done, simply create the Wizard, populate it with the Screens and run the Wizard.


The following example is a minimalistic newsletter subscription form.
It receives the running mode ("gtk" or "curses") as argument as the module is called.
At the end, it stores all submitted info into a Lua table called data.
local abstk = require 'abstk'

local scr = abstk.new_screen("Register Form")

scr:add_label('label', "Fill the fields to register")
scr:add_text_input('email', "E-mail")
scr:add_text_input('user', "Username")
scr:add_password('pswrd', "Password")
scr:add_checkbox('news', "Send me newsletter")

local data = scr:run()

Licensed under the terms of the MIT License, the same as Lua.


Any kind of feedback is strongly encouraged. I hope you enjoy it.

Pedro Alves Valentim