Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 97cdd17881 | |||
| 967f23d443 |
15
guiheader.py
15
guiheader.py
@@ -3,7 +3,8 @@
|
|||||||
from qtpy.QtCore import Qt
|
from qtpy.QtCore import Qt
|
||||||
from qtpy.QtGui import QFont
|
from qtpy.QtGui import QFont
|
||||||
from qtpy.QtWidgets import (
|
from qtpy.QtWidgets import (
|
||||||
QGridLayout, QGroupBox, QHBoxLayout, QLabel, QProxyStyle, QVBoxLayout, QWidget)
|
QGridLayout, QGroupBox, QHBoxLayout, QLabel, QProxyStyle, QVBoxLayout,
|
||||||
|
QWidget)
|
||||||
|
|
||||||
from caqtwidgets.pvwidgets import CAQLabel
|
from caqtwidgets.pvwidgets import CAQLabel
|
||||||
from pyqtacc.bdbase.enumkind import UserMode
|
from pyqtacc.bdbase.enumkind import UserMode
|
||||||
@@ -107,7 +108,7 @@ class GUIHeader(QWidget):
|
|||||||
"""
|
"""
|
||||||
station = QGroupBox()
|
station = QGroupBox()
|
||||||
station.setObjectName(color_obj.upper())
|
station.setObjectName(color_obj.upper())
|
||||||
station.setAlignment(Qt.AlignHCenter | Qt.AlignTop)
|
station.setAlignment(Qt.AlignmentFlag(Qt.AlignHCenter|Qt.AlignTop))
|
||||||
station.setFlat(False)
|
station.setFlat(False)
|
||||||
station.setTitle(header)
|
station.setTitle(header)
|
||||||
beam_current = CAQLabel(self, pv_name=pv, show_units=True)
|
beam_current = CAQLabel(self, pv_name=pv, show_units=True)
|
||||||
@@ -120,6 +121,16 @@ class GUIHeader(QWidget):
|
|||||||
grid_layout.setHorizontalSpacing(0)
|
grid_layout.setHorizontalSpacing(0)
|
||||||
grid_layout.setContentsMargins(2, 9, 2, 0)
|
grid_layout.setContentsMargins(2, 9, 2, 0)
|
||||||
|
|
||||||
|
|
||||||
|
if header == "UCN":
|
||||||
|
beam_req_status = CAQLabel(
|
||||||
|
self, pv_name="UCNQ:BEAMREQ:STATUS", prefix="BEAMREQ: ")
|
||||||
|
beam_req_status.setFixedHeight(self.widget_height)
|
||||||
|
beam_req_status.setFixedWidth(146)
|
||||||
|
grid_layout.addWidget(beam_req_status, 1, 0, 1, 1, Qt.AlignCenter)
|
||||||
|
self.extra_height += 25
|
||||||
|
self.beam_current_wgt_dict["UCNQ"] = beam_req_status
|
||||||
|
|
||||||
station.setLayout(grid_layout)
|
station.setLayout(grid_layout)
|
||||||
station.setFixedHeight(beam_current.height() + self.extra_height)
|
station.setFixedHeight(beam_current.height() + self.extra_height)
|
||||||
station.setFixedWidth(beam_current.width() + 15)
|
station.setFixedWidth(beam_current.width() + 15)
|
||||||
|
|||||||
@@ -9,25 +9,16 @@ from qtpy.QtWidgets import (QComboBox, QDialog, QFileDialog, QHBoxLayout,
|
|||||||
QVBoxLayout)
|
QVBoxLayout)
|
||||||
|
|
||||||
import elog # https://github.com/paulscherrerinstitute/py_elog
|
import elog # https://github.com/paulscherrerinstitute/py_elog
|
||||||
from pyqtacc.bdbase.enumkind import MsgSeverity
|
from apps4ops.bdbase.enumkind import MsgSeverity
|
||||||
|
from apps4ops.bdbase.sendelogframe import QSendToELOGFrame
|
||||||
|
from apps4ops.bdbase.utils import _line
|
||||||
|
|
||||||
from pyqtacc.bdbase.sendelogframe import QSendToELOGFrame
|
|
||||||
|
|
||||||
_version = "1.0.0"
|
_version = "1.0.0"
|
||||||
_pymodule = os.path.basename(__file__)
|
_pymodule = os.path.basename(__file__)
|
||||||
_appname, _appext = _pymodule.split(".")
|
_appname, _appext = _pymodule.split(".")
|
||||||
_hostname = socket.gethostname().split(".")[0]
|
_hostname = socket.gethostname().split(".")[0]
|
||||||
|
|
||||||
def _line():
|
|
||||||
"""Macro to return the current line number.
|
|
||||||
|
|
||||||
The current line number within the file is used when
|
|
||||||
reporting messages to the message logging window.
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
int: Current line number.
|
|
||||||
"""
|
|
||||||
return inspect.currentframe().f_back.f_lineno
|
|
||||||
|
|
||||||
class QSendToELOG(QSendToELOGFrame):
|
class QSendToELOG(QSendToELOGFrame):
|
||||||
""" Graphical interface to elog
|
""" Graphical interface to elog
|
||||||
@@ -50,7 +41,7 @@ class QSendToELOG(QSendToELOGFrame):
|
|||||||
self.ort_idx = ortIdx
|
self.ort_idx = ortIdx
|
||||||
self.effekt_idx = effektIdx
|
self.effekt_idx = effektIdx
|
||||||
|
|
||||||
#print("indices", self.projekt_idx, self.eintrag_idx, self.system_idx, self.ort_idx, flush=True)
|
|
||||||
self.projekt = None
|
self.projekt = None
|
||||||
self.eintrag = None
|
self.eintrag = None
|
||||||
self.system = None
|
self.system = None
|
||||||
@@ -59,8 +50,6 @@ class QSendToELOG(QSendToELOGFrame):
|
|||||||
self.ort = None
|
self.ort = None
|
||||||
self.konsole = None
|
self.konsole = None
|
||||||
|
|
||||||
#print("LAYOUT ITEMS: ", self.layout_items)
|
|
||||||
|
|
||||||
self.sim_list = ["Sand", "test"]
|
self.sim_list = ["Sand", "test"]
|
||||||
|
|
||||||
self.initialize_layout(self.logbook)
|
self.initialize_layout(self.logbook)
|
||||||
@@ -151,8 +140,6 @@ class QSendToELOG(QSendToELOGFrame):
|
|||||||
|
|
||||||
def initialize_layout(self, logbook):
|
def initialize_layout(self, logbook):
|
||||||
|
|
||||||
print("initialize_layout", self.layout_items, flush=True)
|
|
||||||
|
|
||||||
#Decide on layout
|
#Decide on layout
|
||||||
self.create_layout_widgets()
|
self.create_layout_widgets()
|
||||||
|
|
||||||
@@ -254,10 +241,6 @@ class QSendToELOG(QSendToELOGFrame):
|
|||||||
#https://riverbankcomputing.com/pipermail/pyqt/2009-November/025214.html
|
#https://riverbankcomputing.com/pipermail/pyqt/2009-November/025214.html
|
||||||
def on_elog_change(self, idx):
|
def on_elog_change(self, idx):
|
||||||
|
|
||||||
#print(self.elog_items.currentText(), "new=", idx)
|
|
||||||
#print(self.elog_items.itemText(idx))
|
|
||||||
#print(self.logbook)
|
|
||||||
|
|
||||||
new_logbook = self.elog_items.itemText(idx)
|
new_logbook = self.elog_items.itemText(idx)
|
||||||
|
|
||||||
#Meet the new logbook. Same as the old logbook
|
#Meet the new logbook. Same as the old logbook
|
||||||
@@ -267,25 +250,6 @@ class QSendToELOG(QSendToELOGFrame):
|
|||||||
self.layout_items = self.get_logbook_specific_items(new_logbook)
|
self.layout_items = self.get_logbook_specific_items(new_logbook)
|
||||||
print("self.layout_items", self.layout_items)
|
print("self.layout_items", self.layout_items)
|
||||||
|
|
||||||
'''
|
|
||||||
#Acquire New Layout List
|
|
||||||
new_items = self.get_logbook_specific_items(new_logbook)
|
|
||||||
#Acquire Current Layout List
|
|
||||||
old_items = self.get_logbook_specific_items(self.logbook)
|
|
||||||
#Compare lists and remove Layouts that do not belong
|
|
||||||
common_items = list(set(new_items) & set(old_items))
|
|
||||||
print("common items", common_items)
|
|
||||||
#remove common_items from old_items
|
|
||||||
|
|
||||||
#unwanted_items = [ele for ele in old_items if ele not in common_items]
|
|
||||||
#print("unwamted items", unwanted_items)
|
|
||||||
unwanted_items = [ele for ele in old_items if ele not in new_items]
|
|
||||||
print("unwamted items", unwanted_items)
|
|
||||||
|
|
||||||
#Add Layouts that are new
|
|
||||||
wanted_items = [ele for ele in new_items if ele not in old_items]
|
|
||||||
print("wanted items", wanted_items)
|
|
||||||
'''
|
|
||||||
|
|
||||||
if any(substring.upper() in new_logbook.upper() \
|
if any(substring.upper() in new_logbook.upper() \
|
||||||
for substring in self.sim_list):
|
for substring in self.sim_list):
|
||||||
|
|||||||
Reference in New Issue
Block a user