Code Monkey home page Code Monkey logo

laogong5i0-2 / slint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from slint-ui/slint

0.0 0.0 0.0 16 MB

(是一个GUI工具集,同时适用于嵌入式系统、桌面系统、移动端、浏览器(WASM),支持使用多种语言进行开发`Rust`,背后有商业公司的支持,未来前景看好。)Slint is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. We support multiple programming languages, such as Rust, C++ or JavaScript.

Home Page: https://slint-ui.com

License: Other

Shell 0.18% JavaScript 0.48% C++ 5.34% Scheme 0.04% Python 0.13% Rust 92.23% TypeScript 0.92% HTML 0.10% CMake 0.58%

slint's Introduction

SlintSlint

Formerly known as

Build Status REUSE status Discussions

Slint is a toolkit to efficiently develop fluid graphical user interfaces for any display: embedded devices and desktop applications. We support multiple programming languages, such as Rust, C++, and JavaScript.

Our design goals are:

  • Lightweight: Fit into a few hundred kilobytes of RAM and require little processing power.
  • Straightforward: Programmers and designers should feel productive and be able to enjoy the design and development process. The APIs should be consistent, easy to use, and intuitive, no matter the target language. High-quality documentation should describe the APIs, teach concepts and how to use them.
  • Native: We support many different target platforms, from embedded devices to desktops including mobile and web. Both the user and the developer should feel at home on each platform. The look and feel and experience should match the users' expectations of a native application.

Quick Start

Check the online demos or build on your own system.

Current Status

Slint is in active development. Its state of development depends on the kind of application.

  • Embedded: Ready! Slint is already happily used by customers on embedded devices (running on an Arm processor with Linux). We are also looking into supporting microcontrollers.
  • Desktop: In Progress. Slint is usable on Windows, Linux and Mac. We plan on building up the desktop support in subsequent releases to reach the level of integration we're aiming for.
  • Mobile (Android/iOS): Todo. We haven't started supporting mobile platforms yet, but it is our intention to do so in the future.
  • Web: Our focus is on Embedded and Desktop applications. We do not intend to compete in the web space as a primary platform. That said, Slint can compile to WebAssembly and the demos are running in a web browser. But the web support is currently limited to demo purposes.

Stay up to date

Follow @slint-ui on twitter or keep an eye out for our 🥠 Weekly Status Updates.

Documentation

The examples folder contains examples and demos.

The docs folder contains a lot more information, including build instructions, recipes for common tasks and internal developer docs.

Refer to the README of each language directory in the api folder:

Demos running in WebAssembly Simulation

Click on the screenshots to run the WebAssembly simulation

Printer Demo Slide Puzzle Todo Widget Gallery
Screenshot of the Printer Demo Screenshot of the Slide Puzzle Screenshot of the Todo Demo Screenshot of the Gallery Demo

Desktop Native Widgets

Windows macOS Linux
Screenshot of the Gallery on Windows Screenshot of the Gallery on macOS Screenshot of the Gallery on Linux

The .slint Markup Language

Slint comes with a markup language that is specifically designed for user interfaces. This language provides a powerful way to describe graphical elements, their placement, and the flow of data through the different states. It is a familiar syntax to describe the hierarchy of elements and property bindings. Here's the obligatory "Hello World":

HelloWorld := Window {
    width: 400px;
    height: 400px;

    Text {
       y: parent.width / 2;
       x: parent.x + 200px;
       text: "Hello, world";
       color: blue;
    }
}

Check out the language reference for more details.

Architecture

An application is composed of the business logic written in Rust, C++, or JavaScript and the .slint user interface design markup, which is compiled to native code.

Architecture Overview

Compiler

The .slint files are compiled ahead of time. The expressions in the .slint are pure functions that the compiler can optimize. For example, the compiler could choose to "inline" properties and remove those that are constant or unchanged. In the future we hope to improve rendering time on low end devices by pre-processing images and text. The compiler could determine that a Text or an Image element is always on top of another Image in the same location. Consequently both elements could be rendered ahead of time into a single element, thus cutting down on rendering time.

