Skip to content

Refactor the toolbox widget to separate it from the ToolManager#2113

Merged
cameronwhite merged 1 commit intomasterfrom
refactor/toolbox
Apr 14, 2026
Merged

Refactor the toolbox widget to separate it from the ToolManager#2113
cameronwhite merged 1 commit intomasterfrom
refactor/toolbox

Conversation

@cameronwhite
Copy link
Copy Markdown
Member

The toolbox widget was very closely coupled with other classes, especially the tool manager (which really shouldn't be managing UI widgets)

  • Remove the ToolItem from BaseTool. The toolbox widget instead maintains a mapping from tool to the button widgets, and is responsible for deciding how to create those buttons.

  • The ToolBoxButton class isn't really necessary now that it's internal to the toolbox widget - the toolbox widget can just create regular ToggleButton's without needing a subclass

  • Use a ToggleButton group to handle keeping only one of the buttons active, which is simpler than the previous approach.

  • Add an event on the ToolManager for activating a tool. This can also be used in the future for moving other UI logic (like the tool toolbar) out of the tool manager.

The toolbox widget was very closely coupled with other classes, especially the tool manager (which really shouldn't be managing UI widgets)

- Remove the `ToolItem` from `BaseTool`. The toolbox widget instead maintains a mapping from tool to the button widgets, and is responsible for deciding how to create those buttons.

- The ToolBoxButton class isn't really necessary now that it's internal to the toolbox widget - the toolbox widget can just create regular ToggleButton's without needing a subclass

- Use a ToggleButton group to handle keeping only one of the buttons active, which is simpler than the previous approach.

- Add an event on the ToolManager for activating a tool. This can also be used in the future for moving other UI logic (like the tool toolbar) out of the tool manager.
@cameronwhite cameronwhite merged commit 0abe680 into master Apr 14, 2026
11 checks passed
@cameronwhite cameronwhite deleted the refactor/toolbox branch April 14, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant