[Bug]: Cannot create single stack from multiple extensions #2445
Labels
Bug
Bug that stops user from using the tool or a major portion of pyRevit functionality [class]
New Feature
New feature request [class->Implemented #{number}: {title}]
✈ Pre-Flight checks
🐞 Describe the bug
I am finally getting around to adding an autosave extension after promising to do so quite some time ago (apologies but my project work increased significantly for the past 10 months).
I am attempting to add a smartbutton to enable/disable the feature to the existing Toggles section of the main pyRevit toolbar to save space within the toolbar and not create another toolbar for one button. Attempting to do so results in a separate full size button adjacent to the stack.
The script is saved in this folder, for reference: pyRevitAutosave.extension\pyRevit.tab\Toggles.panel\toggles3.stack\Autosave.smartbutton
I have not previously dug into the loader or UI builder portions of the code (mostly just the tools and hooks) but it seems like this goes through coreutils/ribbon.py line 1226 which finds one stack item in the autosave extension folder and creates a full size button out of the stack, then later separately loads the tools extension, and finds two buttons in the toggles3 folder and creates a stack from those.
Editing ribbon.py to allow stack creation with data_obj_count == 1 as well as 2 and 3, and commenting out lines 1249-1252 seems to include the autosave function in the first stack, which then breaks as it then has 4 items, per line 1259.
Renaming the extension to pyRevitzAutosave to load it last (as I expect the extension traversal is alphabetical) results in the error:
ERROR [pyrevit.loader.uimaker] Can not create stack under this parent: Name: Toggles RevitAPIObject: <Autodesk.Revit.UI.RibbonPanel object at 0x0000000000000498 [Autodesk.Revit.UI.RibbonPanel]> | AddStackedItems() takes at least 2 arguments (1 given)
which removes the toggles panel completely.⌨ Error/Debug Message
The "fix" for this would likely involve a significant refactoring of the loader/uimaker to analyze each extension and combine common subpaths before creating ui elements. Alternately (or in conjunction), stacks could be created from one folder with more than 3 items in a way that overflows into another adjacent stack.
♻️ To Reproduce
No response
⏲️ Expected behavior
It would be nice for extensions to be able to share the same stack.
🖥️ Hardware and Software Setup (please complete the following information)
Additional context
No response
The text was updated successfully, but these errors were encountered: