-
Notifications
You must be signed in to change notification settings - Fork 56
Add application code in Python #101
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
Conversation
A new Python sub-package `modmesh.app` is created to house application code (written in Python). At this point there are two of them: `linear_wave` (for the 1D CESE solver) and `sample_mesh` (for simple 2D/3D unstructured mesh). The linear wave requires PySide6 because it uses matplotlib for visualization. Two additional Python modules `core` and `view` are created.
|
|
||
| friend root_base_type; | ||
|
|
||
| WrapRPythonText(pybind11::module & mod, char const * pyname, char const * pydoc) |
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.
Expose the object and then the Python app can change the Python text widget
| }); | ||
| appMenu->addAction(app_linear_wave); | ||
|
|
||
| menuBar->addMenu(appMenu); |
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 menu for applications.
| # line = mm.view.RLine(-1, -1, -1, -2, -2, -2, 0, 128, 128) | ||
| # print(line) | ||
| )"""")); | ||
| m_text->setPlainText(QString("")); |
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 the pytext object exposed, the code can be changed from Python.
| win = ApplicationWindow() | ||
| win.show() | ||
| win.activateWindow() | ||
| # FIXME: This is a hack for PySide object lifecycle management. |
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 not fully understand how PySide manages the lifecycle of the Qt objects it wraps. If I do not keep the object, it will go away and crashes.
|
I am late to the party. I am very interested in this new feature. I will definitely give it a try! |
A new Python sub-package
modmesh.appis created to house application code (written in Python). At this point there are two of them:linear_wave(for the 1D CESE solver) andsample_mesh(for simple 2D/3D unstructured mesh).The linear wave requires PySide6 because it uses matplotlib for visualization.
Two additional Python modules
coreandvieware created.ref #100