Notice that this page has been deprecated in favor of the new PyDM Tutorial in the SRF space |
Git is a command line version control tool that we use in development so that multiple people can work on one file at a time without stomping all over each other's changes. I would strongly recommend reading though the quick git intro I used in college before continuing down this page; I found it really helpful when I was first learning, and it'll help provide a lot of context for what comes next.
The Ubuntu command line tutorial could also be of interest if you're not familiar with using the command line interface.
If you don't have internet, this is a dump of the resources taken on 6/26/20 |
PyDM is next generation EDM! EDM is, unfortunately, the program used to make the typical LCLS home panel (the display with buttons and read backs and things).PyDM is basically a combination of EDM and PyQt (if you don't know what PyQt is, it's what we use to make Python GUIs). The goal is to eventually migrate all existing Python GUIs to PyDM, and to make any new ones going forward in PyDM, all while version controlling them using git and GitHub. The following tutorial will walk you through making a change to an existing PyDM panel and going through the review process to release it into production.
We're gonna get our feet wet with PyDM by adding your own personal Dev Panel to the production Operations Dev Panel!
Note that the tutorial didn't say anything about updating your personal copy if the production copy gets updated by someone else. There are two ways to do this, and it's really your choice which one to do.
You can just immediately merge it in on the next page by clicking "merge pull request"
Sometimes it'll say that it can't be merged automatically. This usually happens when you've edited the same file as one that got updated in production. One way to avoid this problem on GitHub is to always keep your fork's main up to date with production and do all your work in a different branch and just deal with the merge conflicts locally |
This will rely heavily on git remotes. If you'd like to learn more about them, check this out! |
Assuming that you trust the custodian of the local production copy to keep it up to date, this method is probably the easiest.
In your physics devPanel directory, run "git remote add upstream ~/opsTools/devPanel"
If you don't trust the custodian of the local production copy to keep it up to date, then you can connect your bare AFS repo directly to SLAC Lab's production repo.
Steps 2 and 3 will need to be run every time you want to update.
If you're interested in continuing with Python development in Operations (and I hope you are!), here are a couple things you could tackle as intro projects
Probably the best place to start. If you look at opsDevPanel.ui (run "pydm opsDevPanel.ui"), you should see an "Example Dev Panel" button on it. If you click it, you'll launch a really simple GUI whose entire function is to print what it's doing. If you look in the example subdirectory, you'll see example.ui and example.py, which together make up that simple GUI. I created example.ui using designer in the exact same way we created our dev panels in the tutorial. The difference here is that the button on opsDevPanel.ui is a related display button that leads to a python file instead of a ui file (example/example.py – you can open it up in designer to see). If you look at example.py, you'll see the format for a PyDM GUI:
Green: The names you gave the UI elements in designer. Note that PyQt is an actual thing out in the google-able world; I literally googled "pyqt button pressed" to try to figure out how to get the "someone clicked this button" signal and connect it to something
Anything not in a box is boilerplate and should be present in any PyDM GUI. There's also very helpful PyDM documentation that Matt and Hugo wrote if you really wanna dig into what all those other PyDM widgets you see in designer can do.
If you're not familiar with Python and/or Object Oriented Programming, here's a nice guide I found that can help answer questions like "what is __init__?" |
This should theoretically be straightforward (famous last words). It should largely be taking a Qt4 GUI, deleting its autogenerated *_UI.py file, and changing Qt4 syntax to Qt5 syntax.
Most current GUIs live in /usr/local/lcls/tools/python/toolbox, which is both impossible to find and massively bloated with garbage files. Not only that, but they're also version controlled with CVS, which is a much less robust version control system (it allows you to overwrite someone else's changes if you don't know someone else is working on it...)
Migrating them should really just be moving the files to ~/opsTools, creating a SLAC Lab repository for it, connecting it using Matt's script, and updating references to it (like in buttons and launchpad)