YAML(ish) - Terminal UI framework based on templates focused on simplicity

Overview

EzTerm

A YAML(ish) based terminal GUI framework for- and by Rust, focussed on making it quick and easy to create a functional UI for an app or game. Based on Crossterm and inspired by Kivy.

img.png

Introduction

The vision is an easy-to-use terminal UI framework that can be used by anyone almost immediately. Deciding that you want your app to have a UI only to find out that writing the UI will take at least as much study as your original idea is what I'm trying to prevent. You should be able to write most of the UI through config files using high-level layouts that do the work for you (e.g. box layouts, table layouts, stacking layouts, etc.). Sizing and positioning should be possible through size hints and positions hints, unless you specifically want to hard code size/position.

Code should only be necessary where it makes sense (writing callbacks for example). This way you can focus on coding an App, not a UI. Widgets should (at least initially) be elementary: buttons, labels, checkboxes, etc. Combining simple widgets with smart layouts can still yield impressive UIs, while still maintaining a simple API that doesn't require much study.

Dividing the screen in four text labels, should be as simple as:


- Layout: my_horizontal_box
    mode: box
    orientation: horizontal
    - Layout: my_vertical_box_left
        mode: box
        orientation: vertical
        - Label: my_upper_left_label
            text: hello
        - Label: my_lower_left_label
            text: hello
    - Layout: my_vertical_box_right
        mode: box
        orientation: vertical
        - Label: my_upper_right_label
            text: hello
        - Label: my_lower_right_label
            text: hello

img_1.png

Positioning those labels to be on the outer edges of the screen increases complexity, but if the framework is doing its job not by much. We could use a float layout to have more control over position, auto size the labels to be as large as their text content (so they don't fill the entire layout) and then use position hints to place them. We'll also create a new label in the middle of the screen, to show off position hints a bit more:

- Layout: my_float_layout
    mode: float
    - Label: my_upper_left_label
        text: hello
        border: True
        auto_scale_width: true
        auto_scale_height: true
        pos_hint_x: left
        pos_hint_y: top
    - Label: my_middle_label
        text: hello
        border: True
        auto_scale_width: true
        auto_scale_height: true
        pos_hint_x: center
        pos_hint_y: middle
    - Label: my_lower_left_label
        text: hello
        border: True
        auto_scale_width: true
        auto_scale_height: true
        pos_hint_x: left
        pos_hint_y: bottom
    - Label: my_upper_right_label
        text: hello
        border: True
        auto_scale_width: true
        auto_scale_height: true
        pos_hint_x: right
        pos_hint_y: top
    - Label: my_lower_right_label
        text: hello
        border: True
        auto_scale_width: true
        auto_scale_height: true
        pos_hint_x: right
        pos_hint_y: bottom

img_2.png

Combining simple concepts such as size hints, position hints, horizontal/vertical alignment, padding, etc. should allow you to make relatively complex layouts without painstakingly hardcoding sizes, or writing your own scaling formulas.

If this seems useful to you please let me know or star the repo, so I can guage interest.

Current state

Very much a work in progress and still not available on Cargo. See the projects page for what I'm working on.

Currently supports the following:

  • Widgets:
    • Box layouts (automatically place widgets next to each other or below each other)
    • Float layouts (hard coded widget positions)
    • Label (text displaying widget)
    • Text input (input and display text)
    • Checkbox (simple on/off switch)
    • Radio buttons (mutually exclusive groups of switches)
    • Dropdowns (list of values from which one can be chosen)
    • Canvases (load content from text file or can be painted manually)
    • Colors and borders for widgets.
  • Widget placement:
    • Size hints
    • Position hints
    • Padding
    • Vertical/horizontal alignment
    • Auto scaling for most widgets (adjust widget size to actual content minimizing size)
  • Callbacks:
    • On keyboard enter
    • On left/right click
    • On value change
You might also like...
tmplt is a command-line interface tool that allows you to quickly and easily set up project templates for various programming languages and frameworks
tmplt is a command-line interface tool that allows you to quickly and easily set up project templates for various programming languages and frameworks

tmplt A User Friendly CLI Tool For Creating New Projects With Templates About tmplt is a command-line tool that lets users quickly create new projects

🎒 CLI to create starters from repos + Templates 🤖 + Actions 🚀
🎒 CLI to create starters from repos + Templates 🤖 + Actions 🚀

Backpack A tool to curate and automate your starter projects Key Features • How To Use • Download • Contributing • License Key Features Generate from

SKYULL is a command-line interface (CLI) in development that creates REST API project structure templates with the aim of making it easy and fast to start a new project.

SKYULL is a command-line interface (CLI) in development that creates REST API project structure templates with the aim of making it easy and fast to start a new project. With just a few primary configurations, such as project name, you can get started quickly.

Create `.gitignore` files using one or more templates from TopTal, GitHub or your own collection
Create `.gitignore` files using one or more templates from TopTal, GitHub or your own collection

gitnr A cross-platform CLI utility to create .gitignore files using templates. Use templates from the GitHub & TopTal collections Use local files and

rip is a command-line deletion tool focused on safety, ergonomics, and performance

rip (Rm ImProved) rip is a command-line deletion tool focused on safety, ergonomics, and performance. It favors a simple interface, and does not imple

Adds back-and-forth jumping between current and previous focused windows to Sway.

sway-focus-back-and-forth Implements back-and-forth movement between the current and the previous focused windows. It also can be seen as a fix to thi

Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting
Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting

Shellharden is a syntax highlighter and a tool to semi-automate the rewriting of scripts to ShellCheck conformance, mainly focused on quoting

Unopinionated low level API bindings focused on soundness, safety, and stronger types over raw FFI.

🔥 firehazard 🔥 Create a fire hazard by locking down your (Microsoft) Windows so nobody can escape (your security sandbox.) Unopinionated low level A

Tight Model format is a lossy 3D model format focused on reducing file size as much as posible without decreasing visual quality of the viewed model or read speeds.
Tight Model format is a lossy 3D model format focused on reducing file size as much as posible without decreasing visual quality of the viewed model or read speeds.

What is Tight Model Format The main goal of the tmf project is to provide a way to save 3D game assets compressed in such a way, that there are no not

Owner
23052022/9417289
null
A web-based streaming service with improved privacy, performance, and simplicity.

Majiix Majiix is a web-based open-source streaming service. The backend that handles the core streaming logic is written in Rust and makes use of cutt

Majgix 3 Nov 21, 2023
An open source, programmed in rust, privacy focused tool for reading programming resources (like stackoverflow) fast, efficient and asynchronous from the terminal.

Falion An open source, programmed in rust, privacy focused tool for reading programming resources (like StackOverFlow) fast, efficient and asynchronou

Obscurely 17 Dec 20, 2022
Ember is a minimalistic Rust library for creating 2D graphics, games, and interactive visualizations with ease and simplicity.

Ember Ember is a simple and fun 2D rendering library for Rust, allowing you to quickly create graphics and interactive applications with ease. It uses

null 8 May 4, 2023
A high level DSL for Simplicity. This is a work in progress and is not yet ready for production use

A high level DSL for Simplicity. This is a work in progress and is not yet ready for production use. The language is designed to be simple and easy to use. It is inspired by rust syntax and is statically typed. The syntax will be extended in the future to support more features.

null 13 Oct 28, 2023
RustGPT is a ChatGPT UI built with Rust + HTMX: the power of Rust coupled with the simplicity of HTMX 💚

RustGPT ??✨ RustGPT.Blog.Post.mp4 Welcome to the RustGPT repository! Here, you'll find a web ChatGPT clone entirely crafted using Rust and HTMX, where

Bitswired 529 Dec 4, 2023
Rust API Server: A versatile template for building RESTful interfaces, designed for simplicity in setup and configuration using the Rust programming language.

RUST API SERVER Introduction Welcome to the Rust API Server! This server provides a simple REST interface for your applications. This README will guid

Harry Nguyen 3 Feb 25, 2024
A simple CLI for combining json and yaml files

A simple CLI for combining json and yaml files

Avencera 16 Jul 4, 2022
This CLI utility facilitates effortless manipulation and exploration of TOML, YAML, JSON and RON files.

???????? This CLI utility facilitates effortless manipulation and exploration of TOML, YAML, JSON and RON files.

Moe 3 Apr 26, 2023
Patch binary file using IDA signatures and defined replacement bytes in YAML.

fabricbin Patch binary file using IDA signatures and defined replacement bytes in YAML. Install: cargo install --git https://github.com/makindotcc/fab

makin 3 Oct 24, 2023
Core Fiberplane data models and methods for transforming them (templates, providers, markdown conversion)

fiberplane This repository is a monorepo for Rust code that is used throughout Fiberplane's product. Overview base64uuid - A utility for working with

Fiberplane 18 Feb 22, 2023