Is there a cross-OS GUI framework that supports em

2019-03-10 05:14发布

I want to develop a desktop app to be used cross-system (win, mac, linux), is there a GUI framework that would allow me to write code once for all 3 platforms and have a fully-scriptable embedded web component?

I need it to have an API to communicate between app and webpage javascript.

I know C#, JavaScript and a little bit of python.

9条回答
时光不老,我们不散
2楼-- · 2019-03-10 05:51

Qt has such a thing with QWebView.

查看更多
不美不萌又怎样
3楼-- · 2019-03-10 05:51

What's wrong with Mono and WinForms

查看更多
家丑人穷心不美
4楼-- · 2019-03-10 05:52

Since my first answer was for wxWidgets and you feel Qt is not for you...
You mentioned not javascript - note that PyQt "provides [python] bindings for Qt 2 and Qt 3". PySide is Nokia's official Python bindings for Qt. A "PyQt vs PySide" search provides interesting results:

There's also PythonQt but I haven't looked into it at all.

FYI,

  • Qt Networking examples
  • Qt WebKit examples:

    Qt provides an integrated Web browser component based on WebKit, the popular open source browser engine.

    These examples and demonstrations show a range of different uses for WebKit, from displaying Web pages within a Qt user interface to an implementation of a basic function Web browser.

  • Qt also supports C#
  • and many other languages.
  • KDE (Linux Desktop Environment) uses and develops Qt

Anything specific about Qt that makes it 'not a great fit' for you?

查看更多
太酷不给撩
5楼-- · 2019-03-10 05:58

There is also TideSDK formally known as Titanium. This provides a WebKit HTML/JavaScript widget that does pretty much everything you could want, including running the Chrome developer tools.


EDIT below. Consolidating my update with feedback from the TideSDK developers:

TideSDK, formerly Titanium Desktop, is an open source software development kit for creating multi-platform desktop apps using HTML5, CSS3, JavaScript and other common scripting languages. The project is hosted on Github. The main web site has comprehensive documentation and hosts an active developer community. Thousands of developers have used the former Titanium Desktop to develop deskop applications. Perhaps the most recognized applications is Wunderlist

TideSDK allows you to use your web development skills to create desktop apps and provides wide range of privileged APIs. You can easily extend the functionality of your app using mature libraries in python, php or ruby.

The heart of TideSDK is an object bridge compiled into the WebKit component. The bridge allows other scripting languages - python, php or ruby - to run on the HTML page using script tags in the DOM, just like JavaScript. You can also directly call .py, .rb or .php files from within your application.

TideSDK can be used with no more than a basic text editor - it does not need any special tools or an IDE although many developers prefer richer tools. TideSDK includes command-line tools for running your application locally (for development and debugging) and also to package it into an installer for the OS that you are developing on (Windows, Mac OSX and Linux are supported). To get all the needed installers, a typical TideSDK development environment will include a physical or virtual machine for each OS. The TideSDK team is looking to implement a different and better way soon.

The TideSDK team is currently developing a TideSDK Builder app. It will provide a GUI for creating, running and packaging TideSDK apps. To get developers started faster, TideSDK Builder introduces a new feature - Scaffolds. Scaffolds generate all the boiler plate to instantiate a projects with specific patterns of development such as Backbone MVC. Developers can use TideSDK Builder to create, import and share scaffolds.

The roadmap for TideSDK includes the implementation of CommonJS for 1.4 which aims to provide developers with a more modular development experience using JavaScript.

Hello World

A TideSDK project consists of some boilerplate code with a Resources folder that contains the core project files. The following illustrates the stucture of a simple hello world app that will run on all supported plaforms:

├── CHANGELOG.txt
├── LICENSE.txt
├── README.md
├── Resources
│   ├── app.js
│   ├── default_app_logo.png
│   └── index.html
├── manifest
└── tiapp.xml

The manifest contains information about the runtime modules used by the project. tiapp.xml provides configuration and default_app_logo.png is the image that will appear by default in the dock, system tray or in the windows of your app.

The following is the contents of the app.js file for the hello world example (as it will appear in TideSDK 1.3.0). Previous versions will have used the Titanium namespace which has been discontinued.

// create and set menu
var menu = Ti.UI.createMenu(),
fileItem = Ti.UI.createMenuItem('File'),
exitItem = fileItem.addItem('Exit', function() {
  if (confirm('Are you sure you want to quit?')) {
    Ti.App.exit();
  }
});

menu.appendItem(fileItem);
Ti.UI.setMenu(menu);

Here is the HTML for the same app. It calls the script above.

<!DOCTYPE html>
<html>
<head>
  <title>Hello World</title>
  <style type="text/css">
    body {background: #fff;}
  </style>
</head>
<body>
  <h1>Hello World</h1>
  <script type="text/javascript" src="app.js"></script> 
</body>
</html>

In less than 10 lines of JavaScript code, we create a menu, adding 'File' and 'Exit' menu items, and set it to the main window. A simple callback method is used to pop open a exit confirmation dialog. If the user confirms, the app will exit.

Background

Titanium was developed by Appcelerator and made available under the Apache 2 Licence. Originally Appcelerator provided the open source Titanium Developer to create projects. Later Appcelerator introduced the closed source Titanium Studio, an IDE on top of Aptana. While it currently remains possible to develop TideSDK in Titanium Studio, a plugin may be required in the future. [Andrew: sorry, this is not clear to me. A plugin to Titanium Studio? Or Aptana? Or the TideSDK?]

Appcelerator has supplied an TiStudio SDK to use to use that might assist us in creating a plugin to TiStudio to allow TideSDK to be used through TiStudio

查看更多
霸刀☆藐视天下
6楼-- · 2019-03-10 06:01

I'm going to throw this one out:

AppJS: http://appjs.org/

查看更多
Summer. ? 凉城
7楼-- · 2019-03-10 06:02
  1. It is strange that Qt is not for you. You may be surprised to hear Sencha's Architect and Animator products use Qt and QWebView for cross platform JavaScript applications with full menus and icons and executables and system dialog boxes and file I/O.

    It currently works Windows, OSX, and Linux.

    They use an in-house developed library called ion to load and interact a JavaScript application. They provide some helper classes for JS to use.

    A simple skeleton c++ application which uses Qt to create and load a window and create a web view in that window and load html and other content from file into that view.

  2. Another solution is Adobe's Air which is like a browser with native support. It also provides deployment.

查看更多
登录 后发表回答