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 cells support in the Editor #20509

Merged
merged 22 commits into from
Apr 10, 2023

Conversation

jsbautista
Copy link
Contributor

@jsbautista jsbautista commented Feb 9, 2023

Description of Changes

  • Add a button in one of main toolbars to create a new cell.
  • Add cell divider to also cross the line numbers.

Issue(s) Resolved

Part of spyder-ide/ux-improvements#30

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:
@jsbautista

@jsbautista
Copy link
Contributor Author

Hi @dalthviz

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 @jsbautista for working on this! Checked locally and seems like is working correctly 👍 Left some initial comments to remove some imports that seem like unused, some code style issues, suggestions for the new action icon and placement.

However, seems like the tests are failing due to a missing shortcut definition. For that you will need to define a shortcut at

# ---- Editor ----
# -- In widgets/sourcecode/codeeditor.py
(maybe Ctrl + 2 could work for the moment).

Also could you add a GIF to preview the functionality here?

Thanks!

spyder/plugins/editor/panels/codefolding.py Outdated Show resolved Hide resolved
spyder/plugins/editor/panels/linenumber.py Outdated Show resolved Hide resolved
spyder/plugins/editor/panels/linenumber.py Outdated Show resolved Hide resolved
spyder/plugins/editor/plugin.py Outdated Show resolved Hide resolved
spyder/plugins/editor/plugin.py Outdated Show resolved Hide resolved
spyder/plugins/editor/plugin.py Outdated Show resolved Hide resolved
jsbautista and others added 2 commits February 13, 2023 11:52
Co-authored-by: Daniel Althviz Moré <d.althviz10@uniandes.edu.co>
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 @jsbautista , left a couple of new comments/suggestions but other than that this LGTM 👍

I think the failing test job is unrelated to the changes here but lets check if it fails again after applying the changes for the new review

spyder/plugins/editor/widgets/codeeditor.py Outdated Show resolved Hide resolved
spyder/plugins/editor/plugin.py Outdated Show resolved Hide resolved
@dalthviz dalthviz changed the title [WIP] PR: Improve cells support in Spyder PR: Improve cells support in Spyder Mar 6, 2023
@jsbautista
Copy link
Contributor Author

Preview
Cells

@dalthviz dalthviz requested a review from ccordoba12 March 8, 2023 23:29
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 work on this @jsbautista! It's really nice improvement!

spyder/plugins/debugger/panels/debuggerpanel.py Outdated Show resolved Hide resolved
spyder/plugins/debugger/panels/debuggerpanel.py Outdated Show resolved Hide resolved
spyder/plugins/editor/panels/codefolding.py Outdated Show resolved Hide resolved
spyder/plugins/editor/panels/codefolding.py Outdated Show resolved Hide resolved
spyder/plugins/editor/panels/codefolding.py Outdated Show resolved Hide resolved
spyder/plugins/editor/widgets/codeeditor.py Outdated Show resolved Hide resolved
spyder/plugins/editor/widgets/codeeditor.py Outdated Show resolved Hide resolved
spyder/plugins/editor/widgets/codeeditor.py Outdated Show resolved Hide resolved
spyder/plugins/editor/widgets/codeeditor.py Show resolved Hide resolved
spyder/plugins/editor/widgets/codeeditor.py Outdated Show resolved Hide resolved
Co-authored-by: Carlos Cordoba <ccordoba12@gmail.com>
@ccordoba12 ccordoba12 changed the title PR: Improve cells support in Spyder PR: Improve cells support in the Editor Mar 14, 2023
@ccordoba12
Copy link
Member

@jsbautista, I think you need to merge with master to get make our Linux tests pass.

@ccordoba12
Copy link
Member

One last thing to consider, but perhaps for a follow-up PR: should we try to move the code that paints cell dividers on top of panels to the paintEvent method of the base Panel class?

@jsbautista, @dalthviz, I don't know if you considered that before, but it could be worth the try, don't you think?

@dalthviz
Copy link
Member

One last thing to consider, but perhaps for a follow-up PR: should we try to move the code that paints cell dividers on top of panels to the paintEvent method of the base Panel class?

I think that could be a good idea. In that way if more panels are added then they will automatically add the cell line 👍 Probably we will need to validate self.position to only apply the code to paint the cell line when the panel position is on the LEFT right @ccordoba12 ?

@ccordoba12
Copy link
Member

In that way if more panels are added then they will automatically add the cell line +1

Yep, that was my reasoning too.

Probably we will need to validate self.position to only apply the code to paint the cell line when the panel position is on the LEFT right @ccordoba12 ?

I'd say LEFT and RIGHT, just to be safe (users could add panels to the right using our API).

Co-authored-by: Daniel Althviz Moré <d.althviz10@uniandes.edu.co>
@ccordoba12
Copy link
Member

@dalthviz, @jsbautista, I think this is ready to be merged, unless you prefer to make the changes to paintEvent we talked about here too.

@dalthviz
Copy link
Member

@jsbautista will working on the refactor mentioned above here 👍

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 for the refactoring @jsbautista ! Left some suggestions and a couple of comments about where the new paint_cell method is being called. Other possibility is to add to the method the option to just run the logic for a given block (otherwise seems to me that we will be calling a for inside a for with the current usage in some of the panels).

If you have any question about the feedback let me know!

spyder/api/panel.py Outdated Show resolved Hide resolved
spyder/api/panel.py Show resolved Hide resolved
spyder/plugins/debugger/panels/debuggerpanel.py Outdated Show resolved Hide resolved
spyder/plugins/debugger/panels/debuggerpanel.py Outdated Show resolved Hide resolved
spyder/plugins/editor/panels/codefolding.py Outdated Show resolved Hide resolved
spyder/plugins/editor/panels/linenumber.py Outdated Show resolved Hide resolved
@dalthviz
Copy link
Member

dalthviz commented Apr 4, 2023

Note: this needs a merge with master for the tests to pass

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 @jsbautista for your work on this! I left some additional comments for you.

spyder/api/panel.py Outdated Show resolved Hide resolved
spyder/plugins/debugger/panels/debuggerpanel.py Outdated Show resolved Hide resolved
jsbautista and others added 2 commits April 7, 2023 12:47
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.

Looks good to me now, thanks @jsbautista!

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 for all the work here @jsbautista !

@dalthviz dalthviz merged commit d10e9e9 into spyder-ide:master Apr 10, 2023
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.

3 participants