Conversation
Removed the conditional setting of the button title and streamlined the push button creation process by directly passing the ui_title parameter. This improves code clarity and consistency. Fixes [Bug]: Panelbutton no longer working in 5.3.0 #2907
There was a problem hiding this comment.
PR Summary:
This PR fixes a bug where panel buttons were failing to display in pyRevit 5.3.0. The issue was caused by attempting to set the button title before the button was created. The fix removes the premature set_title() call and properly passes the ui_title parameter to create_push_button(), which already has correct logic to handle title setting for both new and existing buttons.
Review Summary:
Reviewed the changes in ribbon.py and verified the fix against the reported issue #2907. The refactoring correctly addresses the root cause: the old code tried to access self.button(button_name) before the button existed, then passed ui_title=None to create_push_button(). The fix delegates title handling to the appropriate method that already handles it properly (lines 1336-1337 and 1369-1370 in create_push_button). Code follows black formatting, PEP8 conventions, and is IronPython 2.7.12 compatible.
No issues found. This is a clean, minimal bug fix that improves code clarity and correctness.
Follow-up suggestions:
@devloai add a test case to prevent regression of panel button title handling
|
📦 New work-in-progress (wip) builds are available for 5.3.0.25308+1611-wip |
Removed the conditional setting of the button title and streamlined the push button creation process by directly passing the ui_title parameter. This improves code clarity and consistency.
Fixes [Bug]: Panelbutton no longer working in 5.3.0 #2907