Remove legacy string enum comparisons from InputState/Key/MouseButton, closes #306
Removed custom __eq__/__ne__ that allowed comparing enums to legacy string names (e.g., Key.ESCAPE == "Escape"). Removed _legacy_names dicts and to_legacy_string() functions. Kept from_legacy_string() in PyKey.cpp as it's used by C++ event dispatch. Updated ~50 Python test/demo/cookbook files to use enum members instead of string comparisons. Also updates grid.position -> grid.pos in files that had both types of changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
354faca838
commit
6d5e99a114
52 changed files with 372 additions and 533 deletions
|
|
@ -27,7 +27,7 @@ def test_minimal():
|
|||
|
||||
print("Attempting to call on_click...")
|
||||
try:
|
||||
obj.on_click((50, 50), "left", "start")
|
||||
obj.on_click((50, 50), mcrfpy.MouseButton.LEFT, mcrfpy.InputState.PRESSED)
|
||||
print("Call succeeded!")
|
||||
except Exception as e:
|
||||
print(f"Exception: {type(e).__name__}: {e}")
|
||||
|
|
@ -51,7 +51,7 @@ def test_without_callback_clear():
|
|||
obj = MyFrame(pos=(100, 100), size=(100, 100))
|
||||
|
||||
print("Calling...")
|
||||
obj.on_click((50, 50), "left", "start")
|
||||
obj.on_click((50, 50), mcrfpy.MouseButton.LEFT, mcrfpy.InputState.PRESSED)
|
||||
|
||||
print("Deleting without clearing callback...")
|
||||
del obj
|
||||
|
|
@ -69,7 +69,7 @@ def test_added_to_scene():
|
|||
scene.children.append(obj)
|
||||
|
||||
print("Calling via scene.children[0]...")
|
||||
scene.children[0].on_click((50, 50), "left", "start")
|
||||
scene.children[0].on_click((50, 50), mcrfpy.MouseButton.LEFT, mcrfpy.InputState.PRESSED)
|
||||
|
||||
print("About to exit...")
|
||||
sys.exit(0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue