Esempio n. 1
0
 def some_thread_thing(pvname):
     pyca.attach_context()
     pv = setup_pv(pvname)
     pv.get_data(False, -1.0)
     pyca.flush_io()
     assert pv.getevt_cb.wait(timeout=1)
     assert isinstance(pv.data['value'], tuple)
Esempio n. 2
0
 def run(self):
     pyca.attach_context()
     if self.writePv:
         self.writePv = False
         #print 'here', repr(self.pv), repr(self.val)
         caput(self.pv, self.val)
         #self.emit(QtCore.SIGNAL("_caputdone"))
     elif self.readPv:
         print 'run readPv here'
         self.readPv = False
         val = str(caget(self.pv))
         ##ans = self.pv + ' ' + val
         self.pvval = self.pv + ' ' + val
         #self.emit(QtCore.SIGNAL("_cagetdone"))
     elif self.setAlign:
         self.setAlign = False
         self._ims_align()
     elif self.setAuto:
         self.setAuto = False
         self._ims_setauto()
     elif self.setOpen:
         self.setOpen = False
         #self._ims_openclose('Open')
         self._ims_fastopenclose('Open')
     elif self.setClose:
         self.setClose = False
         #self._ims_openclose('Close')
         self._ims_fastopenclose('Close')
     elif self.updatePv:
         self.updatePv = False
         res = self.updatePv()
         self.emit(QtCore.SIGNAL("_update(bool)"), res)
     else:
         pass
Esempio n. 3
0
def ensure_context():
    """
    Let pyca create/attach context if needed. This is important if we're using
    the threading or multiprocessing modules.

    There is no harm in calling this function extra times, nothing will happen
    if the calls were unnecessary. The psp.Pv module will call this whenever a
    psp.Pv.Pv object is returned.

    The user may need to call this additional times if they are sharing pv
    objects between threads or processes.
    """
    pyca.new_context()
    pyca.attach_context()