Writing constraints by hand, even when using a dedicated mini-language, is hard without visualizing the result, and that's how Emeus got a small utility for it
Last year I talked about the newly added support for Apple’s Visual Format Language in Emeus, which allows to quickly describe layouts using a cross between ASCII art and predicates. For instance, I can use:
H:|-[icon(==256)]-[name_label]-| H:[surname_label]-| H:[email_label]-| H:|-[button(<=icon)] V:|-[icon(==256)] V:|-[name_label]-[surname_label]-[email_label]-| V:[button]-|
and obtain a layout like this one:
Thanks to the contribution of my colleague Martin Abente Lahaye, now Emeus supports extensions to the VFL, namely:
- arithmetic operators for constant and multiplication factors inside
[button1(button2 * 2 + 16)]
- explicit attribute references, like
[button1(button1.height / 2)]
This allows more expressive layout descriptions, like keeping aspect ratios between UI elements, without requiring hitting the code base.
Of course, editing VFL descriptions blindly is not what I consider a fun activity, so I took some time to write a simple, primitive editing tool that lets you visualize a layout expressed through VFL constraints:
Here’s a couple of videos showing it in action:
At some point, this could lead to a new UI tool to lay out widgets inside Builder and/or Glade.
As of now, I consider Emeus in a stable enough state for other people to experiment with it — I’ll probably make a release soon-ish. The Emeus website is up to date, as it is the API reference, and I’m happy to review pull requests and feature requests.
development layout gtk constraints editing