Skip to content
Snippets Groups Projects
Commit 2ad651f6 authored by Claudio Scafuri's avatar Claudio Scafuri :speech_balloon:
Browse files

#19754 nuovo controllo shutter e stopper bl014

parent 8d5f3712
No related branches found
No related tags found
1 merge request!6New nanoesca control
......@@ -20,7 +20,6 @@ from ui_frntd_e import *
import Blfe
import tango
class Worker(QtCore.QThread):
def __init__(self, parent=None):
QtCore.QThread.__init__(self, parent)
......@@ -31,22 +30,36 @@ class Worker(QtCore.QThread):
self.syrmepstopper = 0
self.syrmepstopperindex = 0
self.syrmep_stopper_value = -1 # 0: closed , 1:open, -1 : unknown
self.nanoescastopper = 0
self.nanoescashutterindex = 0
self.nanoesca_stopper_value = -1 # 0: closed , 1:open, -1 : unknown
self.nanoescashutter = 0
self.nanoescashutterindex = 0
self.nanoesca_stopper_value = -1 # 0: closed , 1:open, -1 : unknown
try:
self.syrmepstopper = tango.DeviceProxy(
"syrmep-control-01.blcs.elettra.trieste.it:20000/syrmep/beamline/geco"
)
except tango.DevFailed as e:
self.nanoescastopper = 0
# tango device for syrmep - geco device
self.nanoescastopper = 0
self.nanoescastopperindex = 0
self.nanoesca_stopper_value = -1 # 0: closed , 1:open, -1 : unknown
try:
self.nanoescastopper = tango.DeviceProxy(
# tango device for nanoesca - geco device
self.nanoescastopper = 0
self.nanoescastopperindex = 0
self.nanoesca_stopper_value = -1 # 0: closed , 1:open, -1 : unknown
try:
self.nanoescastopper = tango.DeviceProxy(
"bl014-control-01.blcs.elettra.trieste.it:20000/bl014/beamline/geco"
)
except tango.DevFailed as e:
self.nanoescastopper = 0
except tango.DevFailed as e:
self.nanoescastopper = 0
self.nanoescashutter = 0
self.nanoescashutterindex = 0
self.nanoesca_shutter_value = -1 # 0: closed , 1:open, -1 : unknown
self.nanoescashutter=self.nanoescastopper # the tango device is the same of the stopper
def run(self):
if self.mode == "update":
......@@ -62,6 +75,12 @@ class Worker(QtCore.QThread):
self.syrmep_stopper_value = self.syrmepstopper.r_bs4_v
except tango.DevFailed as e:
self.syrmep_stopper_value = -1
try:
self.nanoesca_stopper_value = self.nanoescastopper.read_attribute("STFE_S01-04.01").value
self.nanoesca_shutter_value = self.nanoescashutter.read_attribute("SHFE_S01-04.01").value
except tango.DevFailed as e:
self.nanoesca_stopper_value = -1
self.nanoesca_shutter_value = -1
def execute(self):
errtable = self.BL.closeall()
......@@ -83,6 +102,42 @@ class Worker(QtCore.QThread):
self.BL,
errtable,
)
#close esca/superesca stopper
try:
self.nanoescastopper.write_attribute("STFE_S01-04.01",0)
except tango.DevFailed as e:
self.emit(
QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"),
self.BL,
"geco/STFE_S01-04.01",
)
if errtable is None:
self.emit(QtCore.SIGNAL("ExecuteThread(PyQt_PyObject)"), self.BL)
else:
self.emit(
QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"),
self.BL,
errtable,
)
#close esca/superesca stopper
try:
self.nanoescashutter.write_attribute("SHFE_S01-04.01",0)
except tango.DevFailed as e:
self.emit(
QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"),
self.BL,
"geco/SHFE_S01-04.01",
)
if errtable is None:
self.emit(QtCore.SIGNAL("ExecuteThread(PyQt_PyObject)"), self.BL)
else:
self.emit(
QtCore.SIGNAL("ExecuteError(PyQt_PyObject,PyQt_PyObject)"),
self.BL,
errtable,
)
class active_frntd_e(Ui_frntd_e, QtCore.QObject):
......@@ -132,7 +187,7 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject):
self.redbrush = QtGui.QBrush(QtGui.QColor("red"))
self.graybrush = QtGui.QBrush(QtGui.QColor("gray"))
n = self.BL.nentries
self.tableWidget.setRowCount(n + 1)
self.tableWidget.setRowCount(n + 3)
row = 0
for entry in self.BL.bltable:
bname = entry[2]
......@@ -162,6 +217,48 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject):
self.thread.syrmepstopperindex = row
self.syrmepstopperindex = row
row = row + 1
#palette = self.label.palette()
#palette.setBrush(QtGui.QPalette.Window, self.graybrush)
#self.label.setPalette(palette)
#self.label.setAutoFillBackground(1)
#self.label.setText("UNKNOWN")
# ----
bname = "NanoEsca/Nanospectr."
objname = "geco/STFE_S01-04.01"
stname = "UNKNOWN"
col0 = QtGui.QTableWidgetItem(bname, 0)
col1 = QtGui.QTableWidgetItem(objname, 1)
col2 = QtGui.QTableWidgetItem(stname, 2)
col2.setBackground(self.graybrush)
self.tableWidget.setItem(row, 0, col0)
self.tableWidget.setItem(row, 1, col1)
self.tableWidget.setItem(row, 2, col2)
self.tableWidget.setRowHeight(row, 22)
self.thread.nanoescastopperindex = row
self.nanoescastopperindex = row
row = row + 1
bname = "NanoEsca/Nanospectr."
objname = "geco/SHFE_S01-04.01"
stname = "UNKNOWN"
col0 = QtGui.QTableWidgetItem(bname, 0)
col1 = QtGui.QTableWidgetItem(objname, 1)
col2 = QtGui.QTableWidgetItem(stname, 2)
col2.setBackground(self.graybrush)
self.tableWidget.setItem(row, 0, col0)
self.tableWidget.setItem(row, 1, col1)
self.tableWidget.setItem(row, 2, col2)
self.tableWidget.setRowHeight(row, 22)
self.thread.nanoescashutterindex = row
self.nanoescashutterindex = row
row = row + 1
#----------------------------------------------------------
palette = self.label.palette()
palette.setBrush(QtGui.QPalette.Window, self.graybrush)
self.label.setPalette(palette)
......@@ -215,8 +312,43 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject):
if self.thread.syrmep_stopper_value == -1:
item.setBackground(self.graybrush)
item.setText("UNKNOWN")
#---------------------------------------------
# check nanoesca stopper tango reading
idx = self.thread.nanoescastopperindex
item = self.tableWidget.item(idx, 2)
if self.thread.nanoesca_stopper_value == 1:
item.setBackground(self.redbrush)
item.setText("OPEN")
if self.thread.nanoesca_stopper_value == 0:
item.setBackground(self.greenbrush)
item.setText("CLOSED")
if self.thread.nanoesca_stopper_value == -1:
item.setBackground(self.graybrush)
item.setText("UNKNOWN")
#---------------------------------------------
#---------------------------------------------
# check nanoesca shutter tango reading
idx = self.thread.nanoescashutterindex
item = self.tableWidget.item(idx, 2)
if self.thread.nanoesca_shutter_value == 1:
item.setBackground(self.redbrush)
item.setText("OPEN")
if self.thread.nanoesca_shutter_value == 0:
item.setBackground(self.greenbrush)
item.setText("CLOSED")
if self.thread.nanoesca_shutter_value == -1:
item.setBackground(self.graybrush)
item.setText("UNKNOWN")
#-------------------------------------------------------------------
all_tango_closed = self.thread.syrmep_stopper_value == 0 and self.thread.nanoesca_stopper_value == 0 and self.thread.nanoesca_shutter_value == 0
palette = self.label.palette()
if mybl.allclosed() == 1 and self.thread.syrmep_stopper_value == 0:
if mybl.allclosed() == 1 and all_tango_closed :
palette.setBrush(QtGui.QPalette.Window, self.greenbrush)
self.label.setText("ALL CLOSED")
else:
......@@ -224,6 +356,7 @@ class active_frntd_e(Ui_frntd_e, QtCore.QObject):
self.label.setText("OPEN/CLOSED")
self.label.setPalette(palette)
self.label.setAutoFillBackground(1)
#---------------------------------------------
def slot_do_close(self):
# first stop aqcusition thread
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment