James Westman, GNOME Maps application developer, introduced a new markup language called Blueprint, designed for building interfaces using the GTK library. The compiler code that transforms Blueprint markup into GTK ui files is written in Python and is distributed under the LGPLv3 license.
The reason for creating the project is the binding of the GTK ui files, which describe the interface, to the XML format, which is overloaded and inconvenient for manual markup writing or editing. The Blueprint format offers clarity in information representation and, thanks to its readable syntax, allows for the absence of specialized visual interface editors when creating, editing, and evaluating changes in interface elements.
At the same time, Blueprint does not require changes to GTK, fully replicates the GTK widget model, and is positioned as an addition that compiles the markup into the standard XML format used by GtkBuilder. The functional capabilities of Blueprint fully match those of GtkBuilder; the only difference is in the method of information representation. To transition to Blueprint, it's enough to add a call to the blueprint-compiler in the build script without altering the code. using Gtk 4.0; template MyAppWindow : Gtk.ApplicationWindow { title: _(«My App Title»); [titlebar] HeaderBar header_bar {} Label { styles [«heading»] label: _(«Hello, world!»); } }

In addition to the compiler for the standard GTK XML format, a plugin for Blueprint support is also being developed for the integrated development environment GNOME Builder. A separate LSP server (Language Server Protocol) for Blueprint is being developed, which can be used for syntax highlighting, error analysis, code suggestions, and autocompletion in LSP-supporting code editors, including Visual Studio Code.
Plans for the development of Blueprint include adding elements of reactive programming to the markup, implemented using the Gtk.Expression class provided in GTK4. The proposed method is more familiar for developers of web interfaces in JavaScript and allows for automatic synchronization of the interface's presentation with the linked data model, without the need for manually updating the user interface after each data change.
Allikas: opennet.ru
