GUI/TUI Linux 库

发布于 2024-07-04 06:11:23 字数 97 浏览 10 评论 0原文

是否有任何 UI 库可以从同一源构建文本用户界面(ncurses)和图形用户界面(GTK?QT?)? 我知道 debconf 可以与各种前端一起使用,我想构建类似但可编程的东西。

Is there any UI library that can be to build both a text user interface (ncurses) and graphical user interface (GTK? QT?) from the same source?
I know that debconf can be used with various frontends, I would like to build something similar but programmable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

浪菊怪哟 2024-07-11 06:11:24

您可以编写使用 ncurses 的程序,然后使用 PDCurses 将其转换为 X11 应用程序 - 作为自述广告。

我知道它是因为我用它作为便携式诅咒,尽管我从未测试过它的 X11 功能

you could write your program to uses ncurses, and then use PDCurses to convert it to an X11 application - as the readme advertise.

I know it because I've used it as portable curses, though I've never tested its X11 capabilities

心不设防 2024-07-11 06:11:24

也许 tcl/tk 会提供您想要的http://www.tcl.tk/

这是有关的页面与诅咒接口。 有人声称与 ncurses 集成。

http://www2.tcl.tk/2372

Maybe tcl/tk would provide what you want http://www.tcl.tk/

Here's the page on interfacing with curses. There is a claim there of integration with ncurses.

http://www2.tcl.tk/2372

友欢 2024-07-11 06:11:24

我认为编译时用于配置linux内核的是dialog/cdialog/xdialog。 但自从我编译内核以来已经有一段时间了,所以我的记忆可能已经消失了。 我能找到的最有希望的链接是 Xdialog 的链接。

I think what's used for configuring the linux kernel when compiling is dialog/cdialog/xdialog. But it's been a while since I've compiled a kernel, so my memory may be off. The most promising link I can find is this one for Xdialog.

故事灯 2024-07-11 06:11:24

诅咒 GTK,但似乎有点过时了。 我发现了一些对 Qt 到 ncurses 的端口(称为 Qt Console)的引用,但它似乎已经消失了。

There's Cursed GTK, but it seems a bit dated. I found some references to a port of Qt to ncurses called Qt Console, but it seems to have disappeared.

只是偏爱你 2024-07-11 06:11:24

通过使用同时针对文本模式和 GUI 环境的库,您将面临陷入两全其美的困境的巨大风险。

您最好使用 MVC 模式 构建代码,并提供单独的您针对的每个目标平台的视图和控制器。 将所有逻辑下推到模型类还有其他几个好处:

  • 代码将更容易测试,因为您被迫将用户界面置于实际的域逻辑之外。
  • 您的程序可能具有几乎没有共同点的用户界面,例如 Web UI 或由语音驱动的 UI。
  • 通过以与控制器类相同的方式直接访问模型类,您可以在根本没有 UI 的情况下轻松运行程序(即编写脚本)。

By using a library that targets both the text-mode and GUI environments, you have a big risk of getting stuck with the worst of both worlds.

You will be better off structuring your code using the MVC pattern, and providing separate views and controllers for each platform you target. Pushing all the logic down to the model classes has several other benefits:

  • The code will be easier to test because you are forced to keep the user interface out of the actual domain logic.
  • Your program can have user interfaces that have very little in common, e.g. a web UI, or an UI driven by speech.
  • You can run the program easily with no UI at all (i.e. script it) by accessing the model classes directly in the same way that the controller classes do.
幸福丶如此 2024-07-11 06:11:24

GoboLinux 人员已经为 Python 创建了自己的工具包,名为 AbsTK,他们将它用于他们的安装程序,实际上效果非常好。 我自己从未使用过该工具包,但用它构建的应用程序似乎很可靠。

The GoboLinux guys have created their own toolkit for python called AbsTK, they use it for their installer, which actually works really good. I have never used the toolkit myself, but the apps built with it seems solid.

梦在深巷 2024-07-11 06:11:24

不完全是一个库,但您可以考虑编写一个可以很好地降级为 Lynx 的 Web 应用程序

Not exactly a library but you could consider writing a web app that degrades well to Lynx

甜中书 2024-07-11 06:11:23

该库支持 YaST 独立性,使用一个代码库执行 ncurses、gtk 和 qt,可提供您所需的内容,并且它与 YaST 本身无关。

实际上libyui只需要标准C++库和phtreads(IIRC)。 UI 插件当然需要相应的库(Qt、ncurses)。 YaST 通过一组 YCP 绑定使用 libyui,这些绑定在 libyui 之上导出类似 YCP 的 API。

该库有点低级(事件循环下面的一层),我的同事 Klaus Kämpf 不久前在 他的博客,包括使用 swig 绑定到脚本语言。

SUSE 特有的唯一部分是打包,因此您需要自己打包。 Stackoverflow 不允许我多次链接。 该库的代码链接自 Klaus 博客。 将 libyui 替换为插件代码的“qt”和“ncurses”。

还可以在 google 上搜索“YaST Independence From YCP”,找到 Andreas Jäger 关于该主题的博客文章。

The library that powers YaST independence to do ncurses, gtk and qt with one codebase provides what you are looking for, and it is not tied to YaST itself.

Actually libyui only requires the standard C++ library and phtreads (IIRC). The UI plugins require of course the respective libraries (Qt, ncurses). YaST uses libyui via a set of YCP bindings that export a YCP like API on top of libyui.

The library is a bit lowlevel (one layer below an event loop), my colleage Klaus Kämpf wrote about using it some time ago in his blog, including binding to scripting languages it using swig.

The only part that is SUSE specific is the packaging, so you would need to package it yourself. Stackoverflow did not allow me to link more than once. The code of the library is linked from Klaus blog. Replace libyui for "qt" and "ncurses" for the plugin's code.

Also google for "YaST Independence From YCP" to find a blog entry from Andreas Jäger on the subject.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文