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
Multiple plotting GUI #24338
Multiple plotting GUI #24338
Conversation
# SPDX - License - Identifier: GPL - 3.0 + | ||
from __future__ import absolute_import, print_function | ||
|
||
from MultiPlotting.multiPlotting_context import * |
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 have a dislike of wildcard imports as it makes it more difficult to work out what comes from where. Could we change this to an explicit import?
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 will try to get the constants directly.
# & Institut Laue - Langevin | ||
# SPDX - License - Identifier: GPL - 3.0 + | ||
|
||
class AxisChangerPresenter(object): |
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.
Is this class strictly needed it seems to just simply forward everything to the view?
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.
it would be useful if we ever decide to restrain acceptable inputs. We could then do the logic in here. However, yes it is unneeded for this case.
|
||
# use axis changer object later | ||
|
||
class QuickEditModel(object ): |
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.
Is what this model stores ever used? I found replacing it with a mock.MagicMock didn't seem to have an effect
from MultiPlotting.QuickEdit.quickEdit_model import QuickEditModel | ||
from MultiPlotting.QuickEdit.quickEdit_presenter import QuickEditPresenter | ||
|
||
class QuickEditWidget(object): |
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.
Is this class needed ? as it seems to mainly forward all of it's methods straight to methods on the presenter with the same names.
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 something I have to clean up the code at import. It is a wrapper so we only have to import this if we want to use the widget. As opposed to importing the view, presenter and model.
self.layout().takeAt(5) # or more than 1 if you have more buttons | ||
pm = QtGui.QPixmap() | ||
ic = QtGui.QIcon(pm) | ||
# self.add = self.addAction(ic, "Add 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.
stray comments
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.
these are intentional as it is the coded we need to enable the remove line
button in the toolbar. I just have not moved the code over yet.
def set_plot_y_range(self,subplotNames,range): | ||
for subplotName in subplotNames: | ||
self.plotObjects[subplotName].set_ylim(range) | ||
#self._context.subplots[subplotName].ybounds =range |
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.
stray comment
def __init__(self, *args, **kwargs): | ||
super(myToolbar, self).__init__(*args, **kwargs) | ||
self.layout().takeAt(5) # or more than 1 if you have more buttons | ||
pm = QtGui.QPixmap() |
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.
Does this and the line below do anything?
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.
that should be commented out too
@@ -0,0 +1,38 @@ | |||
# Mantid Repository : https://github.com/mantidproject/mantid |
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.
Is this class used anywhere?
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 will remove it
@@ -0,0 +1,23 @@ | |||
# Mantid Repository : https://github.com/mantidproject/mantid |
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.
Is this class used anywhere?
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.
dont think so, I will kill it
@@ -0,0 +1,36 @@ | |||
# Mantid Repository : https://github.com/mantidproject/mantid | |||
# |
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.
Is this class used anywhere?
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 will remove it
I have decided to add the tests to this branch so I have marked it as in progress. |
unrelated failure |
@AnthonyLim23 have you had a chance to see why the build is failing? |
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.
Looks good 👍 I have one minor comment in that when the tick button is pressed to bring up the customization window the drop down menu lists the plots by a name which includes the memory address. I think it would be clearer if this were just the plot title?
I have noticed that too. Since it is a matplotlib thing I am not sure how to fix it |
Ok as its a minor point and difficult to fix happy to leave for now. |
Description of work.
The multiple plotting in elemental analysis was not easily extendable or maintainable. This PR is the first stage of rewriting the functionality into an easier to maintain and extend form. I will add the test in a later PR
Report to: [user name]/[nobody].
To test:
In the
Framework/Properties/Mantid.properties.template
file you will have to addMuon/plotting_test.py
to the list of interfaces and then build Mantid.Open the interface
play with it.
The combobox at the bottom determines which plot(s) you change when editing the x and y ranges, errors etc.
Fixes #24036 and #24341 and #23558.
Reviewer
Please comment on the following (full description):
Code Review
Functional Tests
Does everything look good? Mark the review as Approve. A member of
@mantidproject/gatekeepers
will take care of it.