Giter Site home page Giter Site logo

jsqt's Introduction

Introduction

JsQt is a tool to compile QtDesigner's .ui files to javascript code, which is targeted to work with the qooxdoo framework.

There's still a lot of remaining work to support QtDesigner's feature set, yet some promising results can be obtained for a number of common use cases.

Installation

JsQt is written in Python-2.7, using lxml as the xml library of choice.

The recommended way to install JsQt is to run:

easy_install --user JsQt

This command requires a recent version of setuptools, so it may or may not work with your setup. It's the recommended way because it installs JsQt in your home directory, helping to keep your file system free from files unknown to your package manager. It installes the 'jsqt' and 'jsuic' commands in ~/.local/bin so make sure to add this path to your PATH variable.

You can of course use:

sudo easy_install JsQt

or an equivalent command to install JsQt to the central site-packages directory of the Python interpreter.

Usage

JsQt has two entry points: 'jsqt' and 'jsuic' commands. 'jsuic' is the tool that seeks to implement an interface similar to Qt's well-known uic tool. It takes a single .ui file as argument and writes the resulting qooxdoo class to stdout.

'jsqt' is a convenience wrapper around 'jsuic' that compiles .ui files in source directory to .js files in the target directory preserving directory structure and file names.

The canonical way to work with jsqt is illustrated in the test project in https://github.com/arskom/JsQt/tree/master/test:

Here's the explanation:

  1. Have your .ui files under source/xml/<root_ns>/draw/Sample.ui

  2. Compile them using:

     jsqt source/xml source/class <root_ns>
    
  3. Have overriding classes in source/class/<root_ns>/impl where you customize JsQt-generated widgets according to the needs of your application. Never use draw.* classes but always use impl.* classes in your code.

  4. Make sure that the impl directory has the same directory structure as the source/class/<root_ns>/draw and source/xml/<root_ns>

An example about how an impl.* class overrides a draw.* class can be seen in the test project: https://github.com/arskom/JsQt/tree/master/test/source/class/test/impl/Test.js

Code

At a very high level, Here's how JsQt works:

  1. Convert the incoming xml tree into a higher level object tree composed of objects from from the Interlingua (jsqt.il) package.
  2. Compile the interlingua to a tree of Javascript primitives from jsqt.js.
  3. Convert the javascript primitives to a .js file, applying miscellanous code beautification operators.

It's a non-optimizing (:)) declarative-to-imperative compiler.

The call to parser.clazz.compile() in jsqt.parser.compile is probably made to a jsqt.il.container.QMainWindow.

The compile() functions in objects from the il package (the il objects) are for generating objects' own javascript create_*() functions.

_compile_children() calls call objects' own compile() functions and adds calls to these functions in its own constructor.

The rest is hacks and infrastructure to make this design work.

Note: As of now, the dialect parameter passed to the compile() call does not have any effect.

jsqt's People

Contributors

plq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jsqt's Issues

Add support for glade UI files

Defining a generic way to support various layout schema's - ie Glade vs QT - so that new UI layout editor support can be added.

Reimplimentation from Python to NodeJS

The current qooxdoo compiler and toolchain have been reimplemented from Python to NodeJS. Converting JsQt from Python to NodeJS will enable quick addition to a Qooxdoo project using NPM.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.