Ready for release

This commit is contained in:
2025-12-18 14:42:40 +01:00
parent a3bda8fbd6
commit 702acf2c74
7 changed files with 1039 additions and 19 deletions

View File

@@ -15,13 +15,17 @@ from sandbox import Sandbox
from matching import Matching
from elegant import Elegant
class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
def __init__(self,phase=0, office= 1):
super(OpticsTools, self).__init__()
self.setupUi(self)
office = office== 1
self.version = '1.0.1'
office = office == 1
if phase > 0:
office = True
self.version = '1.1.1'
self.setWindowIcon(QtGui.QIcon("rsc/iconoptics.png"))
self.plot = OpticsPlot(parent=self)
@@ -30,12 +34,9 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
# initialize online model
self.model = Model(phase=phase,parent=self)
if phase > 0:
office = True
self.machine = Machine(parent = True, office = office)
self.machine.initPVs(self.model.getElements())
self.sandbox = Sandbox(parent = self, machine = self.machine)
self.elegant=Elegant(parent=self,model=self.model)
title = "SwissFEL Optics Tools - Lattice %s (Phase %d)" % (self.model.getLatticeVersion(),phase)
if office:
@@ -43,21 +44,21 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
self.setWindowTitle(title)
# initialization
self.loadSettingsdirect("Settings/ReferenceSetting.json")
# self.loadSettingsdirect("Settings/ReferenceSetting.json")
self.sandbox.updateSandbox()
self.reference = ReferenceManager(parent=self)
self.matching = Matching(parent=self, model=self.model, reference = self.reference)
# self.reference = ReferenceManager(parent=self)
# self.matching = Matching(parent=self, model=self.model, reference = self.reference)
# events handling
self.actionOpen_2.triggered.connect(self.loadSettings)
self.actionSave.triggered.connect(self.saveSettings)
self.UIUpdateFromMachine.clicked.connect(self.fullUpdate)
self.actionHelp.triggered.connect(self.openGit)
self.actionAbout.triggered.connect(self.about)
self.actionOpenMatch.triggered.connect(self.loadMatchingConfig)
self.actionOpenMatchEditor.triggered.connect(self.editMatchingConfig)
self.actionOpenScriptEditor.triggered.connect(self.editMatchingScript)
self.actionExportElegant.triggered.connect(self.exportElegant)
# self.actionOpen_2.triggered.connect(self.loadSettings)
# self.actionSave.triggered.connect(self.saveSettings)
# self.UIUpdateFromMachine.clicked.connect(self.fullUpdate)
# self.actionHelp.triggered.connect(self.openGit)
# self.actionAbout.triggered.connect(self.about)
# self.actionOpenMatch.triggered.connect(self.loadMatchingConfig)
# self.actionOpenMatchEditor.triggered.connect(self.editMatchingConfig)
# self.actionOpenScriptEditor.triggered.connect(self.editMatchingScript)
# self.actionExportElegant.triggered.connect(self.exportElegant)
def closeEvent(self, event):
self.plot.close()
@@ -148,7 +149,7 @@ class OpticsTools(QtWidgets.QMainWindow, Ui_OpticsGUI):
if __name__ == '__main__':
QtWidgets.QApplication.setStyle(QtWidgets.QStyleFactory.create("plastique"))
parser = ArgumentParser()
parser.add_argument('-phase', type=int, help='Disable any action on the machine', default=0)
parser.add_argument('-phase', type=int, help='Select Phase of the Lattice', default=0)
parser.add_argument('-offline', type=int, help='Excludes any connection to control system', default=1)
args = parser.parse_args()
app = QtWidgets.QApplication(sys.argv)