Fix MinifyUI state desync on cross-model view switch#3196
Open
Fix MinifyUI state desync on cross-model view switch#3196
Conversation
Refactor MinifyUI script to handle icon updates based on active state.
Contributor
|
Unable to trigger custom agent "Code Reviewer". You have run out of credits 😔 |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes MinifyUI getting out of sync with actual Revit ribbon/tab visibility when switching between views across different open models by re-applying the configured hidden-tab state on view activation.
Changes:
- Initializes the MinifyUI smartbutton icon/state on load based on
MINIFYUIACTIVE, and (if active) re-applies the hidden tabs immediately. - Adds a guarded
ViewActivatedevent subscription to re-runupdate_ui()(plus a deferred re-hide) after view switches. - Cleans up minor module metadata (encoding headers) and a docstring typo.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
extensions/pyRevitTools.extension/pyRevit.tab/Toggles.panel/toggles1.stack/MinifyUI.smartbutton/script.py |
On smartbutton init, syncs icon + (if active) ensures event subscription and re-applies MinifyUI state. |
extensions/pyRevitTools.extension/pyRevit.tab/Toggles.panel/toggles1.stack/MinifyUI.smartbutton/minifyui.py |
Implements guarded ViewActivated subscription and deferred UI update to keep hidden tabs enforced across cross-model view switches. |
...vitTools.extension/pyRevit.tab/Toggles.panel/toggles1.stack/MinifyUI.smartbutton/minifyui.py
Outdated
Show resolved
Hide resolved
...vitTools.extension/pyRevit.tab/Toggles.panel/toggles1.stack/MinifyUI.smartbutton/minifyui.py
Show resolved
Hide resolved
...vitTools.extension/pyRevit.tab/Toggles.panel/toggles1.stack/MinifyUI.smartbutton/minifyui.py
Outdated
Show resolved
Hide resolved
…ggles1.stack/MinifyUI.smartbutton/minifyui.py Adding Debug Exception Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ggles1.stack/MinifyUI.smartbutton/minifyui.py Addubg debug message on exception Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix MinifyUI state desync on cross-model view switch
Description
Minify Revit UI desynchronizes from actual ribbon visibility when switching between views in different open models. The button stays active (orange), MINIFYUIACTIVE remains True, but contextual tabs like Steel, Precast, and Massing & Site reappear — because Revit's ribbon manager restores them during view activation with no mechanism to re-enforce the hidden state.
This has been reported four times since 2022 (#1570, #1716, #1744, #3106).
Checklist
Before submitting your pull request, ensure the following requirements are met:
pipenv run black {source_file_or_directory}Related Issues
Closes #3106
Closes #1716
Closes #1570
Related: #1744
Additional Notes
Guard event subscription with a single env var flag (MINIFYUI_SUBSCRIBED) — subscribe once, skip if already subscribed, same pattern as selfinit function detection
Cleared experimental / debugging code
Thank you for contributing to pyRevit! 🎉