ENH: Update Preferences UI to split settings to multiple page.#11459
ENH: Update Preferences UI to split settings to multiple page.#11459mpaperno wants to merge 2 commits into
Conversation
…flexibility for usability in more UI situations: * Add more control over button styling, including having no icon, background and border colors, padding, border, and overall sizes; * Add optional scrolling support for the button list control (`TabButtonsListCtrl`); * Add option for nav button tool tips; * Add option for top padding in list control; * Clean up unused and redundant code in `TabButtonsListCtrl` (eg. `OnPaint()` method was never used); * Add & enhance error/safety checks in `TabButtonsListCtrl` (eg. proper array bounds checks) while eliminating redundancy with checks by `Tabbook` itself; * Refactor `TabButton` to eliminate redundancy with features already provided by the base `StaticBox` class (eg. border colors and painting); * Add `TabButton` selection functionality (`SetSelected()`/`GetSelected()`) so it can draw in its own style based on selection status using existing state handler functionality (avoid further redundancy); * Allow specifying `TabButton` minimum size and padding per dimension, with fallback to default sizes as per wxWidgets convention; * `GUI::StateColor`: mark getter methods as `const`.
… sidebar navigation and re-organized items into more sub-categories; Also major refactor for more efficient and safer code, with no redundancies;
Overall changes:
* Use customized `GUI:Tabbook` for paging and navigation;
* Split/move all properties into logical pages and sub-groups by subject;
* Dialog is now resizable, with scroll bars appearing if needed (also in the sidebar nav), and much shorter default size to fit all contents by default w/out scrolling;
* Remembers and restores the last used properties page between uses (until application restart);
* Normalize/centralize many design aspects for consistency and DRY;
* Horizontal rules on sections titles now properly show up in dark mode;
* Remove reams of redundant code and optimize many aspects -- negative LoC while adding functionality and improving readability in many places (eg. line breaks & more separation of content);
Specific property changes:
* Convert all "clear my choice" buttons into direct settings, eg. selecting "Prompt/Always Save/Never Save" when closing project with unsaved changes, or directly en/disabling warnings with a checkbox;
* Reversed language on "no_warn_when_modified_gcodes" property label so the prompt is positive, matching the other settings ("Warn when..." vs. "Don't warn when...");
* When switching LOD setting with unsaved project changes, user is prompted to save only if they accept the LOD change warning prompt, vs. prompting first and then asking to confirm LOD change;
* Remove extraneous "Cancel" button on mixed temperature filament warning prompt & add line break before info link;
* Browsing to set the download folder location now starts from the currently configured path instead of always the default;
* Some labels and tips were updated and new texts were added.
|
Hi @mpaperno Thank you again for this great PR. we wanted this for a long time and we just got some time to work on this. as said we can not merge this PR. we should have a roadmap for this project. |
|
Hi @tonghao-bbl , Well, thanks for letting me know, but... Bummer. I hope you cleaned it all up as well. It was a mess of redundancy. I hope your team can at least get some ideas from my changes. And I just pushed a minor update too.
Seems a bit late at that point. Like this PR. :)
Indeed. Quite frustrating, especially since I had specifically asked if anyone was working on it (in the camera settings PR, which is being ignored after getting encouraged). This is the 2nd time that has happened (that I've asked before doing anything). -Max |
This is a full re-work of the Preferences dialog.
There is also a lot of code cleanup and refactoring involved, primarily to eliminate a lot of duplication and verbosity. In fact there are negative lines of code in the
Preferencesclass changes, even though I added a lot of line breaks and such for easier reading.Please see the commit notes for more technical details.
Pages and property sorting
How to organize & sort all the options and what to name the pages and section titles is of course very subjective. I did put thought and time into this, with quite a few iterations. But I'm completely open to suggestions and changes here! What I think is logical may seem chaotic to others. Of course this will evolve over time anyway, but the more sensible it is to start with, the better.
The good news is that it is very easy to re-organize anything as desired. Each individual setting is contained in one block of code (both creation and insertion into the layout). Each "page" can also easily be embedded into another page, w/out needing to move code around.
Navigation style choice
I decided to utilize the existing
Tabbookcontrol for the paging and navigation, though this required making it more flexible for styling (it is otherwise used as the pager/nav on Device and Calibration pages). So the first commit in this branch does that (the appearance on Device/Calibration pages is unchanged). This could be re-used again in the shortcuts dialog, for example. The styling is basically copied from that shortcuts dialog, in fact.At first I did try to use
wxListBookandwxTreeBookbut the styling options for the navigation buttons were severely limited... I was spending more time fighting the default styles than anything. They just look and act like data lists, not menus. No way to add padding, etc.I chose the sidebar design vs. horizontal tabs across the top because this will be a lot more flexible. Tabs are quickly limiting horizontally, and scrolling or stacking tabs is just awkward. The navigation sidebar will already scroll vertically if needed, so we're not limited in that regard either.
Modified strings
I did end up changing some label texts (grammar, capitalization, inconsistent line endings)... I'm not sure if this was really a great idea because I realize it invalidates translations. I don't know what BL considers "best practices" in these cases. I'm going to assemble a list of modified strings, and post it here for review. I could then revert those changes in the code and perhaps make them in the English translation file instead. There are also a lot of new strings to translate (page names & tips, new section titles, etc). Please advise on best way forward here.
ADDED: Here is the list of modified strings.
This list only includes changes to strings that were and are still being used in the Preferences UI. Not all the additions and removals (though I have that as well, if it helps). Fuzzy matching would probably cover most of these (if that's being utilized).
Details
Compatibility
Tested on all 3 major OSs -- Win 10 & 11, MacOS 26, Linux... only on 1 Debian-based distro (Manjaro) with Ubuntu-24 build from GitHub CI -- Flatpack not tested. I was pleasantly surprised about how consistent it looks across all those systems though.
Although there's a lot of refactoring, and the
Preferences.cppdiff certainly reflects that (sorry!), there really should be no functional changes (except as mentioned in the commit notes). Most of the refactor was just removing literally duplicated code (like creating the same UI element types over and over). Not saying a regression issue is impossible here, but this was all done very carefully and deliberately.More screenshots here
Windows:





This is from an "internal" build so it's showing the extra options (see below from a release build):

Showing button hover highlight with tooltip:
MacOS:
Linux (Manjaro Cinnamon dark theme, running Ubuntu-24.04 build from GitHub CI):
Example of adding a new page
This change, while overdue, was especially inspired by the conversation in #10234 and how that adds a lot of new options to the already-long list.
So here's what it looks like now in my other development version:
The "Camera" section currently with one option in the "3D View" page moves here entirely.
Thanks for your consideration!
-Max