-
Notifications
You must be signed in to change notification settings - Fork 21
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
FIX: problem when closing settings fig #85
Conversation
I confirm it fixes the problem. Any chance we could add a test for this? thx @juangpc ! |
Thank you. |
Hello again, Following @agramfort comment, I'm trying to provide additional test coverage. The tests I've added would've shattered the original issue (#78) so that is progress. However there are some comments, questions I'd like to share:
Thanks. |
@juangpc can you link the PR here I don't see it? there are some tests run here. Any chance to add a test here? |
19e097d
to
0edb436
Compare
Hi, Thanks for your mention @hoechenberger.
Thanks, |
Ready for merge on my side. |
Hello @juangpc, thanks for the effort you're putting in here!! I'm just a little concerned this work is getting a bit outside of the scope of the original idea of this PR, and I wonder if it would make sense to split it into smaller, separate PRs that each basically do one thing only. This will make the review process faster and easier, and allows for a better discussion of the individual changes you're proposing! For example, while I do like the idea of adding a shortcut for settings, it should conform to the system standards, e.g. Cmd+, on macOS, and to whatever the defaults might be on Windows and Linux. |
Ok. No worries. I’ll drop that. Thanks anyway.
On Thu, Apr 7, 2022 at 1:36 AM Richard Höchenberger < ***@***.***> wrote:
Hello @juangpc <https://github.com/juangpc>, thanks for the effort you're
putting in here!!
I'm just a little concerned this work is getting a bit outside of the
scope of the original idea of this PR, and I wonder if it would make sense
to split it into smaller, separate PRs that each basically do one thing
only. This will make the review process faster and easier, and allows for a
better discussion of the individual changes you're proposing!
For example, while I do like the idea of adding a shortcut for settings,
it should conform to the system standards, e.g. Cmd+, on macOS, and to
whatever the defaults might be in windows and Linux.
—
Reply to this email directly, view it on GitHub
<#85 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACEKMIG63SOLI7GMPT37RZTVDZX5TANCNFSM5SGB4NTQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
--
…--
Juan
|
import numpy as np | ||
import math |
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.
import numpy as np | |
import math | |
import math | |
import numpy as np |
import standard lib first
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.
with later changes math lib no longer needed.
mne_qt_browser/_pg_figure.py
Outdated
@@ -1697,10 +1697,10 @@ def __init__(self, main, **kwargs): | |||
class ProjDialog(_BaseDialog): | |||
"""A dialog to toggle projections.""" | |||
|
|||
def __init__(self, main, *, name): | |||
def __init__(self, main, title='Projectors', **kwargs): |
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.
Why do we need the flexibility to adjust the title of that dialog?
Also, in #101 I specifically changed the signature to not accept kwargs
and instead enforce passing keyword-only arguments to ensure better code health. Please revert your change to this line
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.
this one also needs to be reverted. We really try to avoid kwargs in mne as it makes the code super hard to document and test.
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 spent some time looking at the code with @juangpc and I agree **kwargs made the code really hard to read. And it's nested really deep with the backend handling. What used to be "params" in the past is now "kwargs"
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 see. Well. I'm sorry. I'll fix this.
Why do we need the flexibility to adjust the title of that dialog?
I don't need it. I changed it back because: 1. coherence. 2. your code when improperly merged with mine, introduced a bug.
Attending 1) there are 5 or so dialog windows child classes to _BaseDialog. And the way the child classes communicate with it in the other instances is different from what you proposed in your change. See SettingsDialog or HelpDialog, all go in the same toolbar.
Attending 2) The merge with your change introduced a bug in my fork. It might have been me or automatic merge. Don't remember, it was late. This has been solved now. I was surprised by your change, the tests found it. The tests I push here, actually found the bug. So I guess thats a good thing. Anyway it was a bad merge. I'll fix this.
Also, I get a warning when using name
as argument in line 1700: "Shadows name 'name' from greater scope".
I don't know the difference between single star "*" and "**kwargs". This is my first python pr.
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.
Attended: 0408af1
mne_qt_browser/_pg_figure.py
Outdated
self.external_change = True | ||
# Create projection-layout | ||
super().__init__(main.window(), name=name, title='Projectors') | ||
super().__init__(main.window(), title=title, **kwargs) |
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.
See above, please revert this
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.
Attended 0408af1
mne_qt_browser/_pg_figure.py
Outdated
@@ -1697,10 +1697,10 @@ def __init__(self, main, **kwargs): | |||
class ProjDialog(_BaseDialog): | |||
"""A dialog to toggle projections.""" | |||
|
|||
def __init__(self, main, *, name): | |||
def __init__(self, main, title='Projectors', **kwargs): |
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.
@juangpc you need to be careful when making large changes including to public functions. One PR should be on one feature / one bug.
Why do you need these changes to address the fix aimed at here? If it's not related to the fix can you revert the unrelated changes and put this in a follow up PR that can be discussed with the other devs?
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.
Why do you need these changes to address the fix aimed at here?
I don't. Attended here: 0408af1
mne_qt_browser/_pg_figure.py
Outdated
@@ -1578,7 +1578,7 @@ def __init__(self, main, title='Settings', **kwargs): | |||
'<i>(Those methods are adapted from ' | |||
'pyqtgraph)</i><br>' | |||
'Default is "peak".') | |||
self.ds_method_cmbx.addItems(['subsample', 'mean', 'peak']) | |||
self.ds_method_cmbx.addItems(['mean', 'subsample', 'peak']) |
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.
this is unrelated right?
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.
clearly unrelated to the crash. Attended here: 798c39d
Ready on my side. |
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.
Other than a couple of small suggestions, LGTM!
Ready on my side. Since this is getting close to ready for merging. Let me thank you all for your time. Hope this is useful. |
@larsoner I let you merge if happy |
Thanks @juangpc ! |
Hi,
This PR attempts to fix #78 (opened by @jasmainak).
There are two small problems/typos and a QEvent object which is not sent to the closeEvent call.