Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Improve style of the Preferences dialog (UI) #21233

Merged
merged 36 commits into from
Nov 4, 2023

Conversation

ccordoba12
Copy link
Member

@ccordoba12 ccordoba12 commented Aug 8, 2023

Description of Changes

  • Organize entries on the left according to the following order:
    • Show the most important pages first.
    • Then show the rest of plugin pages in alphabetical order.
    • Show the Plugins page last.
  • Prevent pages to fill the entire width of the dialog.
  • Set background color for the pages area to make it different from the options one.
  • Fix setting and restoring Preferences dialog size (this was probably broken in Spyder 5).
  • Show wait cursor when opening the dialog.
  • Remove borders around QGroupBox and tabs.
  • Style fixes in several pages.
  • Add superqt as a new dependency to use some of the utilities declared on it.

Before

imagen

After

macOS

prefs-mac

Windows

prefs-windows

Linux

prefs-linux

Issue(s) Resolved

Fixes #15073.

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct: @ccordoba12

Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ccordoba12 ! Checked this locally and I noticed a couple of behaviors that maybe are not wanted:

  • It is possible to set a minimum height for the preferences dialog that seems like quite small:

image

  • Seems like the Appearance page triggers an horizontal scrollbar:

image

  • A small enough dialog height causes some pages to show labels cutted off (Application and Editor > Advanced settings):

image
image

Also, thinking about this style, should the About dialog also use the new tabbar style and border removal idea? Comparing the dialogs side by side:

image

spyder/utils/stylesheet.py Outdated Show resolved Hide resolved
spyder/plugins/preferences/widgets/configdialog.py Outdated Show resolved Hide resolved
That way we avoid them to take the entire width of the config dialog.
Also, remove dead code related to that
- Add background color to the entries area to visually distinguish it
from the options one.
- Increase entries font size in one point.
- Remove border from and add padding to options area.
Introduce a new SpecialTabBarStyleSheet class for that.
- Break ungrouped options into groups so users can tell them apart more
easily.
- Improve names of some options and add tooltips to others.
- Make consistent the use of "Interface" and "Display" with other
plugins.
- Add a new section about "Confirmations" in the "Interface" tab.
That's because that module was not really exposing an API but just
declaring several widgets.
The most important sections are shown first, then the other plugin
pages are shown alphabetically and finally we show the Plugins page.
This happened only when the table has no widgets
- It seems to not be necessary anymore.
- Besides, it was being called on enter and leave events, which was a
waste of resources.
@pep8speaks
Copy link

pep8speaks commented Sep 18, 2023

Hello @ccordoba12! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 251:6: E131 continuation line unaligned for hanging indent
Line 252:6: E128 continuation line under-indented for visual indent
Line 253:6: E128 continuation line under-indented for visual indent
Line 254:6: E128 continuation line under-indented for visual indent

Line 254:80: E501 line too long (80 > 79 characters)

Comment last updated at 2023-11-04 14:30:53 UTC

- This is necessary for Mac.
- Also, fix style of tabbar scroll buttons on Windows and Mac.
- This prevents text from being clipped when there's not enough space
available.
- Also, fix similar error in the editor config page.
- Set default and min sizes for its dialog.
- Increase items padding on Linux.
- Decrease contents area width on Windows and increase it on Linux.
- Adjust min height of editor config page to avoid clipped text.
@ccordoba12
Copy link
Member Author

ccordoba12 commented Oct 25, 2023

@dalthviz, this is ready for another review. About your comments above:

It is possible to set a minimum height for the preferences dialog that seems like quite small

Well thought! I followed your recommendation and did exactly that.

Seems like the Appearance page triggers an horizontal scrollbar

Fixed by setting a min width.

A small enough dialog height causes some pages to show labels cutted off (Application and Editor > Advanced settings)

Thanks for noticing it! This problem shouldn't show up anymore.

Also, thinking about this style, should the About dialog also use the new tabbar style and border removal idea? Comparing the dialogs side by side

I thought exactly the same! The refactoring you suggested (i.e. creating PreferencesTabBarStyleSheet) will help me to do that, but I'll leave it for another PR because this one is already too big.

@ccordoba12
Copy link
Member Author

ccordoba12 commented Oct 25, 2023

Also @dalthviz, the Mac and Windows screenshots in the OP are slightly outdated. Could you give me a hand and upload new ones with my latest changes? Thanks!

Copy link
Member

@dalthviz dalthviz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ccordoba12 ! I checked locally on Windows and seems like things are working as expected. I left a comment regarding the preferences plugin widgets/API namespace change. Anyhow, since this is kind of needed for other things you're working on, I'm leaving this approved so feel free to merge if you think no further changes are needed 👍

Comment on lines +19 to +22
from spyder.plugins.preferences.widgets.config_widgets import (
SpyderConfigPage,
BaseConfigTab
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we preserve the import call that was before and instead do this new import from spyder.plugins.preferences.api? Although those definitions are widgets, it is also true that they are part of the preferences plugin API, no?

Copy link
Member Author

@ccordoba12 ccordoba12 Nov 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although those definitions are widgets, it is also true that they are part of the preferences plugin API, no?

I'd say that not really. I mean, I think what we should put in spyder/plugins/myplugin/api.py are things that other plugins need to import to work in relationship to myplugin. That's why we have mainly enums for actions in the api module of most of our plugins (to place other actions in menus or toolbars before or after them, for instance).

In this particular case, other plugins don't need to import SpyderConfigPage and BaseConfigTab but SpyderPreferencesTab and PluginConfigPage, which are declared here.

However, your comment made me realize that the MOST_IMPORTANT_PAGES constant that I added to spyder.plugins.preferences.api shouldn't be there. That's because that constant is not needed by other plugins but by several modules in the Preferences plugin. So, I put it in api.py to avoid circular imports, but I think it's better placed in spyder.plugins.preferences.__init__, which is where I'll move it in my next commit.

- That's because that constant doesn't need to be imported by other
plugins but shared by several modules in this one.
- So, we need a separate module to declare it in order to avoid circular
imports.
@ccordoba12 ccordoba12 merged commit 7ee864a into spyder-ide:master Nov 4, 2023
22 checks passed
@ccordoba12 ccordoba12 deleted the improve-preferences-ui branch November 4, 2023 17:34
@ccordoba12 ccordoba12 added this to the v6.0alpha3 milestone Nov 4, 2023
jitseniesen added a commit to jitseniesen/spyder-unittest that referenced this pull request Nov 7, 2023
* Return value of `.create_checkbox()` changed in spyder-ide/spyder#20926
  (Show tooltips in Preferences).
* Handling of Prefs dialog box size changed in spyder-ide/spyder#21233
  (Improve style of Preferences dialog box).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch order of entries in preferences
3 participants