Files
SwissMX/deltatau.py
2022-08-22 15:18:06 +02:00

37 lines
1.0 KiB
Python

import sys,os
sys.path.insert(0, os.path.expanduser('~/Documents/prj/SwissFEL/PBTools/'))
sys.path.insert(0, os.path.expanduser('..'))
import logging
_log=logging.getLogger(__name__)
from PyQt5.QtWidgets import (QApplication,)
from app_config import AppCfg #settings, option, toggle_option
from pbtools.misc.pp_comm import PPComm
from pbtools.misc.gather import Gather
import shapepath
class Deltatau:
def __init__(self):
app=QApplication.instance()
cfg=app._cfg
host=cfg.value(AppCfg.DT_HOST)
hpp=host.split(':')
param={'host':hpp[0]}
if len(hpp)>1:
param['port']=int(hpp[1])
if len(hpp)>2:
param['fast_gather_port']=int(hpp[2])
_log.info(' -> ssh-tunneling PPComm({host}:{port} {host}:{fast_gather_port})'.format(**param))
try:
self._comm=comm=PPComm(**param)
self._gather=gather=Gather(comm)
except AttributeError as e:
_log.critical('can not connect to deltatau')
return
verbose=0x00
self._shapepath=sp=shapepath.ShapePath(comm, gather, verbose, sync_mode=1, sync_flag=3)