Python and the CLS and me

advertisement
Python and the CLS and me
EDM Screen Display Using PYTHON
Python and the CLS and me
And Now for Something Completely Different
WHY?
• I was looking for an interpreted language
that would work with the GUI currently
used at the HXMA beamline (a C++/Qt
3.3 application)
• I didn’t want to invent my own language
So, What Happened?
• I tried learning Python (July, 2010)
• But, I needed a project as a learning tool
• I wanted to be able to do a few specific
things:
So, What Happened? #2
1. Be able to program Python
2. Be able to embed Python in an existing
application
3. Interface Python to EPICS
4. Interface Python to some existing CLS
libraries (epicsConnect, epicsQt,
acquisition)
My Python Project - pyEdm
• EDM is based on “Motif”, and (to my
eye) doesn’t make the best use of
object-oriented programming [open to
debate]
• The .edl files are highly structured
• EDM widgets share a lot of methods and
data fields
pyEdm #2
• Success for this project was learning
Python programming, NOT replacing
EDM – and pyEdm does not replace
EDM
• But, I learned how to use Python with
EPICS (pyCa)
• AND I can display EDM files under MSWindows
pyEdm #3
• EDM 1-10f has ~44,000 lines of code
• pyEdm has ~5,000 lines of code – more
common code, big gains from using Qt
• I’d be surprised if adding the missing
functionality (editing screens, saving
screens, missing unusual features)
would add another 5000 lines.
What Did I Get?
Extra
Missing
Missing
Incorrect
Box
Graphics
Words
Engineering
Display
Around
when
Precision
“Invisible”
Python
Units
Widget
–Buttons
EDM
Not EDM
Long
as ofEnough
June 2011
What’s There?
• EPICS\, LOC\, and CALC\ PV’s
• EDM Colors:
– Color Rules
– Alarm Sensitive
– Invisible
• Widget Visibility Rules
What’s There? #2
• Widgets: shapes, lines, text, images,
sliders, groups, PIP, related displays,
shell buttons, message buttons,
symbols, XY graph.
• Path searching for .edl files.
What’s Missing?
•
•
•
•
•
WYSIWYG editing
Blinking Colors
EDM Server Mode
EDM Screen Display from String PV
Complete set of operating and display
modes for many widgets (e.g. all
combinations of text display, all XY
graph modes)
What’s Ugly?
• “Invisible” buttons. I use them lots, and
the uninvisible box around them looks
bad.
• Matching the Fonts. Word placement
and alignment are noticeably different on
many screens.
• Suspected race condition causes
occasional missing widgets on display
What’s Ugly? #2
• Python and QT “Ownership” rules aren’t
matched up.
• Code to support dynamic loading of PV
and object modules screams out
“REWRITE ME!”
• Code to support CALC\ looks a lot like
“C”
Python, Epics, EDM: Observations
• 33 edm object types
• Largest object implementation: 180 lines
• Performance OK, but hasn’t been stress
tested
What’s Being Done Now?
• Updates to pyEdm only as required for
specific EDM screens embedded in a
Python/Qt4/EPICS application
• Near term:
– Make available for “on-call” staff
– Make available for tech staff with MSWindows
Related Python “Stuff”
• Python access to CLS shared libraries
done
• pyEdm can coexist with those libraries
pyEdm embedded
Main Window: Qt UI file displayed using PyQt4
Embedded
pyEdm
display
My hovercraft is full of eels
There are stumbling blocks.
• Some python support isn’t
straightforward (CERN ROOT, Root QT,
QT, and Python are causing me grief)
• A clean python re-implementation of a
class is more work than a quick interface
and extra python code to deal with the
C-style approach to the class
How Not To Hide
•
•
•
•
•
Edm 1-10f
Python 2.5.1
pyEpics 3 (cars.uchicago.edu)
QT 4.5
Epics 3.14.6 and 3.14.9
Download