45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
import sys,os,socket
|
|
sys.path.insert(0, os.path.expanduser('..'))
|
|
hostname=socket.gethostname()
|
|
if hostname=='ganymede':
|
|
sys.path.insert(0, os.path.expanduser('~/Documents/prj/SwissFEL/PBTools/'))
|
|
else:
|
|
#sys.path.insert(0, os.path.expanduser('/tmp/zamofing_t/PBTools/'))
|
|
sys.path.insert(0, os.path.expanduser('/sf/cristallina/applications/mx/zamofing_t/PBTools/'))
|
|
|
|
|
|
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 BaseException as e:
|
|
_log.critical(f'can not connect to deltatau:{e}')
|
|
self._comm=comm=None
|
|
self._gather=gather=None
|
|
#return
|
|
verbose=0x00
|
|
self._shapepath=sp=shapepath.ShapePath(comm, gather, verbose, sync_mode=1, sync_flag=3) |