GUI 应用程序中的 Web 技术 [英] Web technologies in GUI apps

查看:45
本文介绍了GUI 应用程序中的 Web 技术的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您在使用网络技术(HTML、XML、CSS、JavaScript)实现 GUI 应用程序的部分功能方面有何经验?优点和缺点,请.

What's your experience in using web technologies (HTML, XML, CSS, JavaScript) to implement part of the functionality of a GUI application? Pros and cons, please.

没有用于会话管理的服务器、关系数据库、AJAX 或 cookie,也没有现有的网络应用程序,而是使用网络小部件(如 Qt WebKit) 来渲染和处理 UI 的重要部分,同时利用 GUI 框架实现更丰富的交互和更好的桌面集成.

No servers, relational databases, AJAX, or cookies for session management, nor an existing webapp either, but rather a GUI app that uses web widgets (like Qt WebKit) to render and handle substantial parts of the UI, while taking advantage of a GUI framework to achieve an even richer interaction and better desktop integration.

我已经验证了该方法可以使用 PyQt.内容可以从文件系统或字符串呈现,URL 请求(图像或点击)可以被表单的事件处理程序捕获和提供.支持 CSS 和 JavaScript,但可能有一些限制.

I've already validated that the approach is possible using PyQt. Content can be rendered from the file system or from strings, and URL requests (images or clicks) can be captured and served by the form's event handlers. CSS and JavaScript are supported, perhaps with some limitations.

        # ...
        self.webView.page().setLinkDelegationPolicy(
            QtWebKit.QWebPage.DelegateExternalLinks
            )
        #... 

class TotiMainWindow(QtGui.QMainWindow):
    def linkClicked(self, url):
        pass # events arrive here

注意:这个问题不同于 这个这个之前制作,除其他外,因为不要求在 GUI 上使用 Web 技术,但要求应用程序应该在没有可用网络连接的情况下工作,并且应该与不同平台上的默认桌面很好地集成,无需先前的基础设施要求(无 .NET、Java、浏览器或数据库服务器).

Note: This question is different from this one and this one made before, among other things because there is no requirement to use web technologies on the GUI, but there is the requirement that the application should work without a network connection available, and should integrate well with the default desktop over different platforms, without previous infrastructure requirements (no .NET, Java, browsers, or database servers).

注意:我在 PMS 上发布了这个问题的不同版本,但在那里发现这种方法的经验很少.

我刚刚在一系列 André Pareis 的博文.

推荐答案

我们在 Windows XP 刚推出时就为一个项目做了这件事.

We did exactly this for a project back when Windows XP was new.

这给我的团队带来了几个好处:

This gave my team several benefits:

  • 一个相对简单的漂亮用户界面
  • 使用 CSS 以一致的方式轻松更改 UI 的样式
  • 与 C++ 的集成相对简单(从 ui 调用函数,反之亦然)

我们看到的缺点是:

  • 一些不太好的防火墙将访问内部资源(即 ui 中的其他 html 页面)视为网络请求
  • 在某些情况下添加和访问所需资源可能有点麻烦
  • 可能在 Internet Explorer 中设置了阻止 JS 在应用程序中运行的属性

请注意,一些 Windows XP:s 程序正在使用这种方法.

Note that some of Windows XP:s programs are using this approach.

这可能最适合 ui 中更像向导的小部分(我们的 ui 几乎完全由这些部分组成).

This probably works best with small, more Wizard-like parts of the ui (which our ui consisted almost entirely of).

从那时起我就没有真正参与过 ui 项目,所以我不能真正告诉你这种方法是否仍然有效......我知道基于 MFC 的应用程序可以让你使用基于 HTML 的对话框.

I have since then not really been involved in ui projects, so I cannot really tell you whether this approach is still valid... I know that MFC-based applications will let you use HTML-based dialogs though.

这篇关于GUI 应用程序中的 Web 技术的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