abs-path instead relative, cleanup code
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import logging
|
||||
_log = logging.getLogger(__name__)
|
||||
|
||||
import math
|
||||
import math, os.path
|
||||
from time import sleep
|
||||
from PyQt5.QtCore import Qt, pyqtSignal
|
||||
from PyQt5.QtGui import QPainter, QBrush, QColor, QPainterPath, QPen, QDoubleValidator
|
||||
@@ -10,8 +10,7 @@ from PyQt5.uic import loadUiType
|
||||
from epics import Motor
|
||||
|
||||
from app_utils import assert_tweaker_positions
|
||||
|
||||
Ui_MotorTweak, QWidget = loadUiType('epics_widgets/MotorTweak.ui')
|
||||
Ui_MotorTweak, QWidget = loadUiType(os.path.join(os.path.dirname(__file__),'MotorTweak.ui'))
|
||||
SPMG_STOP = 0
|
||||
SPMG_PAUSE = 1
|
||||
SPMG_MOVE = 2
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# simulated motor tweaks ui:
|
||||
# same interface as MotorTweak and SmaractMotorTweaks, but mimes just a simulated motor
|
||||
|
||||
import logging
|
||||
import logging,os.path
|
||||
from time import sleep
|
||||
from PyQt5.QtCore import Qt, pyqtSignal
|
||||
from PyQt5.QtGui import QPainter, QBrush, QColor, QPainterPath, QPen, QDoubleValidator
|
||||
@@ -17,7 +17,7 @@ from PyQt5.QtWidgets import QMenu, QInputDialog, QAction
|
||||
from PyQt5.uic import loadUiType
|
||||
from epics.ca import pend_event
|
||||
|
||||
Ui_MotorTweak, QWidget = loadUiType('epics_widgets/MotorTweak.ui')
|
||||
Ui_MotorTweak, QWidget = loadUiType(os.path.join(os.path.dirname(__file__),'MotorTweak.ui'))
|
||||
_log = logging.getLogger(__name__)
|
||||
#logger.setLevel(logging.INFO)
|
||||
|
||||
|
||||
15
swissmx.py
15
swissmx.py
@@ -91,13 +91,14 @@ logging.basicConfig(level=logging.INFO, format='%(levelname)s:%(module)s:%(linen
|
||||
_log = logging.getLogger("swissmx")
|
||||
|
||||
if __name__=="__main__":
|
||||
import sys,socket
|
||||
import os,sys,socket
|
||||
if socket.gethostname()=='ganymede':
|
||||
sys.path.insert(0, os.path.expanduser('~/Documents/prj/SwissFEL/PBTools'))
|
||||
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')
|
||||
#_log.info(sys.path)
|
||||
|
||||
import time
|
||||
class timestamp():
|
||||
@@ -235,8 +236,7 @@ class StartupSplash:
|
||||
app.processEvents()
|
||||
time.sleep(.1)
|
||||
|
||||
|
||||
Ui_MainWindow, QMainWindow = loadUiType("swissmx.ui")
|
||||
Ui_MainWindow, QMainWindow = loadUiType(os.path.join(os.path.dirname(__file__),"swissmx.ui"))
|
||||
|
||||
class WndSwissMx(QMainWindow, Ui_MainWindow):
|
||||
sigNewCamImg = pyqtSignal() # index in self._grids
|
||||
@@ -273,7 +273,8 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
||||
self.setWindowTitle(title)
|
||||
|
||||
self._do_quit = False
|
||||
qtawesome.load_font("material", "MaterialIcons-Regular.ttf", "MaterialIcons-Regular.json", "fonts/",)
|
||||
path=os.path.join(os.path.dirname(__file__),"fonts")
|
||||
qtawesome.load_font("material", "MaterialIcons-Regular.ttf", "MaterialIcons-Regular.json", path)
|
||||
|
||||
QtGui.QFontDatabase.addApplicationFont("fonts/Inconsolata-Bold.ttf")
|
||||
QtGui.QFontDatabase.addApplicationFont("fonts/Baloo-Regular.ttf")
|
||||
@@ -798,7 +799,7 @@ class WndSwissMx(QMainWindow, Ui_MainWindow):
|
||||
# ctypes.string_at(0)
|
||||
|
||||
def load_stylesheet(self):
|
||||
with open("swissmx.css", "r") as sheet:
|
||||
with open(os.path.join(os.path.dirname(__file__),"swissmx.css"), "r") as sheet:
|
||||
self.setStyleSheet(sheet.read())
|
||||
|
||||
def setup_sliders(self):
|
||||
|
||||
2
zoom.py
2
zoom.py
@@ -33,7 +33,7 @@ import backlight, illumination, camera
|
||||
import epics
|
||||
from app_config import AppCfg #settings
|
||||
|
||||
Ui_Zoom, QWidget = loadUiType("zoom.ui")
|
||||
Ui_Zoom, QWidget = loadUiType(os.path.join(os.path.dirname(__file__),"zoom.ui"))
|
||||
MIN_ZOOM = 1
|
||||
MAX_ZOOM = 1000
|
||||
SPINNER_SINGLE_STEP = 50
|
||||
|
||||
Reference in New Issue
Block a user