optimize imports and cleanup code
This commit is contained in:
40
swissmx.py
40
swissmx.py
@@ -22,7 +22,7 @@ bitmask for simulation:
|
||||
0x100: Deltatau motion code
|
||||
|
||||
"""
|
||||
import logging
|
||||
import logging,time,os,sys,socket
|
||||
class col:
|
||||
d='\033[0m' # default
|
||||
r='\033[31m' # red
|
||||
@@ -74,33 +74,22 @@ class logHandler(logging.StreamHandler):
|
||||
except Exception:
|
||||
self.handleError(record)
|
||||
|
||||
|
||||
# logging.basicConfig(level=logging.DEBUG, format='%(levelname)s:%(module)s:%(lineno)d:%(funcName)s:%(message)s ')
|
||||
logging.basicConfig(level=logging.INFO, format='%(levelname)s:%(module)s:%(lineno)d:%(funcName)s:%(message)s',
|
||||
handlers=[logHandler()])
|
||||
|
||||
#logging.getLogger('PyQt5.uic').setLevel(logging.INFO)
|
||||
#logging.getLogger('requests').setLevel(logging.INFO)
|
||||
#logging.getLogger('urllib3').setLevel(logging.INFO)
|
||||
#logging.getLogger('paramiko').setLevel(logging.INFO)
|
||||
#logging.getLogger('matplotlib').setLevel(logging.INFO)
|
||||
#logging.getLogger('PIL').setLevel(logging.INFO)
|
||||
#logging.getLogger('illumination').setLevel(logging.INFO)
|
||||
#logging.getLogger('zoom').setLevel(logging.INFO)
|
||||
#logging.getLogger('pbtools.misc.pp_comm').setLevel(logging.INFO)
|
||||
_log = logging.getLogger("swissmx")
|
||||
|
||||
if __name__=="__main__":
|
||||
import os,sys,socket
|
||||
if socket.gethostname()=='ganymede':
|
||||
base=os.path.abspath(os.path.dirname(__file__))
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(base,'../PBSwissMX/python')))
|
||||
sys.path.insert(0, os.path.abspath(os.path.join(base,'../../PBTools')))
|
||||
else:
|
||||
sys.path.insert(0, '/sf/cristallina/applications/SwissMX/PBTools')
|
||||
sys.path.insert(0, '/sf/cristallina/applications/SwissMX/PBSwissMX/python')
|
||||
base=os.path.abspath(os.path.dirname(__file__))
|
||||
sys.path.insert(0, os.path.join(base,'PBTools'))
|
||||
sys.path.insert(0, os.path.join(base,'PBSwissMX/python'))
|
||||
|
||||
|
||||
import time
|
||||
class timestamp():
|
||||
def __init__(self):
|
||||
self.t=time.time()
|
||||
@@ -110,9 +99,9 @@ class timestamp():
|
||||
self.t=t
|
||||
ts=timestamp()
|
||||
ts.log('Import part 1/8:')
|
||||
import sys, os, time
|
||||
import sys, os
|
||||
import json, re
|
||||
import random, signal, subprocess
|
||||
import signal, subprocess
|
||||
import matplotlib as mpl
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
@@ -132,22 +121,18 @@ TASK_PRELOCATED = "prelocated"
|
||||
TASK_HELICAL = "helical"
|
||||
TASK_EMBL = "embl"
|
||||
ts.log('Import part 2/8:')
|
||||
|
||||
import ModuleFixTarget
|
||||
import PrelocatedCoordinatesModel # ZAC: orig. code
|
||||
from EmblModule import EmblWidget #ZAC: orig. code
|
||||
from HelicalTable import HelicalTableWidget #ZAC: orig. code
|
||||
|
||||
ts.log('Import part 3/8:')
|
||||
import qtawesome
|
||||
import qutilities
|
||||
from PyQt5 import QtCore, QtGui
|
||||
from PyQt5.QtCore import Qt, pyqtSlot, QSize, QRegExp, pyqtSignal, QObject, QThread, QRectF,QT_VERSION_STR
|
||||
from PyQt5.QtGui import QKeySequence, QPixmap, QRegExpValidator, QFont
|
||||
from PyQt5.QtCore import Qt, pyqtSlot, QSize, pyqtSignal, QObject, QRectF,QT_VERSION_STR
|
||||
from PyQt5.QtGui import QKeySequence, QPixmap
|
||||
from PyQt5.QtWidgets import (
|
||||
QAction, QApplication, QDoubleSpinBox, QFileDialog, QFormLayout, QGridLayout, QGroupBox, QHBoxLayout, QLabel, QLineEdit,
|
||||
QMessageBox, QPlainTextEdit, QProgressBar, QProgressDialog, QPushButton, QShortcut, QSizePolicy, QSpinBox,
|
||||
QSplashScreen, QTextBrowser, QToolBox, QVBoxLayout, QWidget,)
|
||||
QAction, QApplication, QFileDialog, QGridLayout, QHBoxLayout, QLabel, QLineEdit,
|
||||
QMessageBox, QProgressBar, QPushButton, QShortcut, QSizePolicy,
|
||||
QSplashScreen, QToolBox, QVBoxLayout, QWidget,)
|
||||
from PyQt5.uic import loadUiType
|
||||
ts.log('Import part 4/8:')
|
||||
import pyqtUsrObj as UsrGO
|
||||
@@ -165,7 +150,6 @@ import app_utils
|
||||
from app_config import AppCfg,WndParameter #settings, option, toggle_option
|
||||
|
||||
import epics
|
||||
from epics.ca import pend_event
|
||||
import camera,backlight,zoom,illumination,geometry
|
||||
ts.log('Import part 7/8:')
|
||||
import psi_device
|
||||
|
||||
Reference in New Issue
Block a user