https://github.com/diamondlightsource/cssgen
Python to generate CS-Studio OPI files
https://github.com/diamondlightsource/cssgen
from-dls-controls
Last synced: 3 months ago
JSON representation
Python to generate CS-Studio OPI files
- Host: GitHub
- URL: https://github.com/diamondlightsource/cssgen
- Owner: DiamondLightSource
- License: other
- Created: 2017-03-13T17:26:23.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-07-15T17:56:22.000Z (10 months ago)
- Last Synced: 2024-07-16T13:44:10.921Z (10 months ago)
- Topics: from-dls-controls
- Language: Python
- Size: 165 KB
- Stars: 0
- Watchers: 3
- Forks: 4
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Simple Python code to generate OPI files for CS-Studio.
[](https://travis-ci.org/DiamondLightSource/cssgen)
[](https://coveralls.io/github/DiamondLightSource/cssgen?branch=master)
[](https://landscape.io/github/DiamondLightSource/cssgen/master)
[](http://cssgen.readthedocs.io/en/latest/?badge=latest)## User guide
Assemble an OPI file by creating widgets. The root widget should be a Display
object. Top-level widgets should be added as children of the root widget. You
would usually create functions to help create common widgets in your displays.To write the OPI file out, use a renderer from the renderers package.
### CS-Studio notes
Any public attribute of a widget object will become a sub-element in XML with
the attribute as tag name. Any simple XML tag can be created by giving the
object the correct variable with the correct value. To find out what attributes
you need, create the widget in CS-Studio and then examine the XML that is
created when you save the file.Complicated sub-elements, such as rules and actions, can be created using the
classes in the opimodel package.## Demo
Examples of the use of the cssgen library are included in the examples folder:
* [Simple example using most features](examples/basic.py) (`examples/basic.py`)## Developer Guide
To create another type of widget, extend the class `Widget` in
`opimodel/widgets.py`.### How to run the tests
Use a virtualenv:
* `virtualenv --no-site-packages venv`
* `source venv/bin/activate`
* `pip install -r requirements.txt`
* `export PYTHONPATH=$(pwd)`
* `py.test --cov=renderers --cov=opimodel test`