Python GUI and RAD Ivan Sinkarenko (BE-CO-APS) - CERN Indico
←
→
Page content transcription
If your browser does not render page correctly, please read the page content below
Agenda
• Context
• Python GUIs
• Rapid Application Development with ComRAD
• PyQt distribution
• PyQt widget library
• ComRAD in detail
• Outlook
2Context
• ~500 operational applications developed
over 18 years
• 10% JavaFX Physicists,
• 90% Java Swing Software operators,
developers hardware
experts
• In 2018, Python and PyQt were chosen as
the first-class citizen GUI technology
3Python GUIs
• Standalone PyQt development
• Users have freedom of exploration
• We provide tools to streamline development
• Rapid Application Development
• Useful for rapid prototyping, throw-away applications
• Applicable to regular applications
• Perfect for low- (or no-) code use-cases
• RAD framework on top of standalone PyQt development parts
5ComRAD: Design goals
• Make it easy for newcomers
• Use PyQt and Qt Designer integration, allow no-code use-cases
• Reuse proven technologies
• PyDM, Qt Designer
• Follow good architecture
• Presentation & logic separation
• Do not create lock-in
• Let evolve the application from ComRAD-bound to pure PyQt
• Account for expert users
• Workflow beyond Qt Designer should be smooth (code-first approach)
8Python GUI stack
ComRAD
Tooling:
IDE, acc-py, pip, pylint, Fabian
Custom widgets IvanPyDM
pytest, …
Control libraries:
PyQt (5.12)
pyjapc, pyccda, …
Phil
Python (acc-py) Qt (5.12)
OS (CentOS 7), System libraries
9PyQt distribution
• Prebuilt PyQt-Qt-SIP-Qscintilla bundle accessible on NFS
• Built for acc-py Python
• After activation you get all Qt, PyQt and acc-py executables
• qmake, uic, pyuic5, designer, python, acc-py, …
• Integrates Qt Designer plugins
11PyQt distribution
• Tailors Qt Designer for integration with ComRAD
Only visible from ComRAD Designer
12PyQt widgets
13Widgets
14Widget library
• One project for custom accelerator widgets
• Codebase, documentation, examples & tests are separated into subdirectories
• Contributions are welcome!
• https://wikis.cern.ch/display/ACCPY/Widgets
• Library is built with ComRAD in mind
• To efficiently evolve ComRAD application into a standalone PyQt application,
we have the same widget in both places
• In fact, ComRAD widgets are wrappers around this library widgets
• Pushed forward by Fabian
• First tenant - derivative PyQtGraph widget (Graph)
15Graph: inspired by JDataViewer
Multiple Y axis
New Data representations for Fixed displays
Improved Live data handling
1617
Use-case: Linac 4 Source Autopilot
18ComRAD
19ComRAD: Facts
• Handles things for you:
• Connecting widgets to the control system
• Custom widgets common in accelerator applications
• Main window to render your dashboards
• Tailored integration with Qt Designer => ComRAD Designer
• All of it is discoverable via single “comrad” command
• comrad run, comrad designer, comrad examples, …
• Bundles interactive examples
• https://wikis.cern.ch/display/ACCPY/Rapid+Application+Development
2021
ComRAD: In the field
• Earlier this year, ComRAD has run for few months in Mini CC to test
the stability
• People start showing interest to ComRAD in the labs
• We’re working to bring ComRAD into the control room of ABT in the
near future
2223
Outlook
24Outlook: PyQt distribution
• PyQt training in the end of Jan 2020
• PyQt distribution is ready now
• We’ll look for alternative to NFS
25Outlook: PyQt widgets
• PyQt widget library to be released in December
• With Graph widget only
• We’ll be integrating more widgets in 2020
• Further work on the Graph
26Outlook: ComRAD
• ComRAD beta in Jan 2020
• Support for ComRAD Designer, PyJAPC, RBAC, standard PyQt widgets +
custom Graph, examples browser
• New widgets in parallel with Widget library
• Other features: value-based colors, logging
• ComRAD Designer improvements and migration assistance is the
longer-term goal
27Thank you!
28ComRAD: Design goals (Part 2)
• Make it attractive for existing RAD users
• Ensure smooth transition to the new RAD solution for existing project
29PyQt distribution
• https://wikis.cern.ch/display/ACCPY/PyQt+distribution
• Current prerequisites
• CC7
• Access to NFS
• PyQt5 Python namespace is reserved for us
• Side-project: Docker
• Docker images with PyQt, built against system Python
• For use in CI, machines without NFS, or different OS (e.g. Ubuntu)
30Graph
• Improvements to standard PyQtGraph
• Fixing bugs / quirks in behavior
• Improving the API and documentation
• Bundles Qt Designer plugin
• Is integrated with ComRAD
31ComRAD: Interactive
examples
32ComRAD: Workflow
• Develop your dashboards
• Visual development with “comrad designer”
• Can mix with Python code
• Or do everything completely in code…
• Launch your dashboards
• “comrad run”
• No need to instantiate QApplication manually, like in other PyQt apps
• Hot reload during development
33ComRAD: Visual customization
• Leverages Qt’s QSS engine
34ComRAD: Assisted migration (Future)
• Scripts can assist in converting file formats where direct translation of
features is possible
• In most cases will still require human intervention
• Use-cases:
• Migrate from Inspector to ComRAD
• Migrate from ComRAD to PyQt
35ComRAD
• Connecting widgets to the control system
36ComRAD
• Custom widgets common in accelerator applications
Standard Qt Widgets
ComRAD “C-” widgets
37ComRAD
• Main window to render your dashboards
38ComRAD
• Tailored integration with Qt Designer => ComRAD Designer
3940
PyQt distribution
• Integrates Qt Designer plugins (PyQt, Qscintilla)
• Something that is not achievable with pip
41You can also read