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

euler1d gui and plotting area user experience enhancement #308

Merged
merged 1 commit into from
Apr 13, 2024

Conversation

j8xixo12
Copy link
Collaborator

@j8xixo12 j8xixo12 commented Apr 10, 2024

The following changes are included in this PR:

  1. Plotting area user experience enhancement
    • Grid layout : all plot sharing same x and y axis label
    • Single layout : add legend and remove right hand side secondary y axis
    • Add a modal windows to configure each data line been plotted or not and y axis upper / bottom limit ,also can switch layout between grid and single layout.
  2. Add Euler into main window menubar and remove load euerl1d from app menubar.

Plot:
截圖 2024-04-09 晚上11 05 52
截圖 2024-04-09 晚上10 24 58

Comment on lines -548 to -567
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)

Copy link
Collaborator Author

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.

Comment on lines +853 to +876
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())
Copy link
Collaborator Author

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.

Comment on lines +594 to +604
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)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ditto.

Comment on lines +573 to +583
y_upper_lim_max = 0.0
y_bottom_lim_min = sys.float_info.max
Copy link
Collaborator Author

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.

Comment on lines +84 to +85
y_upper_lim: float = 0.0
y_bottom_lim: float = 0.0
Copy link
Collaborator Author

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.

Copy link
Collaborator Author

@j8xixo12 j8xixo12 left a 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.

Comment on lines +134 to +143
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);
}
Copy link
Collaborator Author

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.

Copy link
Member

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"));
Copy link
Collaborator Author

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.

Copy link
Member

Choose a reason for hiding this comment

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

sweet

Copy link
Member

@yungyuc yungyuc left a 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

Comment on lines +134 to +143
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);
}
Copy link
Member

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"));
Copy link
Member

Choose a reason for hiding this comment

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

sweet

@yungyuc yungyuc added the viewer Visualize stuff label Apr 13, 2024
@yungyuc yungyuc merged commit 0fd80d3 into solvcon:master Apr 13, 2024
9 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
viewer Visualize stuff
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants