sendelogsf.py corrected

This commit is contained in:
2023-08-21 15:45:36 +02:00
parent 7fe986ae4e
commit d3ee217bc5

View File

@@ -40,7 +40,7 @@ class QSendToELOG(QSendToELOGFrame):
self.settings = self.parent.settings
#print ("ELOG SEND", flush=True)
#First check what is the logbook being requested?
#find layout items
self.layout_items = self.get_logbook_specific_items(self.logbook)
@@ -75,6 +75,7 @@ class QSendToELOG(QSendToELOGFrame):
self.sim_list = ["Sand", "test"]
self.initialize_layout(self.logbook)
self.exec()
def reset_layout(self):
@@ -91,6 +92,7 @@ class QSendToELOG(QSendToELOGFrame):
def create_layout_widgets(self):
if not self.eintrag:
self.eintrag = QHBoxLayout()
self.eintrag.addWidget(QLabel('Eintrag: '))
@@ -152,12 +154,17 @@ class QSendToELOG(QSendToELOGFrame):
self.estatus_items.setObjectName("Elog")
self.estatus.addWidget(self.estatus_items)
self.layout_to_widget_dict['Status'] = self.estatus
def initialize_layout(self, logbook):
#Decide on layout
self.create_layout_widgets()
item_no = 2
if 'Eintrag' in self.layout_items:
@@ -170,7 +177,7 @@ class QSendToELOG(QSendToELOGFrame):
self.eintrag_items.setCurrentIndex(self.eintrag_idx)
self.layout.insertLayout(item_no, self.eintrag)
if 'Category' in self.layout_items:
try:
self.category_idx = self.settings.data['ElogInit'][logbook][
@@ -198,7 +205,7 @@ class QSendToELOG(QSendToELOGFrame):
'ElogBooks'][logbook]['Optional']['Domain']))
self.domain_items.setCurrentIndex(self.domain_idx)
self.layout.insertLayout(item_no, self.domain)
if 'Section' in self.layout_items:
item_no += 1
@@ -226,9 +233,11 @@ class QSendToELOG(QSendToELOGFrame):
self.estatus_items.setCurrentIndex(self.status_idx)
self.layout.insertLayout(item_no, self.estatus)
#IS this required --attached files should be passed on
self.attachFile = self.parent.attach_files
self.filesE.clear()
self.files_text = ''
if self.attachFile is not None:
_attachFile = []
@@ -243,7 +252,7 @@ class QSendToELOG(QSendToELOGFrame):
self.files_text += str(_attach_base)
self.filesE.setText(self.files_text)
self.fflag = True
if any(substring.upper() in logbook.upper() \
for substring in self.sim_list):
_bgcolor = "QComboBox {background: plum; color : black;}"
@@ -251,6 +260,8 @@ class QSendToELOG(QSendToELOGFrame):
_bgcolor = "QComboBox {background: lightblue; color : black;}"
self.elog_items.setStyleSheet(_bgcolor)
#have to remove widgets within layout too!
#https://riverbankcomputing.com/pipermail/pyqt/2009-November/025214.html
def on_elog_change(self, idx):