本文整理汇总了Python中mxcube3.socketio.emit函数的典型用法代码示例。如果您正苦于以下问题:Python emit函数的具体用法?Python emit怎么用?Python emit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了emit函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: value_change
def value_change(self, *args, **kwargs):
"""
Signal handler to be used for sending values to the client via
socketIO.
"""
data = {"name": self._name, "value": args[0]}
socketio.emit("beamline_value_change", data, namespace="/hwr")
开发者ID:marcus-oscarsson,项目名称:mxcube3,代码行数:7,代码来源:beamline_setup.py
示例2: motor_event_callback
def motor_event_callback(*args, **kwargs):
# logging.getLogger('HWR').debug('[MOTOR CALLBACK]')
# logging.getLogger("HWR").debug(kwargs)
# logging.getLogger("HWR").debug(args)
signal = kwargs['signal']
sender = str(kwargs['sender'].__class__).split('.')[0]
motors_info = Utils.get_centring_motors_info()
motors_info.update(Utils.get_light_state_and_intensity())
motors_info['pixelsPerMm'] = mxcube.diffractometer.get_pixels_per_mm()
aux = {}
for pos in mxcube.diffractometer.savedCentredPos:
aux.update({pos['posId']: pos})
# sending all motors position/status, and the current centred positions
msg = {'Signal': signal,
'Message': signal,
'Motors': motors_info,
'CentredPositions': aux,
'Data': args[0] if len(args) == 1 else args}
# logging.getLogger('HWR').debug('[MOTOR CALLBACK] ' + str(msg))
try:
socketio.emit('Motors', msg, namespace='/hwr')
except Exception:
logging.getLogger("HWR").error('error sending message: %s' + str(msg))
开发者ID:mguijarr,项目名称:mxcube3,代码行数:29,代码来源:signals.py
示例3: motor_event_callback
def motor_event_callback(*args, **kwargs):
#logging.getLogger('HWR').debug('[MOTOR CALLBACK]')
#logging.getLogger("HWR").debug(kwargs)
#logging.getLogger("HWR").debug(args)
signal = kwargs['signal']
sender = str(kwargs['sender'].__class__).split('.')[0]
motors_info = dict()
for name in ['Phi', 'Focus', 'PhiZ', 'PhiY', 'Zoom', 'BackLightSwitch','BackLight','FrontLightSwitch', 'FrontLight','Sampx', 'Sampy']:
motors_info.update(Utils.get_movable_state_and_position(name))
motors_info['pixelsPerMm'] = mxcube.diffractometer.get_pixels_per_mm()
aux = {}
for p in mxcube.diffractometer.savedCentredPos:
aux.update({p['posId']:p})
## sending all motors position/status, and the current centred positions
msg = {'Signal': signal,'Message': signal, 'Motors':motors_info, 'CentredPositions': aux, 'Data': args[0] if len(args) ==1 else args}
#logging.getLogger('HWR').debug('[MOTOR CALLBACK] ' + str(msg))
try:
socketio.emit('Motors', msg, namespace='/hwr')
except Exception:
logging.getLogger("HWR").error('error sending message: %s'+str(msg))
try:
msg = { "message": sender +':'+signal, "severity": 'INFO', "timestamp":time.asctime(), "logger":'HWR', "stack_trace":'' }
socketio.emit('log_record', msg, namespace='/logging')
except Exception:
logging.getLogger("HWR").error('error sending message: %s'+str(msg))
开发者ID:milanprica,项目名称:mxcube3,代码行数:31,代码来源:signals.py
示例4: loaded_sample_changed
def loaded_sample_changed(sample):
if not isinstance(sample, Pin):
return
if sample is not None:
address = sample.getAddress()
barcode = sample.getID()
else:
address = ''
barcode = ''
logging.getLogger("HWR").info('loaded sample changed now is: ' + address)
try:
# recreate the dict with the sample info
q = queue_to_dict()
sampleID = sample.getAddress()
sample_data = q.get(sampleID, {})
scutils.set_current_sample(sample_data)
msg = {'signal': 'loadReady', 'location': address}
socketio.emit('sc', msg, namespace='/hwr')
socketio.emit("loaded_sample_changed", {'address': address, 'barcode': barcode}, namespace="/hwr")
except Exception, msg:
logging.getLogger("HWR").error('error setting loaded sample: %s' + str(msg))
开发者ID:MartinSavko,项目名称:mxcube3,代码行数:25,代码来源:signals.py
示例5: safety_shutter_state_changed
def safety_shutter_state_changed(values):
ho = BeamlineSetupMediator(mxcube.beamline).getObjectByRole("safety_shutter")
data = ho.dict_repr()
try:
socketio.emit("beamline_value_change", data, namespace="/hwr")
except Exception:
logging.getLogger("HWR").error('error sending message: %s' + str(data))
开发者ID:MartinSavko,项目名称:mxcube3,代码行数:7,代码来源:signals.py
示例6: plot_end
def plot_end(data):
try:
socketio.emit("plot_end", data, namespace="/hwr")
except Exception:
logging.getLogger("HWR").error(
"error sending plot_end message for plot %s", data["id"]
)
开发者ID:marcus-oscarsson,项目名称:mxcube3,代码行数:7,代码来源:signals.py
示例7: beam_changed
def beam_changed(*args, **kwargs):
ret = {}
beam_info = blcontrol.beamline.getObjectByRole("beam_info")
if beam_info is None:
logging.getLogger("HWR").error("beamInfo is not defined")
return Response(status=409)
try:
beam_info_dict = beam_info.get_beam_info()
except Exception:
beam_info_dict = dict()
ret.update(
{
"position": beam_info.get_beam_position(),
"shape": beam_info_dict.get("shape"),
"size_x": beam_info_dict.get("size_x"),
"size_y": beam_info_dict.get("size_y"),
}
)
try:
socketio.emit("beam_changed", {"data": ret}, namespace="/hwr")
except Exception:
logging.getLogger("HWR").exception("error sending message: %s" + str(msg))
开发者ID:marcus-oscarsson,项目名称:mxcube3,代码行数:27,代码来源:signals.py
示例8: workflow_dialog
def workflow_dialog(wf):
dialog = {
"properties": {
"name": {
"title":"Task name",
"type":"string",
"minLength": 2
},
"description": {
"title":"Description",
"type":"string",
"widget":"textarea"
},
"dueTo": {
"title":"Due to",
"type":"string",
"widget":"compatible-datetime",
"format":"date-time"
}
},
"required":["name"],
"dialogName": "Trouble shooting !"
}
socketio.emit("workflowParametersDialog", dialog, namespace="/hwr")
return Response(status=200)
开发者ID:MartinSavko,项目名称:mxcube3,代码行数:27,代码来源:workflow.py
示例9: loaded_sample_changed
def loaded_sample_changed(sample):
if hasattr(sample, "getAddress"):
address = sample.getAddress()
barcode = sample.getID()
else:
address = ""
barcode = ""
logging.getLogger("HWR").info("Loaded sample changed now is: " + address)
try:
sampleID = address
if blcontrol.sample_changer.hasLoadedSample():
scutils.set_current_sample(sampleID)
else:
scutils.set_current_sample(None)
address = ""
socketio.emit(
"loaded_sample_changed",
{"address": address, "barcode": barcode},
namespace="/hwr",
)
except Exception as msg:
logging.getLogger("HWR").error("error setting loaded sample: %s" + str(msg))
开发者ID:marcus-oscarsson,项目名称:mxcube3,代码行数:26,代码来源:signals.py
示例10: is_collision_safe
def is_collision_safe(*args):
# responds to the 'isCollisionSafe' signal from the Sample Changer
new_state = args[0]
# we are only interested when it becames true
if new_state:
msg = {"signal": "isCollisionSafe", "message": "Sample moved to safe area"}
socketio.emit("sc", msg, namespace="/hwr")
开发者ID:marcus-oscarsson,项目名称:mxcube3,代码行数:7,代码来源:signals.py
示例11: remain_observer
def remain_observer(observer_sid, message):
observer = loginutils.get_user_by_sid(observer_sid)
observer["message"] = message
socketio.emit(
"setObserver", observer, room=observer["socketio_sid"], namespace="/hwr"
)
开发者ID:marcus-oscarsson,项目名称:mxcube3,代码行数:7,代码来源:ra.py
示例12: beam_changed
def beam_changed(*args, **kwargs):
ret = {}
signal = kwargs['signal']
beam_info = mxcube.beamline.getObjectByRole("beam_info")
if beam_info is None:
logging.getLogger('HWR').error("beamInfo is not defined")
return Response(status=409)
try:
beam_info_dict = beam_info.get_beam_info()
except Exception:
beam_info_dict = dict()
ret.update({'position': beam_info.get_beam_position(),
'shape': beam_info_dict.get("shape"),
'size_x': beam_info_dict.get("size_x"),
'size_y': beam_info_dict.get("size_y")
})
msg = {'Signal': signal, 'Message': signal, 'Data': ret}
# logging.getLogger('HWR').debug('[MOTOR CALLBACK] ' + str(msg))
try:
socketio.emit('beam_changed', msg, namespace='/hwr')
except Exception:
logging.getLogger("HWR").error('error sending message: %s' + str(msg))
开发者ID:mguijarr,项目名称:mxcube3,代码行数:26,代码来源:signals.py
示例13: sc_unload
def sc_unload(location):
msg = {
"signal": "operatingSampleChanger",
"location": location,
"message": "Please wait, unloading sample",
}
socketio.emit("sc", msg, namespace="/hwr")
开发者ID:marcus-oscarsson,项目名称:mxcube3,代码行数:8,代码来源:signals.py
示例14: collectOscillationFinished
def collectOscillationFinished(*args):
lastQueueNode = mxcube.queue.lastQueueNode
msg = {'Signal': 'collectOscillationFinished','Message': task_signals['collectOscillationFinished'], 'QueueId':lastQueueNode['id'], 'Sample' :lastQueueNode['sample'] ,'State':get_signal_result('collectOscillationFinished')}
logging.getLogger('HWR').debug('[TASK CALLBACK] ' + str(msg))
try:
socketio.emit('Task', msg, namespace='/hwr')
except Exception:
logging.getLogger("HWR").error('error sending message: '+ str(msg))
开发者ID:milanprica,项目名称:mxcube3,代码行数:8,代码来源:signals.py
示例15: centring_started
def centring_started(method, *args):
usr_msg = 'Using 3-click centring, please click the position on '
usr_msg += 'the sample you would like to center (three times)'
msg = {'signal': 'SampleCentringRequest',
'message': usr_msg}
socketio.emit('sample_centring', msg, namespace='/hwr')
开发者ID:amilan,项目名称:mxcube3,代码行数:8,代码来源:signals.py
示例16: beamline_action_start
def beamline_action_start(name):
msg = {"name": name, "state": RUNNING}
try:
socketio.emit("beamline_action", msg, namespace="/hwr")
except Exception:
logging.getLogger("HWR").exception(
"error sending beamline action message: %s", msg
)
开发者ID:marcus-oscarsson,项目名称:mxcube3,代码行数:8,代码来源:signals.py
示例17: sc_load_ready
def sc_load_ready(location):
msg = {
"signal": "loadReady",
"location": location,
"message": "Sample changer, loaded sample",
}
socketio.emit("sc", msg, namespace="/hwr")
开发者ID:marcus-oscarsson,项目名称:mxcube3,代码行数:8,代码来源:signals.py
示例18: beamline_action_failed
def beamline_action_failed(name):
msg = {"name": name, "state": FAILED}
try:
socketio.emit("beamline_action", msg, namespace="/hwr")
except Exception:
logging.getLogger("HWR").exception("error sending beamline action message: %s", msg)
else:
logging.getLogger('user_level_log').error('Action %s failed !', name)
开发者ID:MartinSavko,项目名称:mxcube3,代码行数:8,代码来源:signals.py
示例19: beamline_action_done
def beamline_action_done(name, result):
msg = {"name": name, "state": READY, "data": result}
try:
socketio.emit("beamline_action", msg, namespace="/hwr")
except Exception:
logging.getLogger("HWR").exception("error sending beamline action message: %s", msg)
else:
logging.getLogger('user_level_log').info('%s done.', name)
开发者ID:MartinSavko,项目名称:mxcube3,代码行数:8,代码来源:signals.py
示例20: centring_started
def centring_started(method, *args):
msg = {"method": method}
if method in ["Computer automatic"]:
msg = {"method": CENTRING_METHOD.LOOP}
elif method in ["Manual 3-click"]:
msg = {"method": CENTRING_METHOD.MANUAL}
socketio.emit("sample_centring", msg, namespace="/hwr")
开发者ID:marcus-oscarsson,项目名称:mxcube3,代码行数:9,代码来源:signals.py
注:本文中的mxcube3.socketio.emit函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论