From ec8f86c87ea1a0bbbf2eb057ebc734a92373b824 Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Sat, 5 Jul 2025 22:11:15 +0200 Subject: [PATCH 1/4] gui: fix caret offset after UIInputText is resized --- arcade/gui/widgets/text.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arcade/gui/widgets/text.py b/arcade/gui/widgets/text.py index e4e8d6db8a..a9b50cbee8 100644 --- a/arcade/gui/widgets/text.py +++ b/arcade/gui/widgets/text.py @@ -735,6 +735,9 @@ def _update_layout(self): layout.y = 0 layout.end_update() + # manually update caret position + self.caret.on_layout_update() + @property def text(self): """Text of the input field.""" From 399272b25e5a40b85364fa2ca0259ac0836f4f64 Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Sat, 5 Jul 2025 22:13:20 +0200 Subject: [PATCH 2/4] gui: cleanup test execution --- tests/unit/gui/test_widget_tree.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/unit/gui/test_widget_tree.py b/tests/unit/gui/test_widget_tree.py index fee72f39c8..af79f35d56 100644 --- a/tests/unit/gui/test_widget_tree.py +++ b/tests/unit/gui/test_widget_tree.py @@ -131,17 +131,19 @@ def objs_in_memory(obj_type): del root gc.collect() - if objs_in_memory(UIWidget) > start_count: - print("Render object graph...") - import objgraph - - objgraph.show_chain( - objgraph.find_backref_chain( - [obj for obj in gc.get_objects() if isinstance(obj, UIWidget)][1], - objgraph.is_proper_module, - ), - # filename="chain.png", - ) + # This might help, if the test fails ;) + # requires `objgraph` + # if objs_in_memory(UIWidget) > start_count: + # print("Render object graph...") + # import objgraph + # + # objgraph.show_chain( + # objgraph.find_backref_chain( + # [obj for obj in gc.get_objects() if isinstance(obj, UIWidget)][1], + # objgraph.is_proper_module, + # ), + # # filename="chain.png", + # ) # print("Render backrefs...") # objgraph.show_backrefs( From 3249467205f05c572228bbb0a5dc8c2f208e0243 Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Sat, 5 Jul 2025 22:30:19 +0200 Subject: [PATCH 3/4] gui: add changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 110de9c292..eaa0ec647d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ You can grab pre-release versions from PyPi. See the available versions from the Arcade [PyPi Release History](https://pypi.org/project/arcade/#history) page. +## Unreleased + +- GUI + - Fix a bug, where the caret of UIInputText was misplaced after resizing the widget + ## 3.3.2 - GUI From 0d7592529806217360b0f300bae6a74aa7679a49 Mon Sep 17 00:00:00 2001 From: Maic Siemering Date: Sat, 5 Jul 2025 22:30:55 +0200 Subject: [PATCH 4/4] gui: lint --- tests/unit/gui/test_widget_tree.py | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/tests/unit/gui/test_widget_tree.py b/tests/unit/gui/test_widget_tree.py index af79f35d56..51d12a0bfe 100644 --- a/tests/unit/gui/test_widget_tree.py +++ b/tests/unit/gui/test_widget_tree.py @@ -134,22 +134,22 @@ def objs_in_memory(obj_type): # This might help, if the test fails ;) # requires `objgraph` # if objs_in_memory(UIWidget) > start_count: - # print("Render object graph...") - # import objgraph - # - # objgraph.show_chain( - # objgraph.find_backref_chain( - # [obj for obj in gc.get_objects() if isinstance(obj, UIWidget)][1], - # objgraph.is_proper_module, - # ), - # # filename="chain.png", - # ) - - # print("Render backrefs...") - # objgraph.show_backrefs( - # [[obj for obj in gc.get_objects() if isinstance(obj, UIWidget)][1]], - # max_depth=15, - # # filename="sample-graph.png", - # ) + # print("Render object graph...") + # import objgraph + # + # objgraph.show_chain( + # objgraph.find_backref_chain( + # [obj for obj in gc.get_objects() if isinstance(obj, UIWidget)][1], + # objgraph.is_proper_module, + # ), + # # filename="chain.png", + # ) + + # print("Render backrefs...") + # objgraph.show_backrefs( + # [[obj for obj in gc.get_objects() if isinstance(obj, UIWidget)][1]], + # max_depth=15, + # # filename="sample-graph.png", + # ) assert objs_in_memory(UIWidget) == start_count