Skip to content

Refactor button title handling in _PyRevitRibbonPanel#2908

Merged
jmcouffin merged 1 commit intodevelopfrom
fix/2907
Nov 4, 2025
Merged

Refactor button title handling in _PyRevitRibbonPanel#2908
jmcouffin merged 1 commit intodevelopfrom
fix/2907

Conversation

@jmcouffin
Copy link
Copy Markdown
Contributor

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

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
@jmcouffin jmcouffin added the Bundles Issues related to the pyRevit bundles [subsystem] label Nov 4, 2025
@jmcouffin jmcouffin merged commit 9f3d2b7 into develop Nov 4, 2025
@jmcouffin jmcouffin deleted the fix/2907 branch November 4, 2025 16:08
Copy link
Copy Markdown
Contributor

@devloai devloai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 4, 2025

📦 New work-in-progress (wip) builds are available for 5.3.0.25308+1611-wip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bundles Issues related to the pyRevit bundles [subsystem]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant