Skip to content

Emit buttons - Button existed but nothing ever constructed it - #60

Open
TheLastDarkthorne wants to merge 1 commit into
demonnic:mainfrom
TheLastDarkthorne:fix-emit-buttons
Open

Emit buttons - Button existed but nothing ever constructed it#60
TheLastDarkthorne wants to merge 1 commit into
demonnic:mainfrom
TheLastDarkthorne:fix-emit-buttons

Conversation

@TheLastDarkthorne

@TheLastDarkthorne TheLastDarkthorne commented Aug 21, 2026

Copy link
Copy Markdown

Button.groovy exists and nothing constructs it. App.groovy builds five
packages - alias, script, timer, trigger, key - and yields those five into
the MudletPackage XML. There is no sixth for buttons. A project with a
populated src/buttons/ builds without complaint and without buttons:
"Scanning for buttons" never appears in the log, the way it does for every
other item type, and the output XML has no Action/ActionGroup element at
all.

Fixes #58.

Repro: a minimal project with src/buttons/buttons.json declaring a toolbar
with one button and its Show_affs.lua, plus a sibling src/triggers/
trigger as a canary. Before this fix, the trigger comes through and the
button leaves no trace anywhere in the output. This is also why a converted
package's toolbar can vanish silently on the muddler round-trip with nothing
in the converter itself at fault - there is no code path that could keep it.

The fix

Adds ActionPackage, following the same shape as the other five: it scans
build/filtered/src/buttons for buttons.json and constructs Buttons.

Button itself only looked finished - it declared its fields but the
constructor set none of them, so every button would have serialised as null
even once something did construct it. It now maps its options and writes
Mudlet's Action/ActionGroup element: the isPushButton, isFlatButton
and useCustomLayout attributes, and the sixteen child elements Mudlet
expects, each defaulting to what a freshly created button carries rather
than to empty. The layout numbers are bare integers Mudlet is unforgiving
about, so they default instead of being omitted; orientation is the one
that differs between a toolbar and a button on it, and follows isFolder.

buttonColor is written only when set - packages from the Mudlet 3.x era
have no such element, and emitting an empty one on every button would change
every imported package to no purpose.

Verification

Built the repro above before and after: before, the trigger appears and the
button leaves no trace; after, ActionPackage carries the ActionGroup with
the nested Action, and the button's script is read from its .lua the same
way every other item type reads one.

Runnable reproduction

https://github.com/TheLastDarkthorne/mudlet-tooling-repros/tree/main/muddler/bug6-missing-buttons

Run against the stock 1.1.0 jar, the canary trigger builds and the button
leaves no trace anywhere in the output. run_repros.py in the same
directory builds it against both a stock and a patched jar and prints the
resulting tree for both.

muddler shipped a Button class that no code path reached. App.groovy
builds five packages (alias, script, timer, trigger, key) and yields
those five into the MudletPackage, and there was no ButtonPackage or
ActionPackage to build. A project with a populated src/buttons/ built
without complaint and without buttons: "Scanning for buttons" never
appeared in the log and the output XML had no ActionPackage at all.

Adds ActionPackage, following the same shape as the other five - scans
build/filtered/src/buttons for buttons.json, and constructs Buttons.

Button itself only looked finished. It declared the fields but the
constructor set none of them, so every one would have serialised as
null even once something did construct it. It now maps its options and
writes Mudlet's Action/ActionGroup element: the isPushButton,
isFlatButton and useCustomLayout attributes, and the sixteen child
elements Mudlet expects, each defaulting to what a freshly created
button carries rather than to empty.

The layout numbers are bare integers Mudlet is unforgiving about, so
they default rather than being omitted. orientation is the one that
differs between a toolbar and a button on it, and follows isFolder.

buttonColor is written only when set. Packages from the Mudlet 3.x era
have no such element and emitting an empty one on every button would
change every imported package to no purpose.

Verified by building a project whose src/buttons/ holds a toolbar with
one button and a sibling trigger as a canary: before, the trigger came
through and the button left no trace anywhere in the output; after,
ActionPackage carries the ActionGroup with the nested Action, and the
button's script is read from its .lua the same way every other item
type reads one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buttons are silently never emitted

1 participant