-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 how menus are rendered and fix graphical errors related to them (UI) #21511
Conversation
Hello @ccordoba12! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2023-11-14 00:10:59 UTC |
559d859
to
d49324d
Compare
9e45808
to
0998f6e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dalthviz, this is ready for review! I already talked about these changes with the UX team and they agree with them.
I also left several clarifying comments below to make your review easier.
Gave this a quick look and noticed a couple of things (at least on Windows):
|
0998f6e
to
5581408
Compare
Thanks @dalthviz for the review! About your comments:
Ok, it seems rounded borders don't work on Windows and perhaps we need to disable them there. @mrclary, could you check if that's the case on Mac too?
I can't reproduce this on Linux or my Windows VM. @mrclary, what are you seeing on Mac? |
2626750
to
0887092
Compare
The automatically computed by Qt for that menu is too small.
This fixes a visual glitch for that kind of icons when they are associated to a plugin and its corresponding entry is selected in Preferences.
This prevents a memory leak detected by our tests. Specifically, our consoles couldn't be garbage collected with the previous approach.
That way they could be used by other plugins.
- Those are the menus inside the application, not the ones created by the MainMenu plugin. - Showing again shortcuts in those menus was possible thanks to a new functionality added in Qt 5.10. That allowed us to remove some ugly hacks we had for that and which were not working.
Also, correctly set disabled state of menu items.
- That enum is IPythonConsoleWidgetMenus. - That's because several menus are placed in different places, not only in the console options menu.
Also, remove unused import.
- That allows to use our customizations for menus all over the application. - I only left the editor menus untouched because that's going to be addressed when it's migrated to the new API.
- This makes code for the style of those widgets easier to find and modify. - This also makes easier to visually spot those menus that don't inherit from SpyderMenu and instead do it from a plain QMenu.
Also, make menu separators go completely from the left to right border.
- That's because the trick to display them only works on Linux. - Also, remove unneeded constant.
Also, fix comment that referenced a Github issue. Co-authored-by: Daniel Althviz Moré <16781833+dalthviz@users.noreply.github.com>
- That forced us to change the signature of create_menu in two places: PluginMainWidget and SpyderMenuMixin. - Move code in the overridden method that prevents to add menus with the same id to SpyderMenuMixin. This means that that check will be available for any widget that inherits from that mixin, like PluginMainContainer.
This is for clarity.
- That avoids changing the `reposition` internal attribute of that class. - Use this new kwarg to not reposition the Recent projects menu. - Also, match initial ordering of SpyderMenu signature with the one for create_menu.
Also, make it run the _set_icons method because it's necessary after calling render manually. That will also avoid calling _set_icons externally.
85f704d
to
4b9958f
Compare
@dalthviz, I addressed the remaining comments in your review in my last five commits like this:
I had to do a previous refactoring to make that possible because we had two
I made |
I forgot about this. I think it's probably caused by an old version of QDarkstyle. So, please remove and reinstall it again, or create a new environment and check if the problem persists on it. |
I recreated my dev env from scratch and seems like the problem persists 🤔 Checking it says that I have QDarkStyle 3.2 and PyQt 5.15.9. Are there more recent version than those ones or maybe is there any other package that could be affecting the menu colors when hovering disabled items? Just in case, my
Maybe in your dev env @ccordoba12 this is not happening due to having QDarkStyle installed using pip or in editable mode? Maybe pushing forward QDarkStyle 3.2.3 over the feedstock could help with this? |
That's really odd, but to fix it for sure I pushed another commit to set on our side the color of disabled items not only when they are selected. So, please test again. I think the problem should be fixed now. |
Yep, that did the trick 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ccordoba12 !
Edit: I had to rerun the Files tests
checks since the first attempt failed due to a segfault (not sure if is worthy to investigate) but with the rerun they are passing so I'm approving this
Edit 2: Rerunned Linux Python 3.8 pip slow job due to timeout too
Description of Changes
UI changes:
Other changes:
MainWidgetMenu
toPluginMainWidgetOptionsMenu
for clarityBefore
After
Issue(s) Resolved
Fixes #21326.
Fixes #15659.
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: