UI: Improved Operator to Delete Custom Themes #118775

Merged
Harley Acheson merged 1 commits from Harley/blender:RemoveCustomTheme into main 2024-03-14 22:01:44 +01:00
Member

Changes to python operators that add and remove custom themes. Removal
gets poll function, separate name and description, and confirmation.


In Preferences / Theme you are able to add and remove custom themes by clicking on the "+" and "-" buttons.

However both of these buttons run the same operator, with the removal using a specific property. But this means that hovering over either "Add" or "Remove" show the exact tooltip text and description. This is hovering over the removal button:

image

But problems go a bit deeper with these. You can always add a new theme, but you can only remove custom themes, not any of the built-in ones. And the removal button gives no indication of when it works, it just gives an error when it doesn't. And removing a custom theme is a very destructive operation, yet does not give a confirmation.

This PR changes the "Add" operator slightly to give a more specific tooltip:

image

A new operator is made for removal. Not only does it get its own name and description, but a poll function too. So it will be disabled if the current item is not a custom theme, and the tooltip will inform you on why it is disabled:

image

When it is used to remove a custom theme, it will show a confirmation:

image

Changes to python operators that add and remove custom themes. Removal gets poll function, separate name and description, and confirmation. --- In Preferences / Theme you are able to add and remove custom themes by clicking on the "+" and "-" buttons. However both of these buttons run the same operator, with the removal using a specific property. But this means that hovering over either "Add" or "Remove" show the exact tooltip text and description. This is hovering over the **removal** button: ![image](/attachments/4bce7daf-0e44-4267-a1b7-fce6ad0fe2f9) But problems go a bit deeper with these. You can always add a new theme, but you can only remove custom themes, not any of the built-in ones. And the removal button gives no indication of when it works, it just gives an error when it doesn't. And removing a custom theme is a very destructive operation, yet does not give a confirmation. This PR changes the "Add" operator slightly to give a more specific tooltip: ![image](/attachments/46abbe68-f9b8-4206-b76f-a7fda52ed0f6) A new operator is made for removal. Not only does it get its own name and description, but a poll function too. So it will be disabled if the current item is not a custom theme, and the tooltip will inform you on why it is disabled: ![image](/attachments/542629e3-d0b6-44d4-9492-248d8d8c469e) When it is used to remove a custom theme, it will show a confirmation: ![image](/attachments/70b0610a-fbb6-4765-8705-34ec443a6002)
Harley Acheson added this to the User Interface project 2024-02-27 01:25:12 +01:00
Hans Goudey reviewed 2024-02-27 04:08:42 +01:00
@ -573,0 +577,4 @@
preset_menu = "USERPREF_MT_interface_theme_presets"
preset_subdir = "interface_theme"
remove_active: BoolProperty(
Member

remove_active is unused?

`remove_active` is unused?
Author
Member

No, this is overriding AddPresetBase's remove_active from false to true.

No, this is overriding AddPresetBase's remove_active from false to true.
Harley marked this conversation as resolved
Contributor

In the long term AddPresetBase needs to be split so that every preset removal can get confirmation popup (without customized scripts fo each)

But thats a breaking change so for now this is fine

In the long term AddPresetBase needs to be split so that every preset removal can get confirmation popup (without customized scripts fo each) But thats a breaking change so for now this is fine
Harley Acheson force-pushed RemoveCustomTheme from 6d8fcf9661 to 1ad66729c8 2024-03-14 21:32:39 +01:00 Compare
Harley Acheson merged commit a0a2e7e0dd into main 2024-03-14 22:01:44 +01:00
Harley Acheson deleted branch RemoveCustomTheme 2024-03-14 22:01:47 +01:00
Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#118775
No description provided.