tboox / ltui Goto Github PK
View Code? Open in Web Editor NEW🍖 A cross-platform terminal ui library based on Lua
Home Page: https://tboox.org
License: Apache License 2.0
🍖 A cross-platform terminal ui library based on Lua
Home Page: https://tboox.org
License: Apache License 2.0
The new feature causes an error when installed with luarocks, ltui/scrollbar
cannot be found. Also require("ltui")
has no index scrollbar. I will not detail further here, it is really simple actually #25
运行环境ubuntu18.04
系统默认lua是5.1的luarocks install ltui缺少curses.h没有用此方式安装
git clone了本项目而后
xmake q 下载安装了lua5.3.5 ncurses6.1,默认是放在了~/.xmake/下了
(~/.xmake/cache/packages/l/lua/5.3.5/source/lua-5.3.5/src/lua.h
~/.xmake/cache/packages/l/lua/5.3.5/source/lua-5.3.5/src/lua.hpp
~/.xmake/installed/linux/x86_64/release/l/lua/5.3.5/include/lua/lua.h)
而后,
xmake成功生成了./build/libltui.so
此时xmake run test dialog等等操作失败
/usr/bin/lua: error loading module 'ltui.lcurses' from file './build/libltui.so':
./build/libltui.so: undefined symbol: luaL_setfuncs
stack traceback:
[C]: ?
[C]: in function 'require'
./src/ltui/curses.lua:31: in main chunk
[C]: in function 'require'
./src/ltui/application.lua:30: in main chunk
[C]: in function 'require'
./src/ltui.lua:31: in main chunk
[C]: in function 'require'
tests/window.lua:27: in main chunk
[C]: ?
error: execv(/usr/bin/lua tests/window.lua) failed(1)!
这应该是运行的系统lua,和xmake生成使用的库不一致。
请问如何让xmake q安装需求库到全局?或者xmake静态链接?或者xmake run使用内部虚拟的路径?
然后又尝试,安装了libncurses5-dev
可以通过luarocks install ltui,安装ltui到全局,但是版本似乎低了,示例程序test也失败
Tried you README.md example code:
luajit ./tests/dialog.lua
luajit: error loading module 'ltui.lcurses' from file '/usr/local/lib/lua/5.1/ltui.so':
/usr/local/lib/lua/5.1/ltui.so: undefined symbol: acs_map
stack traceback:
[C]: at 0x555821e25fe0
[C]: in function 'require'
/usr/local/share/lua/5.1/ltui/curses.lua:31: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.1/ltui/application.lua:30: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.1/ltui.lua:31: in main chunk
[C]: in function 'require'
./tests/dialog.lua:27: in main chunk
[C]: at 0x555821dd01d0
luarocks install ltui
which yielded:Installing https://luarocks.org/ltui-1.5-1.src.rock
gcc -O2 -fPIC -I/usr/include/lua5.1 -c src/core/lcurses/lcurses.c -o src/core/lcurses/lcurses.o
gcc -shared -o ltui.so src/core/lcurses/lcurses.o
ltui 1.5-1 is now installed in /usr/local (license: Apache-2.0)
输入框只能输入一次,再次点击输入框不能修改内容,只能选项yes or no
输入错误后,能再次修改
嵌入式linux下,使用ssh登陆启动
ubuntu也有一样的问题
Hello, I installed ltui,
And I run the example from the front page,
I get this message:
/usr/bin/lua: error loading module 'ltui.lcurses' from file '/usr/local/lib/lua/5.3/ltui.so': /usr/local/lib/lua/5.3/ltui.so: undefined symbol: ESCDELAY stack traceback: [C]: in ? [C]: in function 'require' /usr/local/share/lua/5.3/ltui/curses.lua:31: in main chunk [C]: in function 'require' /usr/local/share/lua/5.3/ltui/application.lua:30: in main chunk [C]: in function 'require' /usr/local/share/lua/5.3/ltui.lua:31: in main chunk [C]: in function 'require' ./curses:5: in main chunk [C]: in ?
ltui version installed:
`# luarocks list ltui
ltui
1.2-1 (installed) - /usr/local/lib/luarocks/rocks`
Can you help me?
Thanks in Advance
Regards
I try to install in Windows using luarocks and I recieve the following error:
C:\Windows\system32>luarocks install ltui
Installing https://luarocks.org/ltui-1.5-1.src.rock
mingw32-gcc -O2 -c -o src/core/lcurses/lcurses.o -IC:/tools/lua/include src/core/lcurses/lcurses.c
src/core/lcurses/lcurses.c:86:10: fatal error: curses.h: No such file or directory
#include <curses.h>
^~~~~~~~~~
compilation terminated.
Error: Build error: Failed compiling object src/core/lcurses/lcurses.o
I built lua in Windows with the following steps
While building with xmake, there's an error in curses.c . error: implicit declaration of function ‘luaL_setfuncs’. This might be because the function luaL_setfuncs is not properly declared
No errors while builing
error: src/core/curses/curses.c:838:5: error: implicit declaration of function ‘luaL_setfuncs’; did you mean ‘lua_setfenv’? [-Werror=implicit-function-declaration]
Please provide the compilation or runtime environment information.
Add any other context about the problem here.
Hi, I've been looking for a good framework for working with ncurses in lua and by far this one is what works best for me.
It would be nice, though if it would support the ncurses and pdcurses ability to use mouse events. Reading the lua code I
noticed that it might be in the plans since there is a event related to it.
I've been working the last few days in the support for mouse events in ltui, and must say it was really easy to get it working
compared to other solutions. If you would be so kind of reviewing my work, I would love to contribute to this great project.
Mouse support for ltui
I've forked the code and made some small changes to it, and now it works! (at least with ncurses. couldn't get to run a
windows machine, yet)
PS: I tried to stick to the coding style as much as possible.
Do you plan utf8 support?
I added some labels into the window, but text is hidden or something.
local ltui = require("ltui")
local application = ltui.application
local event = ltui.event
local rect = ltui.rect
local window = ltui.window
local conf = ltui.menuconf
local view = ltui.view
local label = ltui.label
local app = application()
function app:init()
application.init(self, "demo")
local containers = { "container1", "container2", "container3", "container4" }
local container_window = window:new("window.container", rect { 1, 1, 50, 10 }, "containers", false)
for i = 1, 4, 1 do
container_window:insert(label:new(containers[i], rect { 2, 1 + i, 15, 2 + i }, containers[i]):textattr_set("red"))
end
self:insert(container_window)
end
app:run()
where has c++ or python lib like as this ?
$ xmake run test dialog
/home/ubuntu/.xmake/packages/l/lua/5.4.1/531f88cff3a64da0aa3fb05ee281ab7d/bin/lua: error loading module 'ltui.lcurses' from file './build/libltui.so':
./build/libltui.so: undefined symbol: lua_checkstack
stack traceback:
[C]: in ?
[C]: in function 'require'
./src/ltui/curses.lua:27: in main chunk
[C]: in function 'require'
./src/ltui/application.lua:26: in main chunk
[C]: in function 'require'
./src/ltui.lua:26: in main chunk
[C]: in function 'require'
tests/dialog.lua:27: in main chunk
[C]: in ?
error: execv(/home/ubuntu/.xmake/packages/l/lua/5.4.1/531f88cff3a64da0aa3fb05ee281ab7d/bin/lua tests/dialog.lua) failed(1)
Ubuntu 18.04.4 LTS x86_64
ltui和lcurses之前未安装, xmake运行自动安装的
Project could benefit from more thorough documentation. Demo examples are nice, but I think it could be better to show exactly what classes/API functions are available and how they are to be called, what the expected parameters are.
Add LDoc or similar doc comments to generate docs.
Other alternative would be LuaDoc. These two are the most popular on LuaRocks.
Generated docs would be comparable to Penlight's, T-Engine or similar.
Why not
Hi, it is me again
I don't know if this feature is intended or not (that is why I couldn't decide between feature or bug) but whenever a selected view in a panel is removed, the next view is selected, in a circular list fashion. Imho a stack behavior would be more useful here, maintaining the order of, for example, multiple layers of dialogs.
My suggestion would be to add an optional flag in the panel:remove()
function so that one willing to apply this behavior to a dialog (like in my case) would be able to do it by simply overwriting the dialog:quit()
function as such:
-- remove view
function panel:remove(v, stackish)
(...)
-- select next view
if self:current() == v then
if stackish then self:select_prev() else self:select_next(nil, true) end
end
(...)
end
then one would be able to write its own dialog:quit()
function like so
dialog.quit = function (self)
local parent = self:parent()
if parent then
self:action_on(action.ac_on_exit)
parent:remove(self, true)
end
end
If you dont think it is worth the trouble, though, I am happy to continue hacking my way through this beautiful code
I'm having trouble testing and using ltui. I hope the information below is enough to be helpful.
System:
Chromebook with Linux - Acer 514
uname -a output:
Linux local.______ 4.19.16-02893-g2cf2c17c8a43 #1 SMP PREEMPT Sat Jan 19 09:52:07 PST 2019 x86_64 GNU/Linux
Error output:
Lua 5.3.5 Copyright (C) 1994-2018 Lua.org, PUC-Rio
local foo = require("ltui")
error loading module 'ltui.lcurses' from file '/usr/local/lib/lua/5.3/ltui.so':
/usr/local/lib/lua/5.3/ltui.so: undefined symbol: COLORS
stack traceback:
[C]: in ?
[C]: in function 'require'
/usr/local/share/lua/5.3/ltui/curses.lua:31: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.3/ltui/application.lua:30: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.3/ltui.lua:31: in main chunk
[C]: in function 'require'
stdin:1: in main chunk
[C]: in ?
ncurses version:
$ dpkg -l | grep curses
libncurses5:amd64 6.0+20161126-1+deb9u2 amd64 shared libraries for terminal handling
libncurses5-dev:amd64 6.0+20161126-1+deb9u2 amd64 developer's libraries for ncurses
libncursesw5:amd64 6.0+20161126-1+deb9u2 amd64 shared libraries for terminal handling (wide character support)
ncurses-base 6.0+20161126-1+deb9u2 all basic terminal type definitions
ncurses-bin 6.0+20161126-1+deb9u2 amd64 terminal-related programs and man pages
ncurses-term 6.0+20161126-1+deb9u2 all additional terminal type definitions
I would like to develop ltui with C
instead of lua is it possible ?
下载源码,xmake编译,报错信息如下:
[ 50%]: compiling.release src/core/lcurses/lcurses.c
error: src/core/lcurses/lcurses.c:71:10: fatal error: 'luaconf.h' file not found
#include "luaconf.h"
^~~~~~~~~~~
1 error generated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.