The compiler uses the typical compiler phases of lexing, parsing, optimization, and finally code generation. It provides different back-ends for code generation in the target language. The C++ code generator produces a C++ header file, the Rust generator produces Rust code, and so on. An interpreter for dynamic languages is also included.

Runtime

The runtime library consists of an engine that supports properties declared in the .slint language. Components with their elements, items, and properties are laid out in a single memory region, to reduce memory allocations.

Rendering backends and styles are configurable at compile time. Current there are two back-ends:

  • The gl backend uses OpenGL ES 2.0 for rendering.
  • The qt backend uses Qt's QStyle to achieve native looking widgets. In the future it could also use QPainter.

Tooling

We have a few tools to help with the development of .slint files:

  • A LSP Server that adds features like auto-complete and live preview of the .slint files to many editors.
  • It is bundled in a Visual Studio Code Extension available from the market place.
  • A slint-viewer tool which displays the .slint files. The --auto-reload argument makes it easy to preview your UI while you are working on it (when using the LSP preview is not possible).
  • An online editor to try out .slint syntax without installing anything (sources).
  • An updater to convert the .slint files from previous versions to newer versions.
  • An experimental Figma importer.

Please check our Editor README for tips on how to configure your favorite editor to work well with Slint.

Made with Slint

List of some open source projects using Slint: (Contact us or open a pull request to add yours)

  • Cargo UI: A graphical frontend for Cargo.
  • ImageSieve : GUI based tool to sort and categorize images.
  • Moiré : Musical live performance application with a DAW-like timeline interface.
  • Chiptrack: A cross-platform sequencer that internally uses a Game Boy emulator to synthesize the sound.
  • Project Trains Launcher: Cross-platform game launcher made for Project Trains simulator.
  • Mastermind: Mastermind game coded in Rust.

Contributions

We welcome your contributions: in the form of code, bug reports or feedback.

  • If you see an RFC tag on an issue, feel free to chime in.
  • For contribution guidelines see CONTRIBUTING.md. The dual-licensing requires the contributor to accept a CLA.

License

This software is provided under a dual licensing scheme:

The commercial license is free if you help us promote Slint: Check out our ambassador license.

See also the Licensing FAQ

Frequently Asked Questions

Please see our separate FAQ.

About us

Olivier and Simon started their open source journey in the KDE project, the popular Open Source Desktop Environment for Linux. Later they met while working together in a small company in Norway called Trolltech, on the Qt C++ toolkit. Here, they gained valuable experience in API design, cross-platform software development and user interface components. Simon continued in the Qt Company as one lead developer and maintainer of the QtQml engine, while Olivier co-founded Woboq, a software consulting company. Years later, and now based in Berlin, they are starting a new project. With Slint they aim to make developing user interfaces fun for everyone: from JavaScript, C++, or Rust developers all the way to UI/UX designers.

Contact us

Feel free to join Github discussions for general chat or questions. Use Github issues to report public suggestions or bugs.

We chat in our Mattermost instance where you are welcome to listen in or ask your questions.

You can of course also tweet at @slint-ui or contact us privately via email to [email protected].

slint's People

Contributors

tronical avatar ogoffart avatar hunger avatar lukas-jung avatar jamesblacklock avatar jturcotte avatar jrmoulton avatar ryban avatar levrik avatar be-ing avatar patrickelectric avatar a1ecbr0wn avatar aursen avatar rybertm avatar zajozor avatar mwaitzman avatar sanxiyn avatar rustemb avatar rdrpenguin04 avatar phi-gamma avatar benoit-canet avatar unc0 avatar ritschwumm avatar n-raine avatar simonkampe avatar rbrishabh avatar marcograss avatar nagayev avatar jmoore34 avatar giannissc avatar

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.