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: Add context menu entries for collections to a toolbar (Variable Explorer) #17473

Merged
merged 14 commits into from
Apr 15, 2022

Conversation

dpturibio
Copy link
Contributor

Description of Changes

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI, see Licecap)

Incorporating a static toolbar in the top of the list/table window of Variable Explorer as shown in the picture bellow.

img_toolbar_spyder

Issue(s) Resolved

Fixes spyder-ide/ux-improvements#67

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:

@pep8speaks
Copy link

pep8speaks commented Mar 11, 2022

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

Line 201:80: E501 line too long (107 > 79 characters)
Line 202:80: E501 line too long (105 > 79 characters)

Comment last updated at 2022-04-14 23:40:37 UTC

@dpturibio
Copy link
Contributor Author

@dalthviz I am afraid that I can not mark you as a reviewer(as you asked me in the issue spyder-ide/ux-improvements#67) because of my user privileges. Please let me know if you can do this by yourself, or if I can take any other action in order to do this.

@dalthviz
Copy link
Member

No problem @dpturibio I didn't know that you can only request a review with certain privileges. Will add me here and give it a review. Thanks again for helping with this 👍

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.

Thank you @dpturibio for working on this! Checking locally things seem working except for some cases related to actions not being disabled when no items are selected. We need to somehow attach the selection of variables to the BaseTableView.refresh_menu method to change the actions state (enable/disable) dynamically.

Probably, we need to call the refresh_menu after creating the toolbar with something like self.editor.refresh_menu() but also attach that method to a signal of the editor to do the updates when needed (I'm not totally sure about what to do for that so I need to take some time to check).

So basically for this to be ready we need to figure out a way to change the enable/disable state for the actions shown in the new toolbar depending on what is currently selected in the editor.

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.

After checking a little bit, I left a comment about some additions that could help with the missing thing I talked about in my first review (the toolbar actions state update).

If you have any question @dpturibio let us know!

spyder/widgets/collectionseditor.py Show resolved Hide resolved
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.

Hi again @dpturibio ! After checking the traceback of the tests I think we will need to overwrite the refresh_menu method for the RemoteCollectionsEditorTableView class. For that please add this method on the RemoteCollectionsEditorTableView class:

    def refresh_menu(self):
        if self.var_properties:
            super().refresh_menu()

With that change the tests should pass 🤞🏼

@dpturibio
Copy link
Contributor Author

Thank you @dalthviz for checking this. I was studying what could be causing the failures in the tests.
I will overwrite the method and check what happens.
Thanks a lot for the support.

@dalthviz dalthviz added this to the v5.3.1 milestone Mar 30, 2022
@dpturibio
Copy link
Contributor Author

Hello @dalthviz, any idea about what is causing the failures on tests?

@dalthviz
Copy link
Member

dalthviz commented Apr 6, 2022

Hi again @dpturibio I think we need to rebase your work into the latest 5.x branch to make the tests pass. For that you will need to setup as upstream the spyder repository in your local fork clone and then rebase do the upstream 5.x branch. So you will need to run something like this (with the your 5.x branch checked out in your local clone):

git remote add upstream https://github.com/spyder-ide/spyder.git
git fetch upstream
git rebase upstream/5.x
git push -f

If you need help doing the rebase let me know and I will do it for you 👍

@dpturibio
Copy link
Contributor Author

Hello @dalthviz, after rebase the tests ran successfully. Thanks a lot for the assistance.
I think the next step is review and merge the pull request right?
Please, let me know if you need something else from my side to conclude this pull request.

@dalthviz
Copy link
Member

Hi again @dpturibio I think we need to fix some PEP 8 issues noted here: #17473 (comment) but otherwise this looks good to me 👍

Maybe @ccordoba12 could have more comments. So as you said basically this is missing fixing the PEP 8 issues and a final review. Then we can proceed with the merge 👍

@ccordoba12
Copy link
Member

ccordoba12 commented Apr 13, 2022

Great work @dpturibio! The only thing I'm not so sure about are the Resize to rows/columns to contents buttons. I think mixing such long text buttons with icon-based ones is a bit odd.

If you think they are really important to be placed in the toolbar, perhaps we should look for icons for them?

@dpturibio
Copy link
Contributor Author

Thank you @dalthviz and @ccordoba12.
Is there any repository where I can look for icons? Can I create by myself them based on other Spyder icons?
Please let me know what is the procedure in this case.

@dalthviz
Copy link
Member

Maybe for the icons we could use:

  • mdi.arrow-collapse-horizontal for columns resize:

imagen

  • mdi.arrow-collapse-vertical for rows resize

imagen

Just in case @dpturibio , I checked these icons using the qta-browser of QtAwesome (the project used by Spyder for the icons): https://github.com/spyder-ide/qtawesome

@dpturibio
Copy link
Contributor Author

@dalthviz thank you once again for the help.
bellow is the implementation with the buttons. What do you think @ccordoba12 ?

resizeSpyder

regarding pep8 remaining issues(line too long) #17473 (comment), I think that in this case is acceptable to follow the pattern of lines above and bellow. Is that right?

@dalthviz
Copy link
Member

Thank you @dpturibio for all your work (from the idea discussion to the actual implementation here!)

regarding pep8 remaining issues(line too long) #17473 (comment), I think that in this case is acceptable to follow the pattern of lines above and bellow. Is that right?

Yep, no problem with those 👍

dalthviz
dalthviz previously approved these changes Apr 14, 2022
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 @dpturibio !

@dpturibio
Copy link
Contributor Author

Thanks @dpturibio !

Thank you for all the support :-)

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

This is looking great, thanks @dpturibio! One small suggestion, otherwise looks good to me.

spyder/utils/icon_manager.py Outdated Show resolved Hide resolved
@ccordoba12 ccordoba12 changed the title PR: Add menu for list/tables (from double click) to a static toolbar(Variable Explorer) PR: Add context menu entries for collections to a toolbar (Variable Explorer) Apr 14, 2022
@ccordoba12 ccordoba12 modified the milestones: v5.3.2, v5.3.1 Apr 14, 2022
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

@dpturibio, you forgot to do a couple of changes, then I'll merge.

spyder/widgets/collectionseditor.py Outdated Show resolved Hide resolved
spyder/widgets/collectionseditor.py Outdated Show resolved Hide resolved
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution @dpturibio! Great work here!!

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.

None yet

4 participants