Open jngrad opened 3 years ago
More generally, it needs to be determined, what exactly can be tought using the program, and if/how this could/should tie in with our other Espresso teaching activities.
I will look into it tomorrow.
espressomd.visualization_opengl.OpenGLLive
and creates a separate window and thread for it once the user starts the simulation.Use predefined example systems or create own systems to
LJ fluid 2D/3D
p(V) dependence
Thanks, Riccardo.
Peter, maybe you can add on how you are using it.
How difficult is it, to modify the gui (as I understand it, a generator is used)
Would it be difficult to adapt to the current Python developr branch?
Would it be possible with reasonable effort (short of remote-controlling the gui) to automatically test one of the simple systems?
PyQt5 allows for automated testing with the QTest module. Here is a small example which automatically starts the LJ fluid example of the PyStar application:
import sys
import unittest as ut
from PyQt5 import QtCore
from PyQt5.QtTest import QTest
from PyQt5.QtWidgets import QApplication
from pystar.application.simlearn import PyStar
class TestLJ2D(ut.TestCase):
def setUp(self):
self.app = QApplication(sys.argv)
self.main_window = PyStar.WelcomeWindow()
def tearDown(self):
self.app.exec_()
def test(self):
LEFT_MB = QtCore.Qt.MouseButton.LeftButton
QTest.mouseClick(self.main_window.LJ2D_button, LEFT_MB)
QTest.mouseClick(self.main_window.current_task.uim.run_button, LEFT_MB)
if __name__ == '__main__':
ut.main()
However, if I don't call self.app.exec_()
in tearDown()
the application crashes after test
finishes executing. But calling self.app.exec_()
causes the app to be launched as a user would do, which is not ideal. I am sure there is a way around that but I am not familiar with Qt at all.
So I think it is relatively simple to test a system.
Changing the GUI should also be easy. The .ui files can be generated with QTCreator and editing the files by hand is also possible.
Regarding the port to develop, I don't know what has changed since 4.14, so I am not sure how much work it is. Each PyStar example system uses some Espresso calls directly, more complex routines, like warming up the system, are wrapped in functions and need less work. If I had to guess I would say it's equivalent to porting two Espresso scripts with each 300 lines of code.
Source code: alexander.d.kazakov/pystar
Installation:
pip3 install simlearn
Running PyStar:
At the time of writing, this requires ESPResSo 4.1.4 (4.2-dev doesn't work out-of-the-box).
Most of the GUI python code was automatically generated from .ui files with
pyuic5
.Tasks for the coding day: