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
Conversation
Do you plan to add all of this in this PR? |
I mean, I'd prefer if you only focus on moving the LineNumberArea widget out of CodeEditor :-) |
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) |
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. |
👍 |
I don't understand what's happening with Travis. I'll fix it when I come back to Colombia :-) |
@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 :-) |
c451777
to
b84de4a
Compare
@rlaverde is this working fine and ready to be reviewed? or work is still missing? |
@goanpeca yes, I think it's ready (because Panel class will be other PR) |
@ccordoba12 or @Nodd or @jitseniesen could you review this one? |
Will do tomorrow :-) |
@goanpeca In BaseEditMixin there's 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 |
@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
So no, dont delete those methods from mixin, we just override it on the code editor to get the correct behavior. |
@@ -0,0 +1 @@ | |||
|
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.
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): |
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.
Should we call this one just update
?
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.
I mean, instead of update_linenumberarea
which sounds redundant now :-)
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.
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?
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.
Nop, then could we call it update_
or perhaps update_widget
?
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.
I changed it for update_
I left some minor comments, but this looks good to me :-) Thanks @rlaverde! |
else: | ||
self.update(0, qrect.y(), | ||
self.width(), | ||
qrect.height()) |
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.
Please fix the formatting of this call, it's a bit odd :-)
Thanks a lot @rlaverde! Merging now :-) |
WOOT :-) |
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.