61 lines
1.5 KiB
Python
61 lines
1.5 KiB
Python
import sys
|
|
#import re
|
|
#import numpy as np
|
|
#import copy
|
|
#import os
|
|
#import json
|
|
from datetime import datetime
|
|
import time
|
|
#from shutil import copyfile
|
|
#from os.path import isfile, join
|
|
|
|
from PyQt5 import QtWidgets,QtGui
|
|
from PyQt5.uic import loadUiType
|
|
#from PyQt5.QtGui import QPixmap, QTransform
|
|
#from PyQt5.QtWidgets import QMessageBox
|
|
|
|
from ui.OpticsToolsGui import Ui_OpticsGUI
|
|
from OpticsPlot import OpticsPlot
|
|
from OpticsModel import Model
|
|
from OpticsMachine import Machine
|
|
|
|
|
|
class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
|
|
def __init__(self,phase=0):
|
|
super(OpticsTools, self).__init__()
|
|
self.setupUi(self)
|
|
|
|
self.version = '1.0.1'
|
|
self.setWindowIcon(QtGui.QIcon("rsc/iconoptics.png"))
|
|
self.setWindowTitle("SwissFEL Optics Tools")
|
|
|
|
self.plot = OpticsPlot()
|
|
self.plot.show()
|
|
|
|
# initialize online model
|
|
self.model = Model(phase=phase,parent=self)
|
|
# if phase == 0:
|
|
# self.machine = Machine()
|
|
# else:
|
|
# self.machine = None
|
|
|
|
|
|
def closeEvent(self, event):
|
|
self.plot.close()
|
|
event.accept()
|
|
|
|
# --------------------------------
|
|
# Main routine
|
|
|
|
|
|
if __name__ == '__main__':
|
|
QtWidgets.QApplication.setStyle(QtWidgets.QStyleFactory.create("plastique"))
|
|
app = QtWidgets.QApplication(sys.argv)
|
|
if len(sys.argv) > 1:
|
|
arg=int(sys.argv[1])
|
|
else:
|
|
arg=0
|
|
main = OpticsTools()
|
|
main.show()
|
|
sys.exit(app.exec_())
|