Remove redundant Grid.position alias, keep only Grid.pos, closes #308

Grid.position was a redundant alias for Grid.pos. Removed get_position/
set_position functions, getsetters entry, and setProperty/getProperty/
hasProperty branches. Updated all tests to use grid.pos.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
John McCardle 2026-04-09 22:18:30 -04:00
commit 354faca838
12 changed files with 28 additions and 51 deletions

View file

@ -144,7 +144,7 @@ ui = dijkstra_debug.children
ui.append(grid)
# Position and scale
grid.position = (50, 50)
grid.pos = (50, 50)
grid.size = (400, 400) # 10*40
# Add title

View file

@ -199,7 +199,7 @@ ui.append(grid)
# Scale and position grid for better visibility
grid.size = (560, 400) # 14*40, 10*40
grid.position = (120, 60)
grid.pos = (120, 60)
# Add title
title = mcrfpy.Caption(pos=(250, 10), text="Dijkstra Pathfinding Interactive")

View file

@ -291,7 +291,7 @@ ui.append(grid)
# Scale and position grid for better visibility
grid.size = (560, 400) # 14*40, 10*40
grid.position = (120, 60)
grid.pos = (120, 60)
# Add title
title = mcrfpy.Caption(pos=(250, 10), text="Enhanced Dijkstra Pathfinding")

View file

@ -124,7 +124,7 @@ ui = dijkstra_test.children
ui.append(grid)
# Position and scale grid
grid.position = (50, 50)
grid.pos = (50, 50)
grid.size = (500, 300)
# Add title

View file

@ -35,7 +35,7 @@ entity.update_visibility()
print("Setting up UI...")
ui = vis_test.children
ui.append(grid)
grid.position = (50, 50)
grid.pos = (50, 50)
grid.size = (300, 300)
# Test perspective

View file

@ -39,14 +39,22 @@ def test_grid_vectors():
assert center.y == 75.0, f"grid.center.y should be 75.0, got {center.y}"
print(" PASS: grid.center returns Vector")
# Test grid.position returns a Vector
position = grid.position
print(f" grid.position = {position}")
assert hasattr(position, 'x'), f"grid.position should have .x attribute, got {type(position)}"
assert hasattr(position, 'y'), f"grid.position should have .y attribute, got {type(position)}"
assert position.x == 100.0, f"grid.position.x should be 100.0, got {position.x}"
assert position.y == 150.0, f"grid.position.y should be 150.0, got {position.y}"
print(" PASS: grid.position returns Vector")
# Test grid.pos returns a Vector
pos = grid.pos
print(f" grid.pos = {pos}")
assert hasattr(pos, 'x'), f"grid.pos should have .x attribute, got {type(pos)}"
assert hasattr(pos, 'y'), f"grid.pos should have .y attribute, got {type(pos)}"
assert pos.x == 100.0, f"grid.pos.x should be 100.0, got {pos.x}"
assert pos.y == 150.0, f"grid.pos.y should be 150.0, got {pos.y}"
print(" PASS: grid.pos returns Vector")
# Verify grid.position alias was removed (#308)
try:
_ = grid.position
print(" FAIL: grid.position should not exist but it does!")
sys.exit(1)
except AttributeError:
print(" PASS: grid.position correctly removed (#308)")
print("Issue #179 tests PASSED!")

View file

@ -121,7 +121,7 @@ def visual_test(timer, runtime):
# Set up minimal UI for visual test
ui = astar_test.children
ui.append(grid)
grid.position = (50, 50)
grid.pos = (50, 50)
grid.size = (400, 400)
astar_test.activate()

View file

@ -77,7 +77,7 @@ def check_visual(timer, runtime):
# Set up minimal UI to test rendering
ui = test.children
ui.append(grid)
grid.position = (50, 50)
grid.pos = (50, 50)
grid.size = (250, 250)
test.activate()

View file

@ -137,7 +137,7 @@ print(f" Visible cells after move: {visible_count}")
# Set up UI
ui = visibility_test.children
ui.append(grid)
grid.position = (50, 50)
grid.pos = (50, 50)
grid.size = (600, 450) # 20*30, 15*30
# Add title

View file

@ -66,7 +66,7 @@ if path:
# Set up UI
ui = visual_test.children
ui.append(grid)
grid.position = (50, 50)
grid.pos = (50, 50)
grid.size = (250, 250)
# Add title