Files
cnmcdee 05b33a9c33 Pilot batch: banner, bigfind, emptybig LightGUI apps + repo index and MIT license
First 3 of the 5 pilot apps, all built and screenshot-tested on hot_dallas:
- banner (Python): text + font combo + scrolling output, 12/12 GUI-vs-CLI
- bigfind (C++): top-N largest files table, exact CLI match
- emptybig (C++): sparse-file finder, exact CLI match on fixture
Top-level README indexes all 50 drawn apps; LICENSE is MIT (util_box
itself is unlicensed; MIT matches lzply and lightgui).
datecalc and certcheck are blocked pending execution-risk approval.
2026-12-05 04:38:49 +00:00

92 lines
3.5 KiB
Markdown

# banner — util_boxgui
A LightGUI (Python/XFrame) port of the util_box `banner` CLI utility:
type text, pick a font, and the ASCII banner renders live in the
scrolling output area below.
![banner window](screenshot.png)
## What it does
- **Text entry** (top left): the text to render. Pre-filled with
`Hello` on launch.
- **Font combo** (top right): the four built-in fonts — `standard`,
`small`, `big`, `slant`. `standard` is selected on launch. Click
the combo to cycle to the next font.
- **Output area** (below, fills the window): the rendered banner in
a monospace font, with scroll bars. The banner for `Hello` in
`standard` is already rendered when the app starts, so a plain
launch + screenshot is representative.
Interaction: click the text entry to focus it (blue outline), then
type — BackSpace deletes. Changing the text or the font re-renders
the banner immediately.
## How to run
On hot_dallas (104.225.223.162), from this directory:
```sh
PYTHONPATH=/root/lg-review/lightgui_python python3 banner.py
```
Requires python3-gi / gir1.2-gtk-3.0 and the LightGUI Python checkout
at `/root/lg-review/lightgui_python` on `PYTHONPATH`. Under Xvfb:
```sh
Xvfb :100 -screen 0 1024x768x24 &
DISPLAY=:100 PYTHONPATH=/root/lg-review/lightgui_python python3 banner.py
```
The window title is `banner - util_boxgui`.
## How it maps to the CLI
The original is `/root/fileutils/bin/banner` (util_box):
```sh
banner [-f FONT] TEXT... | banner --list-fonts
```
- **Same fonts.** The combo lists exactly the CLI's four fonts:
`standard`, `small`, `big`, `slant` (`--list-fonts` output).
- **Same rendering.** The font table (`FONT`), the unknown-character
glyph (`UNKNOWN`), and `render()` are vendored verbatim from the
CLI script into `banner.py`, so the GUI output is byte-identical
to the CLI output for the same text and font — verified against
the CLI on 12 cases (all four fonts, mixed case, digits,
punctuation, spaces, unknown characters such as `@`, which the
CLI renders with the `UNKNOWN` block glyph). Lowercase input is
upper-cased, exactly as the CLI does.
- **Same edge cases.** Empty text: the CLI errors out
(`give text to render`); the GUI instead shows an empty output
area (the CLI's rendering of `""` is five blank lines — the GUI
shows the same blank result without the blank lines). Characters
with no glyph (e.g. `@`) render as the CLI's block glyph.
- **Font effects, as in the CLI:** `small` keeps the top, middle
and bottom rows; `big` doubles every character horizontally and
vertically (10 rows); `slant` indents each successive row one
space further right.
One deliberate difference: the CLI prints to stdout; the GUI shows
the banner in the output area and never writes to stdout.
## Known limitations
- LightGUI draws its widgets with Cairo on a single `Gtk.DrawingArea`
— there is no native GTK keyboard focus or combo drop-down. This app
wires focus and typing itself (click the entry, then type) and the
font combo cycles through the four fonts on click instead of
opening a drop-down list.
- The output area does not really scroll: LightGUI's text-view scroll
bars are drawn, not functional. A very wide banner (long text in the
`big` font) is clipped at the right edge with an ellipsis. The
default `Hello` fits in every font; `util_boxgui` fits in
`standard`, `small` and `slant`, but is clipped in `big`.
## Walkthrough
Planned walkthrough article (to be published on hot_newyork):
https://pythondoc.lightgui.com/banner/