The `# mcrf:` stamp recorded verified=<version>@<commit>, so every commit rewrote
the hash in all 130 snippet headers -- a guaranteed 130-file diff carrying no signal
git history doesn't already have, and one `--check` ignores anyway. The version alone
is stable within a dev cycle ("0.2.8-dev") and becomes the release marker at a tag
("0.2.9"), which is the whole point of the field: freezing a version into the docs
site's history, not pinning a commit.
verified is now version-only. The stamper is idempotent again: a second run on a
clean tree changes zero files. This commit is the one-time normalization that strips
the @hash suffix from the existing headers.
Found while cleaning up after a make release-docs run left all 130 snippets dirty
with nothing but hash churn.
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
# mcrf: objects=[Caption,Color,Frame,InputState,Scene] verified=0.2.8-dev status=ok
|
|
# Parent Reference - Access parent from child
|
|
import mcrfpy
|
|
|
|
scene = mcrfpy.Scene("demo")
|
|
mcrfpy.current_scene = scene
|
|
|
|
scene.children.append(mcrfpy.Frame(pos=(0, 0), size=(1024, 768), fill_color=mcrfpy.Color(30, 30, 40)))
|
|
|
|
# Parent container
|
|
parent = mcrfpy.Frame(
|
|
pos=(262, 184), size=(500, 400),
|
|
fill_color=mcrfpy.Color(80, 80, 120),
|
|
name="parent_frame"
|
|
)
|
|
scene.children.append(parent)
|
|
|
|
# Child button
|
|
child = mcrfpy.Frame(
|
|
pos=(150, 150), size=(200, 100),
|
|
fill_color=mcrfpy.Color(100, 150, 100),
|
|
name="child_button"
|
|
)
|
|
parent.children.append(child)
|
|
|
|
child.children.append(mcrfpy.Caption(text="Click me!", pos=(50, 35)))
|
|
|
|
status = mcrfpy.Caption(text="Click the button", pos=(350, 620))
|
|
scene.children.append(status)
|
|
|
|
def on_click(pos, button, action):
|
|
if action == mcrfpy.InputState.PRESSED:
|
|
# Access parent from child
|
|
p = child.parent
|
|
if p:
|
|
status.text = f"My parent is: '{p.name}'"
|
|
# Modify parent
|
|
p.fill_color = mcrfpy.Color(120, 80, 80)
|
|
|
|
child.on_click = on_click
|