Skip to content

Instantly share code, notes, and snippets.

@cpascual
Last active June 14, 2017 14:35
Show Gist options
  • Save cpascual/c1e1c1b8883e373efdd642663d23abd1 to your computer and use it in GitHub Desktop.
Save cpascual/c1e1c1b8883e373efdd642663d23abd1 to your computer and use it in GitHub Desktop.
Eval+IcePAP
"""
Examples on using the evaluation scheme for exposing icepap driver values
as taurus attributes
Note that:
- the first attribute is writable
- The second and 3rd attributes do not even require defining MyIpap
"""
from pyIcePAP import EthIcePAP
class MyIpap(EthIcePAP):
def get_pos1(self):
return int(self.getPosition(1))
def set_pos1(self, v):
self.setPosition(1, int(v))
pos1 = property(get_pos1, set_pos1)
if __name__ == "__main__":
import sys
from taurus.qt.qtgui.application import TaurusApplication
from taurus.qt.qtgui.panel import TaurusForm
app = TaurusApplication()
w = TaurusForm()
w.setModifiableByUser(True)
m = ['eval:@ipap=taurus.core.evaluation.test.res.ipap_rw_example.MyIpap("icepap13",port=5000)/ipap.pos1',
'eval:@ipap=pyIcePAP.EthIcePAP("icepap13", port=5000)/float(ipap.readParameter(1,"POS"))',
'eval:@ipap=pyIcePAP.EthIcePAP("icepap13", port=5000)/float(ipap.readParameter(2,"POS"))',
]
w.setModel(m)
w.show()
sys.exit(app.exec_())
@cpascual
Copy link
Author

cpascual commented Mar 29, 2017

Note: this needs taurus >=4.0.4-alpha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment