-
Notifications
You must be signed in to change notification settings - Fork 41
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
euler1d gui and plotting area user experience enhancement #308
Conversation
def save_file(self): | ||
""" | ||
Toolbar action callback, that use pixmap to store plotting area | ||
and open a dialog that allows user to decide where to store the | ||
figure file. | ||
|
||
:return: None | ||
""" | ||
fig = QPixmap(self.plot_holder.plot.size()) | ||
self.plot_holder.plot.render(fig) | ||
|
||
options = QFileDialog.Options() | ||
options |= QFileDialog.DontUseNativeDialog | ||
fileName, _ = QFileDialog.getSaveFileName(None, "Save file", "", | ||
"All Files (*)", | ||
options=options) | ||
|
||
if fileName != "": | ||
fig.save(fileName, "JPG", 100) | ||
|
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.
Using matplotlib built-in toolbar, it also contain save file button
so remove self-development save file callback.
with (Modal(self.state("plot_config_open"), | ||
title="Plot configuration") | ||
.open(self.on_open) | ||
.close(self.on_close)): | ||
with VBox(): | ||
with HBox(): | ||
Label("Layout selection") | ||
Button("Grid").click(lambda: self.app.grid_layout()) | ||
Button("Single").click((lambda: | ||
self.app.single_layout())) | ||
Label("Data line configuration") | ||
Table(self.plot_config) | ||
Button("Save").click(lambda: self.app.update_layout()) |
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.
Add a modal window that allows the user to select which data line is plotted and adjust the upper/bottom limit of the y-axis. Additionally, it should be able to switch the plot layout.
y_upper_lim_max = max(y_upper_lim_max, data.y_upper_lim) | ||
y_bottom_lim_min = min(y_bottom_lim_min, data.y_bottom_lim) |
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.
ditto.
y_upper_lim_max = 0.0 | ||
y_bottom_lim_min = sys.float_info.max |
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.
Using the max and min limit as the plotting figure.
y_upper_lim: float = 0.0 | ||
y_bottom_lim: float = 0.0 |
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.
added 2 float as Quantity Line's attribute to record current data line y axis upper / bottom limit.
ea43d05
to
f9c053e
Compare
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.
@yungyuc this patch is ready to review.
m_eulerMenu = m_mainWindow->menuBar()->addMenu(QString("Euler")); | ||
|
||
{ | ||
auto app_name = QString("euler1d"); | ||
auto * action = new RAppAction( | ||
QString("Load ") + app_name, | ||
QString("Load ") + app_name, | ||
QString("modmesh.app.") + app_name); | ||
m_eulerMenu->addAction(action); | ||
} |
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.
Add Euler
into modmesh main window toolbar.
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 good
@@ -214,7 +224,6 @@ void RManager::setUpMenu() | |||
m_appMenu = m_mainWindow->menuBar()->addMenu(QString("App")); | |||
|
|||
this->addApplication(QString("sample_mesh")); | |||
this->addApplication(QString("euler1d")); |
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.
Since we have Euler
in toolbar therefore removing euler1d from App
.
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.
sweet
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.
LGTM. Since the CI mac runs are not stable, I will merged once it is healthy again
m_eulerMenu = m_mainWindow->menuBar()->addMenu(QString("Euler")); | ||
|
||
{ | ||
auto app_name = QString("euler1d"); | ||
auto * action = new RAppAction( | ||
QString("Load ") + app_name, | ||
QString("Load ") + app_name, | ||
QString("modmesh.app.") + app_name); | ||
m_eulerMenu->addAction(action); | ||
} |
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 good
@@ -214,7 +224,6 @@ void RManager::setUpMenu() | |||
m_appMenu = m_mainWindow->menuBar()->addMenu(QString("App")); | |||
|
|||
this->addApplication(QString("sample_mesh")); | |||
this->addApplication(QString("euler1d")); |
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.
sweet
The following changes are included in this PR:
Euler
into main window menubar and removeload euerl1d
fromapp
menubar.Plot: