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 the way users can select the interface font in Preferences (Appearance) #22927

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

ccordoba12
Copy link
Member

@ccordoba12 ccordoba12 commented Nov 10, 2024

Description of Changes

  • This fixes a regression with respect to the same functionality in Spyder 5, introduced by PR: Add new combobox widgets (API) #21555.
  • Show a preview of the interface font that is updated automatically when users browse among the available fonts in the system (the last part is important in case users have too many fonts installed). I decided to follow @dalthviz's excellent suggestion in PR: Add new combobox widgets (API) #21555 (comment) about it.
  • Prevent font names to be elided in the combobox dropdown.
  • Automatically update the color scheme and monospace font shown in the editor preview widget when browsing them. This is to have feature parity with the new interface font preview.
  • Document API changes in our Changelog and add missing ones for 6.0.2

Visual changes

New interface font preview

interface-font-preview

Editor preview is automatically updated

editor-preview

Issue(s) Resolved

Fixes #22683

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

@ccordoba12 ccordoba12 added this to the v6.0.3 milestone Nov 10, 2024
@ccordoba12 ccordoba12 self-assigned this Nov 10, 2024
@ccordoba12 ccordoba12 changed the title PR: Improve the way can select the interface font in Preferences (Appearance) PR: Improve the way users can select the interface font in Preferences (Appearance) Nov 10, 2024
@ccordoba12
Copy link
Member Author

ccordoba12 commented Nov 10, 2024

@dalthviz, please give this a manual check to see if the implementation works as expected for you.

@dalthviz
Copy link
Member

Did a quick check and seems like the described functionality is working 👍 However, while checking this, I was able to trigger an error when changing the color scheme:

Traceback (most recent call last):
  File "E:\Acer\Documentos\Spyder\Spyder otros\carlos\spyder\spyder\plugins\appearance\confpage.py", line 507, in edit_scheme
    self.update_editor_preview(scheme_name='temp')
  File "E:\Acer\Documentos\Spyder\Spyder otros\carlos\spyder\spyder\plugins\appearance\confpage.py", line 414, in update_editor_preview
    scheme_name = self.scheme_choices_dict[scheme_name]
KeyError: 'temp'

Some other things I noticed which maybe could be improved or seems worthy to mention just in case:

  • Some of the fonts seems like are to big to be rendered a full preview?
    image

  • Seems like the preview is only updated if moving the mouse over an item? So for example navigating with the keyboard doesn't do anything:

fonts_preview

@ccordoba12
Copy link
Member Author

Thanks for the review @dalthviz!

However, while checking this, I was able to trigger an error when changing the color scheme

I was able to reproduce this error and it should be fixed in my second to last commit.

Some of the fonts seems like are to big to be rendered a full preview?

Yeah, that also happens when you increase the interface font size to 15 or 20.

But the idea of the new preview widget is to give users a sense of how that font would look in the application. That's why I think we shouldn't change its size to accommodate the Happy Spydering! text. Doing that would also break the layout of the Appearance page.

Seems like the preview is only updated if moving the mouse over an item? So for example navigating with the keyboard doesn't do anything

Great catch! Fixed in my last commit.

…nged

- Before we were not doing that when users selected a new item with the
keyboard.
- Also, fix entry in Changelog with missing class.
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 ! Gave this a manual check with the latest changes and seems like things are working as expected! Left a couple of comments/questions/ideas but no changes are actually that required for this to be merged so leaving approved 👍

Feel free to merge if you think is ready or let me know if you would like to do any further change following the comments I left

@@ -1,5 +1,16 @@
# History of changes for Spyder 6

## Version 6.0.3 (Unreleased)
Copy link
Member

Choose a reason for hiding this comment

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

As a follow up thing, maybe it could be worthy to add some instructions over the contributing guide mentioning that if an implementation/PR does API changes or any other change that should be featured over the changelog such change should be added as an entry over the CHANGELOG file as part of the changes the PR does?

Comment on lines +381 to +385
if PYQT5 or PYQT6:
super().__init__(parent)
else:
QFontComboBox.__init__(self, parent)
_SpyderComboBoxMixin.__init__(self)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe adding a reference on why this is needed for PySide 2/6 could be worthy

self.preview_editor.set_scrollpastend_enabled(False)

preview_interface_label = QLabel(_("Interface font"))
self.preview_interface = QLabel("Happy Spydering!")
Copy link
Member

Choose a reason for hiding this comment

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

Checking the QFontDialog seems like you are able to edit the text inside the preview widget for a font when using it:

font_preview

I think it kind of make sense to allow users to edit the text since maybe they would like to check how other characters not visible in the preview default text could look. Also, since the preview for the monospace font can be edited, it also kind of makes sense for the other preview to be editable too, no? What do you think?

Also, although I kind of understand trying to be appealing by using the Happy Spydering! text, maybe a more standard text like the selected font's name or using a translatable text as Interface Font Sample or Sample or even AaBbYyZz could make sense? I'm fine with that text but sharing some alternatives just in case

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.

Restore content of font selection pull-down menu in preferences back to version 5 quality
2 participants