From f06f9b2447c62177fac439d4042c63d2a2687645 Mon Sep 17 00:00:00 2001
From: "paolo.cinquegrana@elettra.eu" <paolo.cinquegrana@elettra.eu>
Date: Thu, 16 Dec 2021 17:22:28 +0100
Subject: [PATCH] aggiunti bottoni bn pari e dispari, layout modificato

---
 src/SluSourceMonitor.py | 1651 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 1651 insertions(+)
 create mode 100644 src/SluSourceMonitor.py

diff --git a/src/SluSourceMonitor.py b/src/SluSourceMonitor.py
new file mode 100644
index 0000000..ad06b08
--- /dev/null
+++ b/src/SluSourceMonitor.py
@@ -0,0 +1,1651 @@
+#!/usr/bin/python3
+
+# carico moduli
+from __future__ import division
+import numpy as np
+import PyTango
+from PyQt4.QtCore import *
+from PyQt4.QtGui import *
+import os
+import sys
+import time
+
+# variabili globali
+listacoperchi = ['CVR1_LSU_UH_CLD', 'CVR_MBX1_MBX2_EOS2_CLD', 'CVR2_LSU_UH_CLD', 'CVR_M21_M22_M23_EOS2_CLD', 'CVR_LSU_EH_1_CLD', 'CVR_LSU_EH_2_CLD', 'BRD_CVR_CLD', 'BRD_SCREEN_CLD']
+listaporte = ['DR_LSU_EH_01_CLD', 'DR_LSU_EH_02_CLD', 'DR_LSU_EH_03_CLD', 'DR_LSU_EH_04_CLD', 'DR_LSU_EH_05_CLD', 'DR_LSU_EH_06_CLD', 'DR_LSU_EH_07_CLD', 'DR_LSU_EH_08_CLD']
+sacco = {}
+try:
+    sacco['calendario'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/laser/calendar_slu.01')
+    sacco['piezo0'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/piezo/tiptilt_slu.04')
+    sacco['piezo1'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/piezo/tiptilt_slu.01')
+    sacco['piezo2'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/piezo/tiptilt_slu.02')
+    sacco['piezo3'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/piezo/tiptilt_slu.03')
+    sacco['piezo4'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/piezo/tiptilt_slu.05')
+    sacco['ccd0'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/diagnostics/ccd_slu.01')
+    sacco['ccd1'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/diagnostics/ccd_slu.03')
+    sacco['ccd2'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/diagnostics/ccd_slu.04')
+    sacco['ccd3'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/diagnostics/ccd_slu.08')
+    sacco['vuoto1'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/vacuum/vgpi_slu_utdr.01')
+    sacco['vuoto2'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/vacuum/vgpi_slu_uh.03')
+    sacco['vuoto3'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/vacuum/vgpi_slu_ehf.01')
+    sacco['vuoto4'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/vacuum/vgpi_slu_ehf.03')
+    sacco['interlock'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/interlock/laser_pss')
+    sacco['pumptemperature'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/cooling/dmm_sl.01')
+    sacco['trigger'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/ec-sl-slpsr-01/evr/ff100000')
+    sacco['totem_delay'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/motor/trls_slu.05')
+    sacco['costanti'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/misc/ranges')
+except PyTango.DevFailed:
+    print('error defining sacco DeviceProxys')
+
+try:
+    selettore = sacco['calendario'].activityNum
+except PyTango.DevFailed:
+    selettore = -1
+
+#parte seed
+if selettore == -1 or selettore == 0: #unknown, shutdown
+    sorgente = None
+    sacco['pump'] = None
+    sacco['emslr'] = None
+    sacco['slelitefbin'] = None
+    sacco['slelitefbout'] = None
+    sacco['slelitefbtime'] = None
+    linea = None
+elif selettore >= 7 and selettore <= 12: #ELITE1
+    sorgente = 1
+    sensoretemperatura = 'Pt100_CHLREVO30_01'
+    triggerdelays = 'Chan1Delay'
+    try:
+        sacco['emslr'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/energy_meter/ems_sl.01')
+        sacco['pump'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/laser/evops_sl.01')
+        sacco['slelitefbin'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/feedback/rtltf_osc.02')
+        sacco['slelitefbout'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/feedback/rtltf_elite.01')
+        sacco['slelitefbtime'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/feedback/fbdelay_sl.01')
+    except PyTango.DevFailed:
+        print('error defining sacco DeviceProxys, section selettore SOURCE')
+elif selettore >= 1 and selettore <= 6: #ELITE2
+    sorgente = 2
+    sensoretemperatura = 'Pt100_CHLRREVO_01'
+    triggerdelays = 'Chan2Delay'
+    try:
+        sacco['emslr'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/energy_meter/ems_sl.03')
+        sacco['pump'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/laser/evops_sl.03')
+        sacco['slelitefbin'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/feedback/rtltf_osc.01')
+        sacco['slelitefbout'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/feedback/rtltf_elite.02')
+        sacco['slelitefbtime'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/sl/feedback/fbdelay_sl.02')
+    except PyTango.DevFailed:
+        print('error defining sacco DeviceProxys, section selettore SOURCE')
+
+#parte bl
+try:
+    sacco['totfeedback'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/feedback/mimofb_totem_slu.01')
+    sacco['tmrfeedback'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/feedback/mimofb_tmr_slu.01')
+    sacco['tmrfbsequencer'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/seq/recover/fb_weights_tmr_slu.01')
+    sacco['tmrccd4'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/diagnostics/ccd_slu.09')
+    sacco['tmxfeedback'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/feedback/mimofb_tmx_slu.01')
+    sacco['tmxfbsequencer'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/seq/recover/fb_weights_tmx_slu.01')
+    sacco['tmxccd4'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/diagnostics/ccd_slu.05')
+    sacco['dpifeedback'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/feedback/mimofb_diproi_slu.01')
+    sacco['dpifbsequencer'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/seq/recover/fb_weights_diproi_slu.01')
+    sacco['dpiccd4'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/diagnostics/ccd_slu.06')
+    sacco['ldmfeedback'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/feedback/mimofb_ldm_slu.01')
+    sacco['ldmfbsequencer'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/seq/recover/fb_weights_ldm_slu.01')
+    sacco['ldmccd4'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/diagnostics/ccd_slu.07')
+    sacco['magfeedback'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/feedback/mimofb_mag_slu.01')
+    sacco['magfbsequencer'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/seq/recover/fb_weights_mag_slu.01')
+    sacco['magccd4'] = PyTango.DeviceProxy('srv-tango-srf-01:20000/slu/diagnostics/ccd_slu.10')
+except PyTango.DevFailed:
+    print('error defining sacco DeviceProxys')
+
+if selettore == -1 or selettore == 0: #unknown, shutdown
+    linea = None
+elif selettore == 5 or selettore == 11: #TOTEM
+    linea = 'TOTEM'
+elif selettore == 1 or selettore == 7: #TIMER
+    linea = 'TIMER'
+elif selettore == 2 or selettore == 8: #TIMEX
+    linea = 'TIMEX'
+elif selettore == 3 or selettore == 9: #DIPRI
+    linea = 'DIPROI'
+elif selettore == 4 or selettore == 10: #LDM
+    linea = 'LDM'
+elif selettore == 6 or selettore == 12: #MAGNEDYN
+    linea = 'MAGNEDYN'
+
+
+class MainWindow(QDialog):
+    def __init__(self, parent=None):
+        super(MainWindow, self).__init__(parent)
+        self.sorgente = sorgente
+        self.linea = linea
+    ### beamline
+        self.gruppobeamline = QGroupBox()
+        self.STATOSLU = QLineEdit("")
+        self.STATOSLU.setReadOnly(1)
+        self.STATOSLU.setToolTip('Experimental hall LASER State')
+        self.beamlineattiva = QLineEdit("")
+        self.beamlineattiva.setReadOnly(1)
+        self.beamlineattiva.setStyleSheet("background-color: rgb(200, 200, 200)")
+        self.menubeamline  = QComboBox()
+        self.menubeamline.addItem("None")
+        self.menubeamline.addItem("TIMER")
+        self.menubeamline.addItem("TIMEX")
+        self.menubeamline.addItem("DIPROI")
+        self.menubeamline.addItem("LDM")
+        self.menubeamline.addItem("MAGNEDYN")
+        self.menubeamline.currentIndexChanged.connect(self.forcepanel)
+        self.calendar = QPushButton("Open calendar panel")
+        self.calendar.clicked.connect(self.apricalendario)
+        self.calendar.setToolTip('Force read for another beamline')
+        self.paginawiki = QPushButton("?")
+        self.paginawiki.clicked.connect(self.lanciailwiki)
+        lobeamline = QGridLayout()
+        lobeamline.addWidget(self.paginawiki, 0, 0)
+        lobeamline.addWidget(QLabel("SLU state:"), 0, 1)
+        lobeamline.addWidget(self.STATOSLU, 0, 2)
+        lobeamline.addWidget(QLabel("Active beamline:"), 0, 3)
+        lobeamline.addWidget(self.beamlineattiva, 0, 4)
+        lobeamline.addWidget(QLabel("|"), 0, 5)
+        lobeamline.addWidget(QLabel("switch to:"), 0, 6)
+        lobeamline.addWidget(self.menubeamline, 0, 7)
+        lobeamline.addWidget(self.calendar, 0, 8)
+        self.gruppobeamline.setLayout(lobeamline)
+    ### amplifier
+        self.grupposorgente = QGroupBox()
+        self.energiaslr_letturaL = QLabel("Source energy")
+        self.energiaslr_letturaL.setAlignment(Qt.AlignCenter)
+        self.energiaslr_lettura = QLineEdit("")
+        self.energiaslr_lettura.setToolTip('IR energy BEFORE beam transport')
+        self.energiaslr_lettura.setReadOnly(1)
+        self.globale_amplificatoreL = QLabel("Amplifier")
+        self.globale_amplificatoreL.setAlignment(Qt.AlignCenter)
+        self.globale_amplificatore = QLineEdit("")
+        self.globale_amplificatore.setReadOnly(1)
+        self.globale_amplificatore.setToolTip('Global indicator for Pump temperature, Amplifier current and triggers. If not green call Reperibile Laser')
+        self.statoinputL = QLabel("Input fb")
+        self.statoinputL.setAlignment(Qt.AlignCenter)
+        self.statoinput = QLineEdit("")
+        self.statoinput.setReadOnly(1)
+        self.statoinput.setToolTip('Input feedback of the amplifier dedicated to SLU. If not green call Reperibile Laser')
+        self.statooutputL = QLabel("Output fb")
+        self.statooutputL.setAlignment(Qt.AlignCenter)
+        self.statooutput = QLineEdit("")
+        self.statooutput.setReadOnly(1)
+        self.statooutput.setToolTip('Output feedback of the amplifier dedicated to SLU. If not green call Reperibile Laser')
+        self.statotimeL = QLabel("Timing fb")
+        self.statotimeL.setAlignment(Qt.AlignCenter)
+        self.statotime = QLineEdit("")
+        self.statotime.setReadOnly(1)
+        self.statotime.setToolTip('Timing feedback of the amplifier dedicated to SLU. If not green call Reperibile Laser')
+        self.vuotoutdrL = QLabel("Vacuum UTDR")
+        self.vuotoutdrL.setAlignment(Qt.AlignCenter)
+        self.vuotoutdr = QLineEdit("")
+        self.vuotoutdr.setToolTip('Vacuum reading of UTDR section of the beam transport. If not green call Reperibile Laser')
+        self.vuotoutdr.setReadOnly(1)
+        self.vuotouhL = QLabel("Vacuum UH")
+        self.vuotouhL.setAlignment(Qt.AlignCenter)
+        self.vuotouh = QLineEdit("")
+        self.vuotouh.setToolTip('Vacuum reading of UH section of the beam transport. If not green call Reperibile Laser')
+        self.vuotouh.setReadOnly(1)
+        self.vuotouhtotemL = QLabel("Vacuum UH-Totem")
+        self.vuotouhtotemL.setAlignment(Qt.AlignCenter)
+        self.vuotouhtotem = QLineEdit("")
+        self.vuotouhtotem.setToolTip('Vacuum reading of UH-TOTEM section of the beam transport. If not green call Reperibile Laser')
+        self.vuotouhtotem.setReadOnly(1)
+        self.vuotototembeamlineL = QLabel("Vacuum Totem-BL")
+        self.vuotototembeamlineL.setAlignment(Qt.AlignCenter)
+        self.vuotototembeamline = QLineEdit("")
+        self.vuotototembeamline.setToolTip('Vacuum reading of TOTEM-BEAMLINE section of the beam transport. If not green call Reperibile Laser')
+        self.vuotototembeamline.setReadOnly(1)
+        losorgente = QGridLayout()
+        losorgente.addWidget(self.energiaslr_letturaL, 0, 0)
+        losorgente.addWidget(self.energiaslr_lettura, 1, 0)
+        losorgente.addWidget(self.globale_amplificatoreL, 0, 1)
+        losorgente.addWidget(self.globale_amplificatore, 1, 1)
+        losorgente.addWidget(self.statoinputL, 0, 2)
+        losorgente.addWidget(self.statoinput, 1, 2)
+        losorgente.addWidget(self.statooutputL, 0, 3)
+        losorgente.addWidget(self.statooutput, 1, 3)
+        losorgente.addWidget(self.statotimeL, 0, 4)
+        losorgente.addWidget(self.statotime, 1, 4)
+        losorgente.addWidget(self.vuotoutdrL, 0, 5)
+        losorgente.addWidget(self.vuotoutdr, 1, 5)
+        losorgente.addWidget(self.vuotouhL, 0, 6)
+        losorgente.addWidget(self.vuotouh, 1, 6)
+        losorgente.addWidget(self.vuotouhtotemL, 0, 7)
+        losorgente.addWidget(self.vuotouhtotem, 1, 7)
+        losorgente.addWidget(self.vuotototembeamlineL, 0, 8)
+        losorgente.addWidget(self.vuotototembeamline, 1, 8)
+        self.grupposorgente.setLayout(losorgente)
+    ### shutter
+        self.grupposhutter = QGroupBox()
+        self.letturashutterlaser = QLineEdit("")
+        self.letturashutterlaser.setReadOnly(1)
+        self.letturashutterbeamline = QLineEdit("")
+        self.letturashutterbeamline.setReadOnly(1)
+        self.abilitatoshutterlaser = QLineEdit("")
+        self.abilitatoshutterlaser.setReadOnly(1)
+        self.abilitatoshutterbeamline = QLineEdit("")
+        self.abilitatoshutterbeamline.setReadOnly(1)
+        self.aprilaserpss = QPushButton("Laser PSS")
+        self.aprilaserpss.clicked.connect(self.apripss)
+        self.porteL = QLabel("Doors:")
+        self.porte = QLineEdit("")
+        self.porte.setReadOnly(1)
+        self.coperchiL = QLabel("Cover:")
+        self.coperchi = QLineEdit("")
+        self.coperchi.setReadOnly(1)
+        self.piellecciL = QLabel("PLC:")
+        self.piellecci = QLineEdit("")
+        self.piellecci.setReadOnly(1)
+        loshutter = QGridLayout()
+        loshutter.addWidget(self.aprilaserpss, 0, 0)
+        loshutter.addWidget(QLabel("Main Shutter:"), 0, 1)
+        loshutter.addWidget(self.letturashutterlaser, 0, 2)
+        loshutter.addWidget(self.abilitatoshutterlaser, 0, 3)
+        loshutter.addWidget(QLabel("Beamline Shutter:"), 0, 4)
+        loshutter.addWidget(self.letturashutterbeamline, 0, 5)
+        loshutter.addWidget(self.abilitatoshutterbeamline, 0, 6)
+        loshutter.addWidget(self.porteL, 0, 7)
+        loshutter.addWidget(self.porte, 0, 8)
+        loshutter.addWidget(self.coperchiL, 0, 9)
+        loshutter.addWidget(self.coperchi, 0, 10)
+        loshutter.addWidget(self.piellecciL, 0, 11)
+        loshutter.addWidget(self.piellecci, 0, 12)
+        self.grupposhutter.setLayout(loshutter)
+    ### feedback
+        self.gruppofeedback = QGroupBox()
+        self.feedbackpannello = QPushButton("Transport feedback")
+        self.feedbackpannello.clicked.connect(self.aprifeedback)
+        self.feedbackstato = QLineEdit("")
+        self.feedbackstato.setReadOnly(1)
+        self.feedbackon = QPushButton("ON")
+        self.feedbackon.clicked.connect(self.accendiilfeedback)
+        self.feedbacksmarton = QPushButton("Start 1by1")
+        self.feedbacksmarton.clicked.connect(self.smart_feedback_on)
+        self.feedbacksb = QPushButton("Standby")
+        self.feedbacksb.clicked.connect(self.mettiilfeedbackinstandby)
+        self.feedbackreset = QPushButton("Reset piezos")
+        self.feedbackreset.clicked.connect(self.resettaicorrettori)
+        self.feedbackconfig = QPushButton('configure fb')
+        self.feedbackconfig.clicked.connect(self.aprifeedbackconf)
+        self.feedbackstopothers = QPushButton('Stop other BL feedbacks')
+        self.feedbackstopothers.clicked.connect(self.neresterasoltantounoFB)
+        self.feedbackstopothers.setDisabled(1)
+        self.feedbackautolabel = QPushButton('Auto-weights')
+        self.feedbackautolabel.clicked.connect(self.apriSEQpesi)
+        self.feedbackautoread = QLineEdit('')
+        self.feedbackautoonoffreset = QPushButton('On')
+        self.feedbackautoonoffreset.clicked.connect(self.comandipersequencer)
+        self.feedbackstopothersauto = QPushButton('Stop other BL sequencer')
+        self.feedbackstopothersauto.clicked.connect(self.neresterasoltantounoSEQ)
+        self.feedbackstopothersauto.setDisabled(1)
+        self.feedbackstopothersccds = QPushButton('Stop other BL ccd')
+        self.feedbackstopothersccds.clicked.connect(self.neresterasoltantounoCCD)
+        self.feedbackstopothersccds.setDisabled(1)
+        self.feedbacksalvapiezi = QPushButton('Save pzt voltage')
+        self.feedbacksalvapiezi.clicked.connect(self.scrivitensioni)
+        self.feedbackripristinapiezi = QPushButton('Restore pzt voltage')
+        self.feedbackripristinapiezi.clicked.connect(self.riapplicatensioni)
+        self.feedback0L = QLabel("SLR Table1 -> Table2")
+        self.feedback0L.setAlignment(Qt.AlignCenter)
+        self.feedback0x = QProgressBar()
+        self.feedback0x.setRange(0, 100)
+        self.feedback0x.setValue(0)
+        self.feedback0x.setToolTip('Horizontal')
+        self.feedback0x.setAlignment(Qt.AlignCenter)
+        self.feedback0y = QProgressBar()
+        self.feedback0y.setRange(0, 100)
+        self.feedback0y.setValue(0)
+        self.feedback0y.setToolTip('Vertical')
+        self.feedback0y.setAlignment(Qt.AlignCenter)
+        self.feedback0corrector = QPushButton("tiptilt")
+        self.feedback0corrector.clicked.connect(self.apritiptilt0)
+        self.feedback0monitor = QPushButton("CCD")
+        self.feedback0monitor.clicked.connect(self.apriccd0)
+        if not(selettore >= 1 and selettore <= 6):
+            self.feedback0L.setDisabled(1)
+            self.feedback0x.setDisabled(1)
+            self.feedback0y.setDisabled(1)
+            self.feedback0corrector.setDisabled(1)
+            self.feedback0monitor.setDisabled(1)
+        self.feedback1L = QLabel("SLR -> UH")
+        self.feedback1L.setAlignment(Qt.AlignCenter)
+        self.feedback1x = QProgressBar()
+        self.feedback1x.setRange(0, 100)
+        self.feedback1x.setValue(0)
+        self.feedback1x.setToolTip('Horizontal')
+        self.feedback1x.setAlignment(Qt.AlignCenter)
+        self.feedback1y = QProgressBar()
+        self.feedback1y.setRange(0, 100)
+        self.feedback1y.setValue(0)
+        self.feedback1y.setToolTip('Vertical')
+        self.feedback1y.setAlignment(Qt.AlignCenter)
+        self.feedback1corrector = QPushButton("tiptilt")
+        self.feedback1corrector.clicked.connect(self.apritiptilt1)
+        self.feedback1monitor = QPushButton("CCD")
+        self.feedback1monitor.clicked.connect(self.apriccd1)
+        self.feedback2L = QLabel("UH -> Totem")
+        self.feedback2L.setAlignment(Qt.AlignCenter)
+        self.feedback2x = QProgressBar()
+        self.feedback2x.setRange(0, 100)
+        self.feedback2x.setValue(0)
+        self.feedback2x.setToolTip('Horizontal')
+        self.feedback2x.setAlignment(Qt.AlignCenter)
+        self.feedback2y = QProgressBar()
+        self.feedback2y.setRange(0, 100)
+        self.feedback2y.setValue(0)
+        self.feedback2y.setToolTip('Vertical')
+        self.feedback2y.setAlignment(Qt.AlignCenter)
+        self.feedback2corrector = QPushButton("tiptilt")
+        self.feedback2corrector.clicked.connect(self.apritiptilt2)
+        self.feedback2monitor = QPushButton("CCD")
+        self.feedback2monitor.clicked.connect(self.apriccd2)
+        self.feedback3L = QLabel("Totem up -> down")
+        self.feedback3L.setAlignment(Qt.AlignCenter)
+        self.feedback3x = QProgressBar()
+        self.feedback3x.setRange(0, 100)
+        self.feedback3x.setValue(0)
+        self.feedback3x.setToolTip('Horizontal')
+        self.feedback3x.setAlignment(Qt.AlignCenter)
+        self.feedback3y = QProgressBar()
+        self.feedback3y.setRange(0, 100)
+        self.feedback3y.setValue(0)
+        self.feedback3y.setToolTip('Vertical')
+        self.feedback3y.setAlignment(Qt.AlignCenter)
+        self.feedback3corrector = QPushButton("tiptilt")
+        self.feedback3corrector.clicked.connect(self.apritiptilt3)
+        self.feedback3monitor = QPushButton("CCD")
+        self.feedback3monitor.clicked.connect(self.apriccd3)
+        self.feedback4L = QLabel("Totem -> Beamline")
+        self.feedback4L.setAlignment(Qt.AlignCenter)
+        self.feedback4x = QProgressBar()
+        self.feedback4x.setRange(0, 100)
+        self.feedback4x.setValue(0)
+        self.feedback4x.setToolTip('Horizontal')
+        self.feedback4x.setAlignment(Qt.AlignCenter)
+        self.feedback4y = QProgressBar()
+        self.feedback4y.setRange(0, 100)
+        self.feedback4y.setValue(0)
+        self.feedback4y.setToolTip('Vertical')
+        self.feedback4y.setAlignment(Qt.AlignCenter)
+        self.feedback4corrector = QPushButton("tiptilt")
+        self.feedback4corrector.clicked.connect(self.apritiptilt4)
+        self.feedback4monitor = QPushButton("CCD")
+        self.feedback4monitor.clicked.connect(self.apriccd4)
+        lofeedback = QGridLayout()
+        lofeedback.addWidget(self.feedbackpannello, 0, 0)
+        lofeedback.addWidget(self.feedbackstato, 0, 1)
+        lofeedback.addWidget(self.feedbackon, 0, 2)
+        lofeedback.addWidget(self.feedbacksb, 0, 3)
+        lofeedback.addWidget(self.feedbackconfig, 0, 4)
+        lofeedback.addWidget(self.feedbacksmarton, 0, 5)
+        lofeedback.addWidget(self.feedbackreset, 0, 6)
+        lofeedback.addWidget(self.feedbacksalvapiezi, 0, 7)
+        lofeedback.addWidget(self.feedbackripristinapiezi, 0, 8, 1, 2)
+        lofeedback.addWidget(self.feedbackautolabel, 1, 0)
+        lofeedback.addWidget(self.feedbackautoread, 1, 1)
+        lofeedback.addWidget(self.feedbackautoonoffreset, 1, 2)
+        lofeedback.addWidget(self.feedbackstopothersauto, 1, 3)
+        lofeedback.addWidget(self.feedbackstopothersccds, 1, 4)
+        lofeedback.addWidget(self.feedbackstopothers, 1, 5)
+        lofeedback.addWidget(self.feedback0L, 2, 0, 1, 2)
+        lofeedback.addWidget(self.feedback0monitor, 3, 0, 1, 2)
+        lofeedback.addWidget(self.feedback0corrector, 4, 0, 1, 2)
+        lofeedback.addWidget(self.feedback0x, 5, 0)
+        lofeedback.addWidget(self.feedback0y, 5, 1)
+        lofeedback.addWidget(self.feedback1L, 2, 2, 1, 2)
+        lofeedback.addWidget(self.feedback1monitor, 3, 2, 1, 2)
+        lofeedback.addWidget(self.feedback1corrector, 4, 2, 1, 2)
+        lofeedback.addWidget(self.feedback1x, 5, 2)
+        lofeedback.addWidget(self.feedback1y, 5, 3)
+        lofeedback.addWidget(self.feedback2L, 2, 4, 1, 2)
+        lofeedback.addWidget(self.feedback2monitor, 3, 4, 1, 2)
+        lofeedback.addWidget(self.feedback2corrector, 4, 4, 1, 2)
+        lofeedback.addWidget(self.feedback2x, 5, 4)
+        lofeedback.addWidget(self.feedback2y, 5, 5)
+        lofeedback.addWidget(self.feedback3L, 2, 6, 1, 2)
+        lofeedback.addWidget(self.feedback3monitor, 3, 6, 1, 2)
+        lofeedback.addWidget(self.feedback3corrector, 4, 6, 1, 2)
+        lofeedback.addWidget(self.feedback3x, 5, 6)
+        lofeedback.addWidget(self.feedback3y, 5, 7)
+        lofeedback.addWidget(self.feedback4L, 2, 8, 1, 2)
+        lofeedback.addWidget(self.feedback4monitor, 3, 8, 1, 2)
+        lofeedback.addWidget(self.feedback4corrector, 4, 8, 1, 2)
+        lofeedback.addWidget(self.feedback4x, 5, 8)
+        lofeedback.addWidget(self.feedback4y, 5, 9)
+        self.gruppofeedback.setLayout(lofeedback)
+    ### delay
+        self.gruppodelay = QGroupBox()
+        self.delaytotem = QPushButton('Totem delay line')
+        self.delaytotem.clicked.connect(self.apridalaytotem)
+        self.delaytotemR = QLineEdit('')
+        self.delaytotemR.setReadOnly(1)
+        self.delaytotemW = QLineEdit('')
+        self.delaytotemABS = QPushButton('GO TO:')
+        self.delaytotemABS.clicked.connect(self.delaytotemgoto)
+        self.delaytotemRELm = QPushButton('<')
+        self.delaytotemRELm.clicked.connect(self.delaytotemmeno)
+        self.delaytotemRELstep = QLineEdit('')
+        self.delaytotemRELp = QPushButton('>')
+        self.delaytotemRELp.clicked.connect(self.delaytotempiu)
+        self.decimators = QPushButton('Decimator panel')
+        self.decimators.clicked.connect(self.apridecimatori)
+        self.delaycalc = QPushButton('Delay caluculator panel')
+        self.delaycalc.clicked.connect(self.apridelaycalc)
+        lodelay = QGridLayout()
+        lodelay.addWidget(self.delaytotem, 0, 0)
+        lodelay.addWidget(self.delaytotemR, 0, 1)
+        lodelay.addWidget(QLabel("|"), 0, 2)
+        lodelay.addWidget(self.delaytotemABS, 0, 3)
+        lodelay.addWidget(self.delaytotemW, 0, 4)
+        lodelay.addWidget(QLabel('Move by:'), 0, 5)
+        lodelay.addWidget(self.delaytotemRELm, 0, 6)
+        lodelay.addWidget(self.delaytotemRELstep, 0, 7)
+        lodelay.addWidget(self.delaytotemRELp, 0, 8)
+        lodelay.addWidget(QLabel("|"), 0, 9)
+        lodelay.addWidget(self.decimators, 0, 10)
+        lodelay.addWidget(self.delaycalc, 0, 11)
+        self.gruppodelay.setLayout(lodelay)
+    ### generale
+        loglobale = QGridLayout()
+        loglobale.addWidget(self.gruppobeamline, 0, 0)
+        loglobale.addWidget(self.grupposorgente, 1, 0)
+        loglobale.addWidget(self.grupposhutter, 2, 0)
+        loglobale.addWidget(self.gruppofeedback, 3, 0)
+        loglobale.addWidget(self.gruppodelay, 4, 0)
+        self.setLayout(loglobale)
+        self.setStyleSheet("QDialog {background-color: rgb(160, 220, 160)}" + "QGroupBox {background-color: rgb(200, 255, 200)}")
+        self.setWindowTitle("SLU Source monitor")
+        self.show()
+        self.timer = QBasicTimer()
+        self.timer.start(2000, self)
+
+    def timerEvent(self, event):
+        self.update()
+
+    def update(self):
+        self.beamlineattiva.setText(str(self.linea))
+        #stato SLU e interlock
+        try:
+            tmp = sacco['interlock'].read_attributes(['BSH', 'BSH_Abi', 'Cover', 'Door', 'Plc_status', 'Key'])
+            if tmp[5].value[10]: #laser OFF
+                self.STATOSLU.setText('OFF')
+                self.STATOSLU.setStyleSheet("background-color: rgb(255, 255, 255)")
+            if tmp[5].value[11]: #laser ON
+                self.STATOSLU.setText('ON')
+                self.STATOSLU.setStyleSheet("background-color: rgb(0, 255, 0)")
+            if tmp[5].value[12]: #laser Maintenance
+                self.STATOSLU.setText('UH Maintenance')
+                self.STATOSLU.setStyleSheet("background-color: rgb(255, 0, 0)")
+            if tmp[5].value[13]: #laser Maintenance
+                self.STATOSLU.setText('EH Maintenance')
+                self.STATOSLU.setStyleSheet("background-color: rgb(255, 0, 0)")
+        #valvolevuoto e shutter
+            if tmp[0].value[0] or tmp[0].value[2]: #shutter slr e valvola vuoto
+                self.letturashutterlaser.setText('CLOSED')
+                self.letturashutterlaser.setStyleSheet("background-color: rgb(255, 255, 255)")
+            if tmp[0].value[1] and tmp[0].value[3]: #shutter slr e valvola vuoto
+                self.letturashutterlaser.setText('OPENED')
+                self.letturashutterlaser.setStyleSheet("background-color: rgb(0, 255, 0)")
+            if self.linea == 'TIMEX' and tmp[0].value[5]:
+                self.letturashutterbeamline.setText('CLOSED') #timex
+                self.letturashutterbeamline.setStyleSheet("background-color: rgb(255, 255, 255)")
+            if self.linea == 'TIMEX' and tmp[0].value[7]:
+                self.letturashutterbeamline.setText('OPENED') #timex
+                self.letturashutterbeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+            if self.linea == 'DIPROI' and tmp[0].value[8]:
+                self.letturashutterbeamline.setText('CLOSED') #diproi
+                self.letturashutterbeamline.setStyleSheet("background-color: rgb(255, 255, 255)")
+            if self.linea == 'DIPROI' and tmp[0].value[10]:
+                self.letturashutterbeamline.setText('OPENED') #diproi
+                self.letturashutterbeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+            if self.linea == 'LDM' and tmp[0].value[11]:
+                self.letturashutterbeamline.setText('CLOSED') #ldm
+                self.letturashutterbeamline.setStyleSheet("background-color: rgb(255, 255, 255)")
+            if self.linea == 'LDM' and tmp[0].value[13]:
+                self.letturashutterbeamline.setText('OPENED') #ldm
+                self.letturashutterbeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+            if self.linea == 'TIMER' and tmp[0].value[14]:
+                self.letturashutterbeamline.setText('CLOSED') #timer
+                self.letturashutterbeamline.setStyleSheet("background-color: rgb(255, 255, 255)")
+            if self.linea == 'TIMER' and tmp[0].value[16]:
+                self.letturashutterbeamline.setText('OPENED') #timer
+                self.letturashutterbeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+            if self.linea == 'MAGNEDYN' and tmp[0].value[19]:
+                self.letturashutterbeamline.setText('CLOSED') #magnedyn
+                self.letturashutterbeamline.setStyleSheet("background-color: rgb(255, 255, 255)")
+            if self.linea == 'MAGNEDYN' and tmp[0].value[21]:
+                self.letturashutterbeamline.setText('OPENED') #magnedyn
+                self.letturashutterbeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+        #abilitazioni
+            if tmp[1].value[0] and tmp[1].value[10]:
+                self.abilitatoshutterlaser.setText('ENABLED')
+                self.abilitatoshutterlaser.setStyleSheet("background-color: rgb(0, 255, 0)")
+            else:
+                self.abilitatoshutterlaser.setText('DISABLED')
+                self.abilitatoshutterlaser.setStyleSheet("background-color: rgb(255, 0, 0)")
+            if self.linea == 'TIMEX' and tmp[1].value[1]:
+                self.abilitatoshutterbeamline.setText('ENABLED') #timex
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif self.linea == 'TIMEX' and tmp[1].value[1] != True:
+                self.abilitatoshutterbeamline.setText('DISABLED') #timex
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(255, 0, 0)")
+            elif self.linea == 'DIPROI' and tmp[1].value[2]:
+                self.abilitatoshutterbeamline.setText('ENABLED') #diproi
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif self.linea == 'DIPROI' and tmp[1].value[2] != True:
+                self.abilitatoshutterbeamline.setText('DISABLED') #diproi
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(255, 0, 0)")
+            elif self.linea == 'LDM' and tmp[1].value[3]:
+                self.abilitatoshutterbeamline.setText('ENABLED') #ldm
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif self.linea == 'LDM' and tmp[1].value[3] != True:
+                self.abilitatoshutterbeamline.setText('DISABLED') #ldm
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(255, 0, 0)")
+            elif self.linea == 'TIMER' and tmp[1].value[4]:
+                self.abilitatoshutterbeamline.setText('ENABLED') #timer
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif self.linea == 'TIMER' and tmp[1].value[4] != True:
+                self.abilitatoshutterbeamline.setText('DISABLED') #timer
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(255, 0, 0)")
+            elif self.linea == 'MAGNEDYN' and tmp[1].value[12]:
+                self.abilitatoshutterbeamline.setText('ENABLED') #magnedyn
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif self.linea == 'MAGNEDYN' and tmp[1].value[12] != True:
+                self.abilitatoshutterbeamline.setText('DISABLED') #magnedyn
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(255, 0, 0)")
+            else:
+                self.abilitatoshutterbeamline.setText('Unknown') #?
+                self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(255, 0, 0)")
+        #porte, coperchi e plc
+            if False in tmp[2].value[0:5]:
+                self.coperchi.setText('Cover open')
+                self.coperchi.setStyleSheet("background-color: rgb(255, 0, 0)")
+            else:
+                self.coperchi.setText('All OK')
+                self.coperchi.setStyleSheet("background-color: rgb(0, 255, 0)")
+            if self.linea == 'MAGNEDYN':
+                if tmp[3].value[8] == False or tmp[3].value[9] == False:
+                    self.porte.setText('Doors open')
+                    self.porte.setStyleSheet("background-color: rgb(255, 0, 0)")
+                else:
+                    self.porte.setText('All OK')
+                    self.porte.setStyleSheet("background-color: rgb(0, 255, 0)")
+            else:
+                if tmp[3].value[13] == False:
+                    self.porte.setText('Doors open')
+                    self.porte.setStyleSheet("background-color: rgb(255, 0, 0)")
+                else:
+                    self.porte.setText('All OK')
+                    self.porte.setStyleSheet("background-color: rgb(0, 255, 0)")
+            if tmp[4].value == False:
+                self.piellecci.setText('PLC state')
+                self.piellecci.setStyleSheet("background-color: rgb(255, 0, 0)")
+            else:
+                self.piellecci.setText('All OK')
+                self.piellecci.setStyleSheet("background-color: rgb(0, 255, 0)")
+        except:
+            self.STATOSLU.setText('Unknown')
+            self.STATOSLU.setStyleSheet("background-color: rgb(150, 150, 150)")
+            self.letturashutterlaser.setText('Unknown')
+            self.letturashutterlaser.setStyleSheet("background-color: rgb(150, 150, 150)")
+            self.letturashutterbeamline.setText('Unknown')
+            self.letturashutterbeamline.setStyleSheet("background-color: rgb(150, 150, 150)")
+            self.abilitatoshutterlaser.setText('Unknown')
+            self.abilitatoshutterlaser.setStyleSheet("background-color: rgb(150, 150, 150)")
+            self.abilitatoshutterbeamline.setText('Unknown')
+            self.abilitatoshutterbeamline.setStyleSheet("background-color: rgb(150, 150, 150)")
+            self.porte.setText('Unknown')
+            self.porte.setStyleSheet("background-color: rgb(150, 150, 150)")
+            self.coperchi.setText('Unknown')
+            self.coperchi.setStyleSheet("background-color: rgb(150, 150, 150)")
+        #vuoto
+        try:
+            READ_vuotoutdr = sacco['vuoto1'].read_attribute('Pressure')
+            self.vuotoutdr.setText(str(round(READ_vuotoutdr.value, 1)) + ' mBar')
+            if str(READ_vuotoutdr.quality) == 'ATTR_VALID':
+                self.vuotoutdr.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif str(READ_vuotoutdr.quality) == 'ATTR_ALARM':
+                self.vuotoutdr.setStyleSheet("background-color: rgb(255, 0, 0)")
+            elif str(READ_vuotoutdr.quality) == 'ATTR_WARNING':
+                self.vuotoutdr.setStyleSheet("background-color: rgb(255, 255, 0)")
+            else:
+                self.vuotoutdr.setStyleSheet("background-color: rgb(150, 150, 150)")
+        except:
+            self.vuotoutdr.setText('Unknown')
+            self.vuotoutdr.setStyleSheet("background-color: rgb(150, 150, 150)")
+        try:
+            READ_vuotouh = sacco['vuoto2'].read_attribute('Pressure')
+            self.vuotouh.setText(str(round(READ_vuotouh.value, 1)) + ' mBar')
+            if str(READ_vuotouh.quality) == 'ATTR_VALID':
+                self.vuotouh.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif str(READ_vuotouh.quality) == 'ATTR_ALARM':
+                self.vuotouh.setStyleSheet("background-color: rgb(255, 0, 0)")
+            elif str(READ_vuotouh.quality) == 'ATTR_WARNING':
+                self.vuotouh.setStyleSheet("background-color: rgb(255, 255, 0)")
+            else:
+                self.vuotouh.setStyleSheet("background-color: rgb(150, 150, 150)")
+        except:
+            self.vuotouh.setText('Unknown')
+            self.vuotouh.setStyleSheet("background-color: rgb(150, 150, 150)")
+        try:
+            READ_vuotouhtotem = sacco['vuoto3'].read_attribute('Pressure')
+            self.vuotouhtotem.setText(str(round(READ_vuotouhtotem.value, 1)) + ' mBar')
+            if str(READ_vuotouhtotem.quality) == 'ATTR_VALID':
+                self.vuotouhtotem.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif str(READ_vuotouhtotem.quality) == 'ATTR_ALARM':
+                self.vuotouhtotem.setStyleSheet("background-color: rgb(255, 0, 0)")
+            elif str(READ_vuotouhtotem.quality) == 'ATTR_WARNING':
+                self.vuotouhtotem.setStyleSheet("background-color: rgb(255, 255, 0)")
+            else:
+                self.vuotouhtotem.setStyleSheet("background-color: rgb(150, 150, 150)")
+        except:
+            self.vuotouhtotem.setText('Unknown')
+            self.vuotouhtotem.setStyleSheet("background-color: rgb(150, 150, 150)")
+        try:
+            READ_vuotototembeamline = sacco['vuoto4'].read_attribute('Pressure')
+            self.vuotototembeamline.setText(str(round(READ_vuotototembeamline.value, 1)) + ' mBar')
+            if str(READ_vuotototembeamline.quality) == 'ATTR_VALID':
+                self.vuotototembeamline.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif str(READ_vuotototembeamline.quality) == 'ATTR_ALARM':
+                self.vuotototembeamline.setStyleSheet("background-color: rgb(255, 0, 0)")
+            elif str(READ_vuotototembeamline.quality) == 'ATTR_WARNING':
+                self.vuotototembeamline.setStyleSheet("background-color: rgb(255, 255, 0)")
+            else:
+                self.vuotototembeamline.setStyleSheet("background-color: rgb(150, 150, 150)")
+        except:
+            self.vuotouhtotem.setText('Unknown')
+            self.vuotouhtotem.setStyleSheet("background-color: rgb(150, 150, 150)")
+        #sourcefb
+        stato_globale_amplificatore = 0
+        try:
+            sourcecurrent = sacco['pump'].read_attribute('Current')
+            if str(sourcecurrent.quality) == 'ATTR_VALID':
+                stato_globale_amplificatore +=1
+        except:
+            print('Errore lettura corrente in update/#sourcefb')
+        try:
+            sourcetemperature = sacco['pumptemperature'].read_attribute(sensoretemperatura)
+            if str(sourcetemperature.quality) == 'ATTR_VALID':
+                stato_globale_amplificatore +=1
+        except:
+            print('Errore lettura temperatura in update/#sourcefb')
+        try:
+            sourcetrigger = sacco['trigger'].read_attribute(triggerdelays)
+            if str(sourcetrigger.quality) == 'ATTR_VALID':
+                stato_globale_amplificatore +=1
+        except:
+            print('Errore lettura trigger in update/#sourcefb')
+        if stato_globale_amplificatore == 3:
+            self.globale_amplificatore.setText('Elite' + str(sorgente))
+            self.globale_amplificatore.setStyleSheet("background-color: rgb(0, 255, 0)")
+        elif stato_globale_amplificatore >0 and stato_globale_amplificatore <3:
+            self.globale_amplificatore.setText('Elite' + str(sorgente))
+            self.globale_amplificatore.setStyleSheet("background-color: rgb(255, 255, 0)")
+        else:
+            self.globale_amplificatore.setText('Elite' + str(sorgente))
+            self.globale_amplificatore.setStyleSheet("background-color: rgb(255, 0, 0)")
+        try:
+            statofbin = str(sacco['slelitefbin'].State())
+            self.statoinput.setText(statofbin)
+            if statofbin == 'ON':
+                self.statoinput.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif statofbin == 'STANDBY' or statofbin == 'WARNING':
+                self.statoinput.setStyleSheet("background-color: rgb(255, 255, 0)")
+            elif statofbin == 'OFF' or statofbin == 'ALARM':
+                self.statoinput.setStyleSheet("background-color: rgb(255, 0, 0)")
+            else:
+                self.statoinput.setStyleSheet("background-color: rgb(150, 150, 150)")
+        except:
+            self.statoinput.setText('unknown')
+            self.statoinput.setStyleSheet("background-color: rgb(150, 150, 150)")
+        try:
+            statofbout = str(sacco['slelitefbout'].State())
+            self.statooutput.setText(statofbout)
+            if statofbout == 'ON':
+                self.statooutput.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif statofbout == 'STANDBY' or statofbout == 'WARNING':
+                self.statooutput.setStyleSheet("background-color: rgb(255, 255, 0)")
+            elif statofbout == 'OFF' or statofbout == 'ALARM':
+                self.statooutput.setStyleSheet("background-color: rgb(255, 0, 0)")
+            else:
+                self.statooutput.setStyleSheet("background-color: rgb(150, 150, 150)")
+        except:
+            self.statooutput.setText('unknown')
+            self.statooutput.setStyleSheet("background-color: rgb(150, 150, 150)")
+        try:
+            statofbtime = str(sacco['slelitefbtime'].State())
+            self.statotime.setText(statofbtime)
+            if statofbtime == 'ON':
+                self.statotime.setStyleSheet("background-color: rgb(0, 255, 0)")
+            elif statofbtime == 'STANDBY' or statofbtime == 'WARNING':
+                self.statotime.setStyleSheet("background-color: rgb(255, 255, 0)")
+            elif statofbtime == 'OFF' or statofbtime == 'ALARM' or statofbtime == 'MOVING':
+                self.statotime.setStyleSheet("background-color: rgb(255, 0, 0)")
+            else:
+                self.statotime.setStyleSheet("background-color: rgb(150, 150, 150)")
+        except:
+            self.statotime.setText('unknown')
+            self.statotime.setStyleSheet("background-color: rgb(150, 150, 150)")
+        #energy
+        try:
+            tmp = sacco['emslr'].Corrected_Energy
+            self.energiaslr_lettura.setText(str(round(tmp, 3)) + ' mJ')
+        except:
+            self.energiaslr_lettura.setText('Unknown')
+        #transport feedback
+        altrifeedback = []
+        if self.linea == 'TOTEM':
+            READ_statofeedback = str(sacco['totfeedback'].State())
+            altrifeedback.append(str(sacco['tmrfeedback'].State()))
+            altrifeedback.append(str(sacco['tmxfeedback'].State()))
+            altrifeedback.append(str(sacco['dpifeedback'].State()))
+            altrifeedback.append(str(sacco['ldmfeedback'].State()))
+            altrifeedback.append(str(sacco['magfeedback'].State()))
+        elif self.linea == 'TIMER':
+            READ_statofeedback = str(sacco['tmrfeedback'].State())
+#            altrifeedback.append(str(sacco['totfeedback'].State()))
+            altrifeedback.append(str(sacco['tmxfeedback'].State()))
+            altrifeedback.append(str(sacco['dpifeedback'].State()))
+            altrifeedback.append(str(sacco['ldmfeedback'].State()))
+            altrifeedback.append(str(sacco['magfeedback'].State()))
+        elif self.linea == 'TIMEX':
+            READ_statofeedback = str(sacco['tmxfeedback'].State())
+            altrifeedback.append(str(sacco['tmrfeedback'].State()))
+#            altrifeedback.append(str(sacco['totfeedback'].State()))
+            altrifeedback.append(str(sacco['dpifeedback'].State()))
+            altrifeedback.append(str(sacco['ldmfeedback'].State()))
+            altrifeedback.append(str(sacco['magfeedback'].State()))
+        elif self.linea == 'DIPROI':
+            READ_statofeedback = str(sacco['dpifeedback'].State())
+            altrifeedback.append(str(sacco['tmrfeedback'].State()))
+            altrifeedback.append(str(sacco['tmxfeedback'].State()))
+#            altrifeedback.append(str(sacco['totfeedback'].State()))
+            altrifeedback.append(str(sacco['ldmfeedback'].State()))
+            altrifeedback.append(str(sacco['magfeedback'].State()))
+        elif self.linea == 'LDM':
+            READ_statofeedback = str(sacco['ldmfeedback'].State())
+            altrifeedback.append(str(sacco['tmrfeedback'].State()))
+            altrifeedback.append(str(sacco['tmxfeedback'].State()))
+            altrifeedback.append(str(sacco['dpifeedback'].State()))
+#            altrifeedback.append(str(sacco['totfeedback'].State()))
+            altrifeedback.append(str(sacco['magfeedback'].State()))
+        elif self.linea == 'MAGNEDYN':
+            READ_statofeedback = str(sacco['magfeedback'].State())
+            altrifeedback.append(str(sacco['tmrfeedback'].State()))
+            altrifeedback.append(str(sacco['tmxfeedback'].State()))
+            altrifeedback.append(str(sacco['dpifeedback'].State()))
+            altrifeedback.append(str(sacco['ldmfeedback'].State()))
+#            altrifeedback.append(str(sacco['totfeedback'].State()))
+        self.feedbackstato.setText(READ_statofeedback)
+        if READ_statofeedback == 'ON':
+            self.feedbackstato.setStyleSheet("background-color: rgb(0, 255, 0)")
+        elif READ_statofeedback == 'STANDBY' or READ_statofeedback == 'WARNING':
+            self.feedbackstato.setStyleSheet("background-color: rgb(255, 255, 0)")
+        elif READ_statofeedback == 'OFF' or READ_statofeedback == 'ALARM':
+            self.feedbackstato.setStyleSheet("background-color: rgb(255, 0, 0)")
+        else:
+            self.feedbackstato.setStyleSheet("background-color: rgb(150, 150, 150)")
+        if 'ON' in altrifeedback:
+            self.feedbackstopothers.setDisabled(0)
+            self.feedbackstopothers.setStyleSheet("background-color: #ff0000")
+        else:
+            self.feedbackstopothers.setDisabled(1)
+            self.feedbackstopothers.setStyleSheet("background-color: lightgray")
+        # feedback device state
+        for kkkk in range(4):
+            try:
+                READ_stato_ccd = eval("str(sacco['ccd" + str(kkkk) + "'].State())")
+                ccdpausa = eval("sacco['ccd" + str(kkkk) + "'].Pause")
+            except:
+                READ_stato_ccd = '#####'
+                ccdpausa = False
+            self.convertistatoccd(kkkk, READ_stato_ccd, ccdpausa)
+        for kkkk in range(5):
+            try:
+                READ_stato_tiptilt = eval("str(sacco['piezo" + str(kkkk) + "'].State())")
+                perc_y = eval("np.abs(sacco['piezo" + str(kkkk) + "'].VoltageVer - 131000)/1310")
+                perc_x = eval("np.abs(sacco['piezo" + str(kkkk) + "'].VoltageHor - 131000)/1310")
+                eval("self.feedback" + str(kkkk) + "y.setValue(perc_y)")
+                eval("self.feedback" + str(kkkk) + "y.setTextVisible(1)")
+                eval("self.feedback" + str(kkkk) + "x.setValue(perc_x)")
+                eval("self.feedback" + str(kkkk) + "x.setTextVisible(1)")
+                if perc_y > 80:
+                    eval("self.feedback" + str(kkkk) + "y.setStyleSheet('background-color: rgb(255, 0, 0)')")
+                else:
+                    eval("self.feedback" + str(kkkk) + "y.setStyleSheet('background-color: rgb(0, 255, 0)')")
+                if perc_x > 80:
+                    eval("self.feedback" + str(kkkk) + "x.setStyleSheet('background-color: rgb(255, 0, 0)')")
+                else:
+                    eval("self.feedback" + str(kkkk) + "x.setStyleSheet('background-color: rgb(0, 255, 0)')")
+            except:
+                READ_stato_tiptilt = '#####'
+                eval("self.feedback" + str(kkkk) + "y.setValue(0)")
+                eval("self.feedback" + str(kkkk) + "y.setTextVisible(0)")
+                eval("self.feedback" + str(kkkk) + "x.setValue(0)")
+                eval("self.feedback" + str(kkkk) + "x.setTextVisible(0)")
+            self.convertistatotiptilt(kkkk, READ_stato_tiptilt)
+        tmp = sacco['costanti'].read_attribute('voltage_tiptilt_slu01_H')
+        tmpt = tmp.time.todatetime()
+        self.feedbackripristinapiezi.setText('Restore pzt ' + str(tmpt.year) + '/' + str(tmpt.month) + '/' + str(tmpt.day) + ' ' + str(tmpt.hour) + ':' + str(tmpt.minute))
+        try:
+            altreccd = []
+            if self.linea == 'TOTEM':
+                READ_stato_ccd4 = '#####'
+                ccd4pausa = '#####'
+                altreccd.append(str(sacco['tmrccd4'].State()))
+                altreccd.append(str(sacco['tmxccd4'].State()))
+                altreccd.append(str(sacco['dpiccd4'].State()))
+                altreccd.append(str(sacco['ldmccd4'].State()))
+                altreccd.append(str(sacco['magccd4'].State()))
+            elif self.linea == 'TIMER':
+                READ_stato_ccd4 = str(sacco['tmrccd4'].State())
+                ccd4pausa = sacco['tmrccd4'].Pause
+                altreccd.append(str(sacco['tmxccd4'].State()))
+                altreccd.append(str(sacco['dpiccd4'].State()))
+                altreccd.append(str(sacco['ldmccd4'].State()))
+                altreccd.append(str(sacco['magccd4'].State()))
+            elif self.linea == 'TIMEX':
+                READ_stato_ccd4 = str(sacco['tmxccd4'].State())
+                ccd4pausa = sacco['tmxccd4'].Pause
+                altreccd.append(str(sacco['tmrccd4'].State()))
+                altreccd.append(str(sacco['dpiccd4'].State()))
+                altreccd.append(str(sacco['ldmccd4'].State()))
+                altreccd.append(str(sacco['magccd4'].State()))
+            elif self.linea == 'DIPROI':
+                READ_stato_ccd4 = str(sacco['dpiccd4'].State())
+                ccd4pausa = sacco['dpiccd4'].Pause
+                altreccd.append(str(sacco['tmrccd4'].State()))
+                altreccd.append(str(sacco['tmxccd4'].State()))
+                altreccd.append(str(sacco['ldmccd4'].State()))
+                altreccd.append(str(sacco['magccd4'].State()))
+            elif self.linea == 'LDM':
+                READ_stato_ccd4 = str(sacco['ldmccd4'].State())
+                ccd4pausa = sacco['ldmccd4'].Pause
+                altreccd.append(str(sacco['tmrccd4'].State()))
+                altreccd.append(str(sacco['tmxccd4'].State()))
+                altreccd.append(str(sacco['dpiccd4'].State()))
+                altreccd.append(str(sacco['magccd4'].State()))
+            elif self.linea == 'MAGNEDYN':
+                READ_stato_ccd4 = str(sacco['magccd4'].State())
+                ccd4pausa = sacco['magccd4'].Pause
+                altreccd.append(str(sacco['tmrccd4'].State()))
+                altreccd.append(str(sacco['tmxccd4'].State()))
+                altreccd.append(str(sacco['dpiccd4'].State()))
+                altreccd.append(str(sacco['ldmccd4'].State()))
+        except:
+            READ_stato_ccd4 = '#####'
+            ccd4pausa = False
+        if READ_stato_ccd4 == 'ON' and not ccd4pausa:
+            self.feedback4monitor.setStyleSheet("background-color: #00ff00")
+        elif READ_stato_ccd4 == 'OFF':
+            self.feedback4monitor.setStyleSheet("background-color: #ffffff")
+        elif READ_stato_ccd4 == 'FAULT':
+            self.feedback4monitor.setStyleSheet("background-color: #ff0000")
+        elif READ_stato_ccd4 == 'STANDBY' or ccd4pausa:
+            self.feedback4monitor.setStyleSheet("background-color: #ffff00")
+        elif READ_stato_ccd4 == 'ALARM':
+            self.feedback4monitor.setStyleSheet("background-color: #ff9900")
+        elif READ_stato_ccd4 == 'DISABLE':
+            self.feedback4monitor.setStyleSheet("background-color: #ff00ff")
+        elif READ_stato_ccd4 == 'INIT':
+            self.feedback4monitor.setStyleSheet("background-color: #dddd88")
+        elif READ_stato_ccd4 == 'UNKNOWN':
+            self.feedback4monitor.setStyleSheet("background-color: #888888")
+        else:
+            self.feedback4monitor.setStyleSheet("background-color: #888888")
+        if 'ON' in altreccd or 'ALARM' in altreccd:
+            self.feedbackstopothersccds.setDisabled(0)
+            self.feedbackstopothersccds.setStyleSheet("background-color: #ff0000")
+        else:
+            self.feedbackstopothersccds.setDisabled(1)
+            self.feedbackstopothersccds.setStyleSheet("background-color: lightgray")
+        altrifbsequencer = []
+        if self.linea == 'TOTEM':
+            tmp = '#####'
+        elif self.linea == 'TIMER':
+            tmp = str(sacco['tmrfbsequencer'].State())
+            altrifbsequencer.append(str(sacco['tmxfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['dpifbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['ldmfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['magfbsequencer'].State()))
+        elif self.linea == 'TIMEX':
+            tmp = str(sacco['tmxfbsequencer'].State())
+            altrifbsequencer.append(str(sacco['tmrfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['dpifbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['ldmfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['magfbsequencer'].State()))
+        elif self.linea == 'DIPROI':
+            tmp = str(sacco['dpifbsequencer'].State())
+            altrifbsequencer.append(str(sacco['tmxfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['tmrfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['ldmfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['magfbsequencer'].State()))
+        elif self.linea == 'LDM':
+            tmp = str(sacco['ldmfbsequencer'].State())
+            altrifbsequencer.append(str(sacco['tmxfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['dpifbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['tmrfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['magfbsequencer'].State()))
+        elif self.linea == 'MAGNEDYN':
+            tmp = str(sacco['magfbsequencer'].State())
+            altrifbsequencer.append(str(sacco['tmxfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['dpifbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['ldmfbsequencer'].State()))
+            altrifbsequencer.append(str(sacco['tmrfbsequencer'].State()))
+        if tmp == 'RUNNING':
+            self.feedbackautoonoffreset.setText('OFF')
+            self.feedbackautoread.setStyleSheet("background-color: #00ff00")
+        elif tmp == 'OFF':
+            self.feedbackautoonoffreset.setText('ON')
+            self.feedbackautoread.setStyleSheet("background-color: #ffffff")
+        elif tmp == 'FAULT':
+            self.feedbackautoonoffreset.setText('Reset')
+            self.feedbackautoread.setStyleSheet("background-color: #ff0000")
+        else:
+            self.feedbackautoonoffreset.setText('#####')
+            self.feedbackautoread.setStyleSheet("background-color: #ff0000")
+        self.feedbackautoread.setText(tmp)
+        if 'RUNNING' in altrifbsequencer:
+            self.feedbackstopothersauto.setDisabled(0)
+            self.feedbackstopothersauto.setStyleSheet("background-color: #ff0000")
+        else:
+            self.feedbackstopothersauto.setDisabled(1)
+            self.feedbackstopothersauto.setStyleSheet("background-color: lightgray")
+        # delay
+        try:
+            delaytotemps = str(round(sacco['totem_delay'].Position, 3)) + ' ps'
+        except:
+            delaytotemps = '##### ps'
+        self.delaytotemR.setText(delaytotemps)
+
+    def convertistatoccd(self, uno, due, tre):
+        if due == 'ON' and not tre:
+            eval("self.feedback" + str(uno) + "monitor.setStyleSheet('background-color: #00ff00')")
+        elif due == 'OFF':
+            eval("self.feedback" + str(uno) + "monitor.setStyleSheet('background-color: #ffffff')")
+        elif due == 'FAULT':
+            eval("self.feedback" + str(uno) + "monitor.setStyleSheet('background-color: #ff0000')")
+        elif due == 'STANDBY' or tre:
+            eval("self.feedback" + str(uno) + "monitor.setStyleSheet('background-color: #ffff00')")
+        elif due == 'ALARM':
+            eval("self.feedback" + str(uno) + "monitor.setStyleSheet('background-color: #ff9900')")
+        elif due == 'DISABLE':
+            eval("self.feedback" + str(uno) + "monitor.setStyleSheet('background-color: #ff00ff')")
+        elif due == 'INIT':
+            eval("self.feedback" + str(uno) + "monitor.setStyleSheet('background-color: #dddd88')")
+        elif due == 'UNKNOWN':
+            eval("self.feedback" + str(uno) + "monitor.setStyleSheet('background-color: #888888')")
+        else:
+            eval("self.feedback" + str(uno) + "monitor.setStyleSheet('background-color: #888888')")
+
+    def convertistatotiptilt(self, uno, due):
+        if due == 'ON':
+            eval("self.feedback" + str(uno) + "corrector.setStyleSheet('background-color: #00ff00')")
+        elif due == 'OFF':
+            eval("self.feedback" + str(uno) + "corrector.setStyleSheet('background-color: #ffffff')")
+        elif due == 'FAULT':
+            eval("self.feedback" + str(uno) + "corrector.setStyleSheet('background-color: #ff0000')")
+        elif due == 'STANDBY':
+            eval("self.feedback" + str(uno) + "corrector.setStyleSheet('background-color: #ffff00')")
+        elif due == 'ALARM':
+            eval("self.feedback" + str(uno) + "corrector.setStyleSheet('background-color: #ff9900')")
+        elif due == 'DISABLE':
+            eval("self.feedback" + str(uno) + "corrector.setStyleSheet('background-color: #ff00ff')")
+        elif due == 'INIT':
+            eval("self.feedback" + str(uno) + "corrector.setStyleSheet('background-color: #dddd88')")
+        elif due == 'UNKNOWN':
+            eval("self.feedback" + str(uno) + "corrector.setStyleSheet('background-color: #888888')")
+        else:
+            eval("self.feedback" + str(uno) + "corrector.setStyleSheet('background-color: #888888')")
+
+    def neresterasoltantounoFB(self):
+        if self.linea == 'TOTEM':
+            try:
+                sacco['tmrfeedback'].command_inout('Off')
+            except:
+                print('error fb tmr')
+            try:
+                sacco['tmxfeedback'].command_inout('Off')
+            except:
+                print('error fb tmx')
+            try:
+                sacco['dpifeedback'].command_inout('Off')
+            except:
+                print('error fb dpi')
+            try:
+                sacco['ldmfeedback'].command_inout('Off')
+            except:
+                print('error fb ldm')
+            try:
+                sacco['magfeedback'].command_inout('Off')
+            except:
+                print('error fb mag')
+        elif self.linea == 'TIMER':
+            try:
+                sacco['tmxfeedback'].command_inout('Off')
+            except:
+                print('error fb tmx')
+            try:
+                sacco['dpifeedback'].command_inout('Off')
+            except:
+                print('error fb dpi')
+            try:
+                sacco['ldmfeedback'].command_inout('Off')
+            except:
+                print('error fb ldm')
+            try:
+                sacco['magfeedback'].command_inout('Off')
+            except:
+                print('error fb mag')
+        elif self.linea == 'TIMEX':
+            try:
+                sacco['tmrfeedback'].command_inout('Off')
+            except:
+                print('error fb tmr')
+            try:
+                sacco['dpifeedback'].command_inout('Off')
+            except:
+                print('error fb dpi')
+            try:
+                sacco['ldmfeedback'].command_inout('Off')
+            except:
+                print('error fb ldm')
+            try:
+                sacco['magfeedback'].command_inout('Off')
+            except:
+                print('error fb mag')
+        elif self.linea == 'DIPROI':
+            try:
+                sacco['tmrfeedback'].command_inout('Off')
+            except:
+                print('error fb tmr')
+            try:
+                sacco['tmxfeedback'].command_inout('Off')
+            except:
+                print('error fb tmx')
+            try:
+                sacco['ldmfeedback'].command_inout('Off')
+            except:
+                print('error fb ldm')
+            try:
+                sacco['magfeedback'].command_inout('Off')
+            except:
+                print('error fb mag')
+        elif self.linea == 'LDM':
+            try:
+                sacco['tmrfeedback'].command_inout('Off')
+            except:
+                print('error fb tmr')
+            try:
+                sacco['tmxfeedback'].command_inout('Off')
+            except:
+                print('error fb tmx')
+            try:
+                sacco['dpifeedback'].command_inout('Off')
+            except:
+                print('error fb dpi')
+            try:
+                sacco['magfeedback'].command_inout('Off')
+            except:
+                print('error fb mag')
+        elif self.linea == 'MAGNEDYN':
+            try:
+                sacco['tmrfeedback'].command_inout('Off')
+            except:
+                print('error fb tmr')
+            try:
+                sacco['tmxfeedback'].command_inout('Off')
+            except:
+                print('error fb tmx')
+            try:
+                sacco['dpifeedback'].command_inout('Off')
+            except:
+                print('error fb dpi')
+            try:
+                sacco['ldmfeedback'].command_inout('Off')
+            except:
+                print('error fb ldm')
+
+    def neresterasoltantounoSEQ(self):
+        if self.linea == 'TIMER':
+            try:
+                sacco['tmxfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq tmx')
+            try:
+                sacco['dpifbsequencer'].command_inout('Stop')
+            except:
+                print('error seq dpi')
+            try:
+                sacco['ldmfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq ldm')
+            try:
+                sacco['magfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq mag')
+        elif self.linea == 'TIMEX':
+            try:
+                sacco['tmrfeedback'].command_inout('Stop')
+            except:
+                print('error seq tmr')
+            try:
+                sacco['dpifbsequencer'].command_inout('Stop')
+            except:
+                print('error seq dpi')
+            try:
+                sacco['ldmfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq ldm')
+            try:
+                sacco['magfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq mag')
+        elif self.linea == 'DIPROI':
+            try:
+                sacco['tmrfeedback'].command_inout('Stop')
+            except:
+                print('error seq tmr')
+            try:
+                sacco['tmxfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq tmx')
+            try:
+                sacco['ldmfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq ldm')
+            try:
+                sacco['magfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq mag')
+        elif self.linea == 'LDM':
+            try:
+                sacco['tmrfeedback'].command_inout('Stop')
+            except:
+                print('error seq tmr')
+            try:
+                sacco['tmxfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq tmx')
+            try:
+                sacco['dpifbsequencer'].command_inout('Stop')
+            except:
+                print('error seq dpi')
+            try:
+                sacco['magfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq mag')
+        elif self.linea == 'MAGNEDYN':
+            try:
+                sacco['tmrfeedback'].command_inout('Stop')
+            except:
+                print('error seq tmr')
+            try:
+                sacco['tmxfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq tmx')
+            try:
+                sacco['dpifbsequencer'].command_inout('Stop')
+            except:
+                print('error seq dpi')
+            try:
+                sacco['ldmfbsequencer'].command_inout('Stop')
+            except:
+                print('error seq ldm')
+
+    def neresterasoltantounoCCD(self):
+        if self.linea == 'TIMER':
+            try:
+                sacco['tmxccd4'].command_inout('Stop')
+            except:
+                print('error ccd tmx')
+            try:
+                sacco['dpiccd4'].command_inout('Stop')
+            except:
+                print('error ccd dpi')
+            try:
+                sacco['ldmccd4'].command_inout('Stop')
+            except:
+                print('error ccd ldm')
+            try:
+                sacco['magccd4'].command_inout('Stop')
+            except:
+                print('error ccd mag')
+        elif self.linea == 'TIMEX':
+            try:
+                sacco['tmrccd4'].command_inout('Stop')
+            except:
+                print('error ccd tmr')
+            try:
+                sacco['dpiccd4'].command_inout('Stop')
+            except:
+                print('error ccd dpi')
+            try:
+                sacco['ldmccd4'].command_inout('Stop')
+            except:
+                print('error ccd ldm')
+            try:
+                sacco['magccd4'].command_inout('Stop')
+            except:
+                print('error ccd mag')
+        elif self.linea == 'DIPROI':
+            try:
+                sacco['tmrccd4'].command_inout('Stop')
+            except:
+                print('error ccd tmr')
+            try:
+                sacco['tmxccd4'].command_inout('Stop')
+            except:
+                print('error ccd tmx')
+            try:
+                sacco['ldmccd4'].command_inout('Stop')
+            except:
+                print('error ccd ldm')
+            try:
+                sacco['magccd4'].command_inout('Stop')
+            except:
+                print('error ccd mag')
+        elif self.linea == 'LDM':
+            try:
+                sacco['tmrccd4'].command_inout('Stop')
+            except:
+                print('error ccd tmr')
+            try:
+                sacco['tmxccd4'].command_inout('Stop')
+            except:
+                print('error ccd tmx')
+            try:
+                sacco['dpiccd4'].command_inout('Stop')
+            except:
+                print('error ccd dpi')
+            try:
+                sacco['magccd4'].command_inout('Stop')
+            except:
+                print('error ccd mag')
+        elif self.linea == 'MAGNEDYN':
+            try:
+                sacco['tmrccd4'].command_inout('Stop')
+            except:
+                print('error ccd tmr')
+            try:
+                sacco['tmxccd4'].command_inout('Stop')
+            except:
+                print('error ccd tmx')
+            try:
+                sacco['dpiccd4'].command_inout('Stop')
+            except:
+                print('error ccd dpi')
+            try:
+                sacco['ldmccd4'].command_inout('Stop')
+            except:
+                print('error ccd ldm')
+
+    def scrivitensioni(self):
+        tmp = sacco['piezo1'].VoltageHor
+        sacco['costanti'].write_attribute('voltage_tiptilt_slu01_H', tmp)
+        time.sleep(0.02)
+        tmp = sacco['piezo1'].VoltageVer
+        sacco['costanti'].write_attribute('voltage_tiptilt_slu01_V', tmp)
+        time.sleep(0.02)
+        tmp = sacco['piezo2'].VoltageHor
+        sacco['costanti'].write_attribute('voltage_tiptilt_slu02_H', tmp)
+        time.sleep(0.02)
+        tmp = sacco['piezo2'].VoltageVer
+        sacco['costanti'].write_attribute('voltage_tiptilt_slu02_V', tmp)
+        time.sleep(0.02)
+        tmp = sacco['piezo3'].VoltageHor
+        sacco['costanti'].write_attribute('voltage_tiptilt_slu03_H', tmp)
+        time.sleep(0.02)
+        tmp = sacco['piezo3'].VoltageVer
+        sacco['costanti'].write_attribute('voltage_tiptilt_slu03_V', tmp)
+        time.sleep(0.02)
+        tmp = sacco['piezo0'].VoltageHor
+        sacco['costanti'].write_attribute('voltage_tiptilt_slu04_H', tmp)
+        time.sleep(0.02)
+        tmp = sacco['piezo0'].VoltageVer
+        sacco['costanti'].write_attribute('voltage_tiptilt_slu04_V', tmp)
+        time.sleep(0.02)
+        tmp = sacco['piezo4'].VoltageHor
+        sacco['costanti'].write_attribute('voltage_tiptilt_slu05_H', tmp)
+        time.sleep(0.02)
+        tmp = sacco['piezo4'].VoltageVer
+        sacco['costanti'].write_attribute('voltage_tiptilt_slu05_V', tmp)
+
+    def riapplicatensioni(self):
+        tmp = sacco['costanti'].voltage_tiptilt_slu01_H
+        sacco['piezo1'].write_attribute('VoltageHor')
+        time.sleep(0.02)
+        tmp = sacco['costanti'].voltage_tiptilt_slu01_V
+        sacco['piezo1'].write_attribute('VoltageVer')
+        time.sleep(0.02)
+        tmp = sacco['costanti'].voltage_tiptilt_slu02_H
+        sacco['piezo2'].write_attribute('VoltageHor')
+        time.sleep(0.02)
+        tmp = sacco['costanti'].voltage_tiptilt_slu02_V
+        sacco['piezo2'].write_attribute('VoltageVer')
+        time.sleep(0.02)
+        tmp = sacco['costanti'].voltage_tiptilt_slu03_H
+        sacco['piezo3'].write_attribute('VoltageHor')
+        time.sleep(0.02)
+        tmp = sacco['costanti'].voltage_tiptilt_slu03_V
+        sacco['piezo3'].write_attribute('VoltageVer')
+        time.sleep(0.02)
+        tmp = sacco['costanti'].voltage_tiptilt_slu04_H
+        sacco['piezo0'].write_attribute('VoltageHor')
+        time.sleep(0.02)
+        tmp = sacco['costanti'].voltage_tiptilt_slu04_V
+        sacco['piezo0'].write_attribute('VoltageVer')
+        time.sleep(0.02)
+        tmp = sacco['costanti'].voltage_tiptilt_slu05_H
+        sacco['piezo4'].write_attribute('VoltageHor')
+        time.sleep(0.02)
+        tmp = sacco['costanti'].voltage_tiptilt_slu05_V
+        sacco['piezo4'].write_attribute('VoltageVer')
+        time.sleep(0.02)
+
+    def apriSEQpesi(self):
+        if self.linea == 'TIMER':
+            os.system('/usr/local/tango-9.3.3/bin/atkpanel ' + sacco['tmrfbsequencer'].name() + ' &')
+        elif self.linea == 'TIMEX':
+            os.system('/usr/local/tango-9.3.3/bin/atkpanel ' + sacco['tmxfbsequencer'].name() + ' &')
+        elif self.linea == 'DIPROI':
+            os.system('/usr/local/tango-9.3.3/bin/atkpanel ' + sacco['dpifbsequencer'].name() + ' &')
+        elif self.linea == 'LDM':
+            os.system('/usr/local/tango-9.3.3/bin/atkpanel ' + sacco['ldmfbsequencer'].name() + ' &')
+        elif self.linea == 'MAGNEDYN':
+            os.system('/usr/local/tango-9.3.3/bin/atkpanel ' + sacco['magfbsequencer'].name() + ' &')
+
+    def forcepanel(self):
+        nuovalinea = self.menubeamline.currentText()
+        self.linea = nuovalinea
+        self.beamlineattiva.setText('Elite' + str(self.sorgente) + ' to ' + str(self.linea))
+
+    def apripss(self):
+        os.system('/runtime/bin/laserpss -title Laser_safety_system &')
+
+    def lanciailwiki(self):
+        os.system('firefox http://acswww.elettra.trieste.it/Fermi/Procedures/Lasers/monitorpanel &')
+
+    def accendiilfeedback(self):
+        if self.linea == 'TIMER':
+            try:
+                sacco['tmrfeedback'].command_inout('On')
+            except:
+                print('error fb tmx')
+        elif self.linea == 'TIMEX':
+            try:
+                sacco['tmxfeedback'].command_inout('On')
+            except:
+                print('error fb tmr')
+        elif self.linea == 'DIPROI':
+            try:
+                sacco['dpifeedback'].command_inout('On')
+            except:
+                print('error fb tmr')
+        elif self.linea == 'LDM':
+            try:
+                sacco['ldmfeedback'].command_inout('On')
+            except:
+                print('error fb tmr')
+        elif self.linea == 'MAGNEDYN':
+            try:
+                sacco['magfeedback'].command_inout('On')
+            except:
+                print('error fb tmr')
+
+    def mettiilfeedbackinstandby(self):
+        if self.linea == 'TIMER':
+            try:
+                sacco['tmrfeedback'].command_inout('Standby')
+            except:
+                print('error fb tmx')
+        elif self.linea == 'TIMEX':
+            try:
+                sacco['tmxfeedback'].command_inout('Standby')
+            except:
+                print('error fb tmr')
+        elif self.linea == 'DIPROI':
+            try:
+                sacco['dpifeedback'].command_inout('Standby')
+            except:
+                print('error fb tmr')
+        elif self.linea == 'LDM':
+            try:
+                sacco['ldmfeedback'].command_inout('Standby')
+            except:
+                print('error fb tmr')
+        elif self.linea == 'MAGNEDYN':
+            try:
+                sacco['magfeedback'].command_inout('Standby')
+            except:
+                print('error fb tmr')
+
+    def resettaicorrettori(self):
+        try:
+            sacco['piezo0'].write_attribute('VoltageHor', 131000)
+            sacco['piezo0'].write_attribute('VoltageVer', 131000)
+            sacco['piezo1'].write_attribute('VoltageHor', 131000)
+            sacco['piezo1'].write_attribute('VoltageVer', 131000)
+            sacco['piezo2'].write_attribute('VoltageHor', 131000)
+            sacco['piezo2'].write_attribute('VoltageVer', 131000)
+            sacco['piezo3'].write_attribute('VoltageHor', 131000)
+            sacco['piezo3'].write_attribute('VoltageVer', 131000)
+            sacco['piezo4'].write_attribute('VoltageHor', 131000)
+            sacco['piezo4'].write_attribute('VoltageVer', 131000)
+        except:
+            print('error resetting feedback correctors')
+
+    def aprifeedback(self):
+        if self.linea == 'TIMER':
+            nome = sacco['tmrfeedback'].dev_name()
+        elif self.linea == 'TIMEX':
+            nome = sacco['tmxfeedback'].dev_name()
+        elif self.linea == 'DIPROI':
+            nome = sacco['dpifeedback'].dev_name()
+        elif self.linea == 'LDM':
+            nome = sacco['ldmfeedback'].dev_name()
+        elif self.linea == 'MAGNEDYN':
+            nome = sacco['magfeedback'].dev_name()
+        eval("os.system('/runtime/bin/mimo-fb-gui " + nome + " &')")
+
+    def apritiptilt0(self):
+        nome = sacco['piezo0'].dev_name()
+        eval("os.system('/runtime/bin/slutiptilt " + nome + " &')")
+
+    def apriccd0(self):
+        nome = sacco['ccd0'].dev_name()
+        eval("os.system('/runtime/bin/gigecam-gui " + nome + "  --refresh=200 &')")
+
+    def apritiptilt1(self):
+        nome = sacco['piezo1'].dev_name()
+        eval("os.system('/runtime/bin/slutiptilt " + nome + " &')")
+
+    def apriccd1(self):
+        nome = sacco['ccd1'].dev_name()
+        eval("os.system('/runtime/bin/gigecam-gui " + nome + "  --refresh=200 &')")
+
+    def apritiptilt2(self):
+        nome = sacco['piezo2'].dev_name()
+        eval("os.system('/runtime/bin/slutiptilt " + nome + " &')")
+
+    def apriccd2(self):
+        nome = sacco['ccd2'].dev_name()
+        eval("os.system('/runtime/bin/gigecam-gui " + nome + "  --refresh=200 &')")
+
+    def apritiptilt3(self):
+        nome = sacco['piezo3'].dev_name()
+        eval("os.system('/runtime/bin/slutiptilt " + nome + " &')")
+
+    def apriccd3(self):
+        nome = sacco['ccd3'].dev_name()
+        eval("os.system('/runtime/bin/gigecam-gui " + nome + "  --refresh=200 &')")
+
+    def apritiptilt4(self):
+        nome = sacco['piezo4'].dev_name()
+        eval("os.system('/runtime/bin/slutiptilt " + nome + " &')")
+
+    def apriccd4(self):
+        if self.linea == 'TIMER':
+            nome = sacco['tmrccd4'].dev_name()
+        elif self.linea == 'TIMEX':
+            nome = sacco['tmxccd4'].dev_name()
+        elif self.linea == 'DIPROI':
+            nome = sacco['dpiccd4'].dev_name()
+        elif self.linea == 'LDM':
+            nome = sacco['ldmccd4'].dev_name()
+        elif self.linea == 'MAGNEDYN':
+            nome = sacco['magccd4'].dev_name()
+        eval("os.system('/runtime/bin/gigecam-gui " + nome + "  --refresh=200 &')")
+
+    def apridalaytotem(self):
+        os.system('/runtime/bin/motion_controller slu/motor/trls_slu.05 -title SLU_TOTEM_DELAY_LINE &')
+
+    def apricalendario(self):
+        os.system("python /home/lfo/runtime/panels/bin/slucalendarpanel.py &")
+
+    def aprifeedbackconf(self):
+        if self.linea == 'TIMER':
+            nome = sacco['tmrfeedback'].dev_name()
+        elif self.linea == 'TIMEX':
+            nome = sacco['tmxfeedback'].dev_name()
+        elif self.linea == 'DIPROI':
+            nome = sacco['dpifeedback'].dev_name()
+        elif self.linea == 'LDM':
+            nome = sacco['ldmfeedback'].dev_name()
+        elif self.linea == 'MAGNEDYN':
+            nome = sacco['magfeedback'].dev_name()
+        eval("os.system('/runtime/bin/mimoconfig-gui " + nome + " --laser &')")
+
+    def comandipersequencer(self):
+        if self.linea == 'TIMER':
+            dasitemare2 = sacco['tmrfbsequencer']
+        elif self.linea == 'TIMEX':
+            dasitemare2 = sacco['tmxfbsequencer']
+        elif self.linea == 'DIPROI':
+            dasitemare2 = sacco['dpifbsequencer']
+        elif self.linea == 'LDM':
+            dasitemare2 = sacco['ldmfbsequencer']
+        elif self.linea == 'MAGNEDYN':
+            dasitemare2 = sacco['magfbsequencer']
+        if str(self.feedbackautoonoffreset.text()) == 'OFF':
+            dasitemare2.command_inout('Stop')
+        elif str(self.feedbackautoonoffreset.text()) == 'ON':
+            dasitemare2.command_inout('Start')
+        elif str(self.feedbackautoonoffreset.text()) == 'Reset':
+            dasitemare2.command_inout('Acknowledge')
+        elif str(self.feedbackautoonoffreset.text()) == '#####':
+            print('popup resetta server')
+
+    def delaytotemgoto(self):
+        gol = float(self.delaytotemW.text())
+        sacco['totem_delay'].write_attribute('Position', gol)
+
+    def delaytotemmeno(self):
+        tmp = float(self.delaytotemRELstep.text())
+        gol = sacco['totem_delay'].position - tmp
+        sacco['totem_delay'].write_attribute('Position', gol)
+
+    def delaytotempiu(self):
+        tmp = float(self.delaytotemRELstep.text())
+        gol = sacco['totem_delay'].position + tmp
+        sacco['totem_delay'].write_attribute('Position', gol)
+
+    def apridecimatori(self):
+        os.system("/runtime/bin/sl-decimators-gui &")
+
+    def apridelaycalc(self):
+        os.system("/runtime/bin/slu-delay-calculator-gui &")
+
+    def FUNZIONEVUOTA(self):
+        print('FUNZIONEVUOTA')
+
+    def smart_feedback_on(self):
+        if self.linea == 'TIMER':
+            dasitemare1 = sacco['tmrfeedback']
+            dasitemare2 = sacco['tmrfbsequencer']
+        elif self.linea == 'TIMEX':
+            dasitemare1 = sacco['tmxfeedback']
+            dasitemare2 = sacco['tmxfbsequencer']
+        elif self.linea == 'DIPROI':
+            dasitemare1 = sacco['dpifeedback']
+            dasitemare2 = sacco['dpifbsequencer']
+        elif self.linea == 'LDM':
+            dasitemare1 = sacco['ldmfeedback']
+            dasitemare2 = sacco['ldmfbsequencer']
+        elif self.linea == 'MAGNEDYN':
+            dasitemare1 = sacco['magfeedback']
+            dasitemare2 = sacco['magfbsequencer']
+        if str(dasitemare2.State()) != 'OFF':
+            dasitemare2.command_inout('Stop')
+            print('sequencer off')
+        dasitemare1.command_inout("Off")
+        print('feeback off')
+        sacco['piezo0'].write_attribute('VoltageHor', 131000)
+        sacco['piezo0'].write_attribute('VoltageVer', 131000)
+        print('reset piezo0')
+        time.sleep(2)
+        dasitemare1.write_attribute('SensorWeights', [1,1,0,0,0,0,0,0,0,0])
+        dasitemare1.write_attribute('ActuatorWeights', [1,1,0,0,0,0,0,0,0,0])
+        dasitemare1.command_inout("On")
+        print('feedback on 1')
+        sacco['piezo1'].write_attribute('VoltageHor', 131000)
+        sacco['piezo1'].write_attribute('VoltageVer', 131000)
+        print('reset piezo1')
+        time.sleep(6)
+        dasitemare1.write_attribute('SensorWeights', [1,1,1,1,0,0,0,0,0,0])
+        dasitemare1.write_attribute('ActuatorWeights', [1,1,1,1,0,0,0,0,0,0])
+        print('feedback on 2')
+        sacco['piezo2'].write_attribute('VoltageHor', 131000)
+        sacco['piezo2'].write_attribute('VoltageVer', 131000)
+        print('reset piezo2')
+        time.sleep(6)
+        dasitemare1.write_attribute('SensorWeights', [1,1,1,1,1,1,0,0,0,0])
+        dasitemare1.write_attribute('ActuatorWeights', [1,1,1,1,1,1,0,0,0,0])
+        print('feedback on 3')
+        sacco['piezo3'].write_attribute('VoltageHor', 131000)
+        sacco['piezo3'].write_attribute('VoltageVer', 131000)
+        print('reset piezo3')
+        time.sleep(5)
+        dasitemare1.write_attribute('SensorWeights', [1,1,1,1,1,1,1,1,0,0])
+        dasitemare1.write_attribute('ActuatorWeights', [1,1,1,1,1,1,1,1,0,0])
+        print('feedback on 4')
+        sacco['piezo4'].write_attribute('VoltageHor', 131000)
+        sacco['piezo4'].write_attribute('VoltageVer', 131000)
+        print('reset piezo4')
+        time.sleep(5)
+        dasitemare1.write_attribute('SensorWeights', [1,1,1,1,1,1,1,1,1,1])
+        dasitemare1.write_attribute('ActuatorWeights', [1,1,1,1,1,1,1,1,1,1])
+        print('feedback on 5')
+        time.sleep(3)
+        if str(dasitemare2.State()) == 'OFF':
+            dasitemare2.command_inout('Start')
+            print('sequencer on')
+        print('fine')
+
+
+app = QApplication([])
+try:
+    tmpdim = sys.argv[1]
+    tmpdim = tmpdim.split('x')
+    larghezzaaltezza = [float(tmpdim[0]), float(tmpdim[1])]
+    dimensione = max(larghezzaaltezza)
+except:
+    screen = QDesktopWidget().screenGeometry()
+    larghezzaaltezza = [screen.width(), screen.height()]
+    if max(larghezzaaltezza) > 3000:
+        dimensione = max(larghezzaaltezza)*0.38
+    elif max(larghezzaaltezza) > 2000:
+        dimensione = max(larghezzaaltezza)*0.6
+    elif max(larghezzaaltezza) > 1000:
+        dimensione = max(larghezzaaltezza)*0.7
+    else:
+        dimensione = max(larghezzaaltezza)*2
+print(larghezzaaltezza)
+font_pannello = QFont("Arial", round(dimensione/160.0), -1, False)
+app.setFont(font_pannello)
+main = MainWindow()
+main.resize(larghezzaaltezza[0]/10, larghezzaaltezza[1]/10)
+main.show()
+app.exec_()
-- 
GitLab