Last active
June 14, 2017 14:35
-
-
Save cpascual/c1e1c1b8883e373efdd642663d23abd1 to your computer and use it in GitHub Desktop.
Eval+IcePAP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: this needs taurus >=4.0.4-alpha