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: Migrate line number area to a panel widget #3463

Merged
merged 7 commits into from Oct 25, 2016

Conversation

rlaverde
Copy link
Member

The idea of this PR is to make as a proof of concept for the decoupling of the editors components (line number, scrollbar... ) and make the editor easier to extend through the creation of new panels

I had move the linenumber methods to the LineNumberArea class, there's missing the creation of the Panel class (base class for editor components) and add some management to editors Class to automatize the painting of panels.

@ccordoba12 ccordoba12 added this to the v4.0 milestone Sep 27, 2016
@ccordoba12
Copy link
Member

there's missing the creation of the Panel class (base class for editor components) and add some management to editors Class to automatize the painting of panels.

Do you plan to add all of this in this PR?

@ccordoba12
Copy link
Member

I mean, I'd prefer if you only focus on moving the LineNumberArea widget out of CodeEditor :-)

@goanpeca
Copy link
Member

I think we can make the Panel be the Last PR, before code folding? (or with code folding, since it will better adapt to that concept)

@rlaverde
Copy link
Member Author

rlaverde commented Sep 27, 2016

Do you plan to add all of this in this PR?

I was planing to add that changes too, but as @goanpeca says It will be better to let that for the last PR, after moving the others panels (scrollflagarea, edgeline, and gotoline), so I think this PR is complete.

@goanpeca
Copy link
Member

goanpeca commented Sep 27, 2016

👍

@ccordoba12
Copy link
Member

ccordoba12 commented Sep 27, 2016

@rlaverde, I agree with @goanpeca: please move one panel by PR. If PRs are atomic, we can review and merge them quite quickly :-)

@ccordoba12
Copy link
Member

I don't understand what's happening with Travis. I'll fix it when I come back to Colombia :-)

@ccordoba12
Copy link
Member

@rlaverde, could you rebase or merge this with master? It seems you started this work before 3.0 was released, and that's making Travis to fail :-)

@goanpeca
Copy link
Member

goanpeca commented Oct 4, 2016

@rlaverde is this working fine and ready to be reviewed? or work is still missing?

@rlaverde rlaverde changed the title [WIP] Line number migration Line number migration Oct 4, 2016
@rlaverde
Copy link
Member Author

rlaverde commented Oct 4, 2016

@goanpeca yes, I think it's ready (because Panel class will be other PR)

@goanpeca
Copy link
Member

goanpeca commented Oct 4, 2016

@ccordoba12 or @Nodd or @jitseniesen could you review this one?

@ccordoba12
Copy link
Member

Will do tomorrow :-)

@rlaverde
Copy link
Member Author

@goanpeca In BaseEditMixin there's get_linenumberarea_width() function, https://github.com/spyder-ide/spyder/blob/master/spyder/widgets/mixins.py#L46 that is reimplemented in CodeEditor.

It's ok to delete that function? and what should I do with that function call in https://github.com/spyder-ide/spyder/blob/master/spyder/widgets/mixins.py#L108? (change it for linenumberarea.get_width() will break others child classes because It'll assume that they have a linenumberarea attribute)

@goanpeca
Copy link
Member

@rlaverde since the mixin was made to have a common set of funcs for the editor and consoles then I guess we need to leave it there for backwards compatibility. So you need to leave tha method there, and in the case of the editor we need to overload it to do

def get_linenumberarea_width():
    return linenumberarea.get_width()

So no, dont delete those methods from mixin, we just override it on the code editor to get the correct behavior.

@@ -0,0 +1 @@

Copy link
Member

Choose a reason for hiding this comment

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

Please add our header here too and a docstring describing what is the purpose of this module.

self.editor.setViewportMargins(self.compute_width(), 0,
self.editor.get_scrollflagarea_width(), 0)

def update_linenumberarea(self, qrect, dy):
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 call this one just update?

Copy link
Member

Choose a reason for hiding this comment

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

I mean, instead of update_linenumberarea which sounds redundant now :-)

Copy link
Member Author

@rlaverde rlaverde Oct 25, 2016

Choose a reason for hiding this comment

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

There is a function called update in qwidget class http://doc.qt.io/qt-5/qwidget.html#update, because of that I didn't change this name, should I override this function?

Copy link
Member

Choose a reason for hiding this comment

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

Nop, then could we call it update_ or perhaps update_widget?

Copy link
Member Author

Choose a reason for hiding this comment

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

I changed it for update_

@ccordoba12
Copy link
Member

I left some minor comments, but this looks good to me :-)

Thanks @rlaverde!

else:
self.update(0, qrect.y(),
self.width(),
qrect.height())
Copy link
Member

Choose a reason for hiding this comment

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

Please fix the formatting of this call, it's a bit odd :-)

@ccordoba12
Copy link
Member

Thanks a lot @rlaverde! Merging now :-)

@ccordoba12 ccordoba12 changed the title Line number migration Migrate line number area to a panel widget Oct 25, 2016
@ccordoba12 ccordoba12 merged commit b5c1d73 into spyder-ide:master Oct 25, 2016
@goanpeca
Copy link
Member

WOOT :-)

@rlaverde rlaverde deleted the line-number-migration branch October 25, 2016 20:16
@ccordoba12 ccordoba12 changed the title Migrate line number area to a panel widget PR: Migrate line number area to a panel widget Sep 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants