|
|
|
|
@@ -38,7 +38,9 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
|
|
|
|
|
super().__init__(parent, logbook=logbook, title=title, message=message)
|
|
|
|
|
|
|
|
|
|
#print ("ELOG SEND", flush=True)
|
|
|
|
|
self.settings = self.parent.settings
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#First check what is the logbook being requested?
|
|
|
|
|
#find layout items
|
|
|
|
|
self.layout_items = self.get_logbook_specific_items(self.logbook)
|
|
|
|
|
@@ -73,6 +75,7 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
self.sim_list = ["Sand", "test"]
|
|
|
|
|
|
|
|
|
|
self.initialize_layout(self.logbook)
|
|
|
|
|
|
|
|
|
|
self.exec()
|
|
|
|
|
|
|
|
|
|
def reset_layout(self):
|
|
|
|
|
@@ -83,22 +86,14 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
widget = item.widget()
|
|
|
|
|
widget.deleteLater()
|
|
|
|
|
|
|
|
|
|
print("old logbook==>", self.logbook)
|
|
|
|
|
print("remove==>", self.get_logbook_specific_items(self.logbook),
|
|
|
|
|
flush=True)
|
|
|
|
|
|
|
|
|
|
for layout in self.get_logbook_specific_items(self.logbook):
|
|
|
|
|
print(layout, "layout", flush=True)
|
|
|
|
|
remove_wgt(self.layout_to_widget_dict[layout])
|
|
|
|
|
print(layout, "layout-removed", flush=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def create_layout_widgets(self):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not self.eintrag:
|
|
|
|
|
print("EINTRAG", flush=True)
|
|
|
|
|
self.eintrag = QHBoxLayout()
|
|
|
|
|
self.eintrag.addWidget(QLabel('Eintrag: '))
|
|
|
|
|
self.eintrag_items = QComboBox()
|
|
|
|
|
@@ -107,7 +102,6 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
self.layout_to_widget_dict['Eintrag'] = self.eintrag
|
|
|
|
|
|
|
|
|
|
if not self.category:
|
|
|
|
|
print("CATEGORY", flush=True)
|
|
|
|
|
self.category = QHBoxLayout()
|
|
|
|
|
self.category.addWidget(QLabel('Category: '))
|
|
|
|
|
self.category_items = QComboBox()
|
|
|
|
|
@@ -116,7 +110,6 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
self.layout_to_widget_dict['Category'] = self.category
|
|
|
|
|
|
|
|
|
|
if not self.domain:
|
|
|
|
|
print("DOMAIN", flush=True)
|
|
|
|
|
self.domain = QHBoxLayout()
|
|
|
|
|
self.domain.addWidget(QLabel('Domain: '))
|
|
|
|
|
self.domain_items = QComboBox()
|
|
|
|
|
@@ -126,7 +119,6 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
self.layout_to_widget_dict['Domain'] = self.domain
|
|
|
|
|
|
|
|
|
|
if not self.system:
|
|
|
|
|
print("SYSTEM", flush=True)
|
|
|
|
|
self.system = QHBoxLayout()
|
|
|
|
|
self.system.addWidget(QLabel('System: '))
|
|
|
|
|
self.system_items = QComboBox()
|
|
|
|
|
@@ -136,7 +128,6 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not self.section:
|
|
|
|
|
print("SECTION", flush=True)
|
|
|
|
|
self.section = QHBoxLayout()
|
|
|
|
|
self.section.addWidget(QLabel('Section: '))
|
|
|
|
|
self.section_items = QComboBox()
|
|
|
|
|
@@ -146,7 +137,6 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not self.effekt:
|
|
|
|
|
print("EFFEKT", flush=True)
|
|
|
|
|
self.effekt = QHBoxLayout()
|
|
|
|
|
self.effekt.addWidget(QLabel('Effect: '))
|
|
|
|
|
self.effekt_le = QLineEdit()
|
|
|
|
|
@@ -158,7 +148,6 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
self.layout_to_widget_dict['Effect'] = self.effekt
|
|
|
|
|
|
|
|
|
|
if not self.estatus:
|
|
|
|
|
print("STATUS", flush=True)
|
|
|
|
|
self.estatus = QHBoxLayout()
|
|
|
|
|
self.estatus.addWidget(QLabel('Status: '))
|
|
|
|
|
self.estatus_items = QComboBox()
|
|
|
|
|
@@ -166,18 +155,22 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
self.estatus.addWidget(self.estatus_items)
|
|
|
|
|
self.layout_to_widget_dict['Status'] = self.estatus
|
|
|
|
|
|
|
|
|
|
print("END", flush=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def initialize_layout(self, logbook):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Decide on layout
|
|
|
|
|
self.create_layout_widgets()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
item_no = 2
|
|
|
|
|
|
|
|
|
|
print("HERE===========00>", logbook, flush=True)
|
|
|
|
|
|
|
|
|
|
if 'Eintrag' in self.layout_items:
|
|
|
|
|
print("EINTRAG", item_no, flush=True)
|
|
|
|
|
self.eintrag_idx = self.settings.data['ElogInit'][logbook][
|
|
|
|
|
'Eintrag']
|
|
|
|
|
|
|
|
|
|
self.eintrag_items.clear()
|
|
|
|
|
self.eintrag_items.addItems(list(self.parent.settings.data[
|
|
|
|
|
'ElogBooks'][logbook]['Required']['Eintrag']))
|
|
|
|
|
@@ -185,9 +178,13 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
self.layout.insertLayout(item_no, self.eintrag)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if 'Category' in self.layout_items:
|
|
|
|
|
print("Categ", item_no, flush=True)
|
|
|
|
|
try:
|
|
|
|
|
self.category_idx = self.settings.data['ElogInit'][logbook][
|
|
|
|
|
'Category']
|
|
|
|
|
except KeyError as ex:
|
|
|
|
|
print("Did not find Category Index" + str(ex))
|
|
|
|
|
|
|
|
|
|
self.category_items.clear()
|
|
|
|
|
key = 'Required' if 'Required' in self.parent.settings.data[
|
|
|
|
|
"ElogBooks"][logbook] else 'Optional'
|
|
|
|
|
@@ -199,12 +196,10 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
|
|
|
|
|
if 'Effect' in self.layout_items:
|
|
|
|
|
item_no += 1
|
|
|
|
|
print("Effect", item_no, flush=True)
|
|
|
|
|
self.layout.insertLayout(item_no, self.effekt)
|
|
|
|
|
|
|
|
|
|
if 'Domain' in self.layout_items:
|
|
|
|
|
item_no += 1
|
|
|
|
|
print("Domain", item_no, flush=True)
|
|
|
|
|
self.domain_items.clear()
|
|
|
|
|
self.domain_items.addItems(list(self.parent.settings.data[
|
|
|
|
|
'ElogBooks'][logbook]['Optional']['Domain']))
|
|
|
|
|
@@ -213,7 +208,7 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
|
|
|
|
|
if 'Section' in self.layout_items:
|
|
|
|
|
item_no += 1
|
|
|
|
|
print("Section", item_no, flush=True)
|
|
|
|
|
|
|
|
|
|
self.section_items.clear()
|
|
|
|
|
self.section_items.addItems(list(self.parent.settings.data[
|
|
|
|
|
'ElogBooks'][logbook]['Optional']['Section'][self.domain_idx]))
|
|
|
|
|
@@ -222,7 +217,8 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
|
|
|
|
|
if 'System' in self.layout_items:
|
|
|
|
|
item_no += 1
|
|
|
|
|
print("System", item_no, flush=True)
|
|
|
|
|
self.system_idx = self.settings.data['ElogInit'][logbook][
|
|
|
|
|
'System']
|
|
|
|
|
self.system_items.clear()
|
|
|
|
|
self.system_items.addItems(list(self.parent.settings.data[
|
|
|
|
|
'ElogBooks'][logbook]['Optional']['System']))
|
|
|
|
|
@@ -231,23 +227,18 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
|
|
|
|
|
if 'Status' in self.layout_items:
|
|
|
|
|
item_no += 1
|
|
|
|
|
print("Status", item_no, flush=True)
|
|
|
|
|
self.estatus_items.clear()
|
|
|
|
|
self.estatus_items.addItems(list(self.parent.settings.data[
|
|
|
|
|
'ElogBooks'][logbook]['Optional']['Status']))
|
|
|
|
|
self.estatus_items.setCurrentIndex(self.status_idx)
|
|
|
|
|
self.layout.insertLayout(item_no, self.estatus)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
print("self.attachFile==>", self.parent.attach_files)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#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 = []
|
|
|
|
|
if isinstance(self.attachFile, str):
|
|
|
|
|
@@ -269,18 +260,20 @@ 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):
|
|
|
|
|
|
|
|
|
|
print(self.elog_items.currentText(), "new=", idx)
|
|
|
|
|
print(self.elog_items.itemText(idx))
|
|
|
|
|
print(self.logbook)
|
|
|
|
|
#print(self.elog_items.currentText(), "new=", idx)
|
|
|
|
|
#print(self.elog_items.itemText(idx))
|
|
|
|
|
#print(self.logbook)
|
|
|
|
|
|
|
|
|
|
new_logbook = self.elog_items.itemText(idx)
|
|
|
|
|
|
|
|
|
|
print("NEW", new_logbook, flush=True)
|
|
|
|
|
print("OLD", self.logbook, flush=True)
|
|
|
|
|
#print("NEW", new_logbook, flush=True)
|
|
|
|
|
#print("OLD", self.logbook, flush=True)
|
|
|
|
|
|
|
|
|
|
#Meet the new logbook. Same as the old logbook
|
|
|
|
|
if new_logbook == self.logbook:
|
|
|
|
|
@@ -292,9 +285,8 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
except KeyError:
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
print("self.layout_items START", self.layout_items, flush=True)
|
|
|
|
|
|
|
|
|
|
self.layout_items = self.get_logbook_specific_items(new_logbook)
|
|
|
|
|
print("self.layout_items END", self.layout_items, flush=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if any(substring.upper() in new_logbook.upper() \
|
|
|
|
|
@@ -311,6 +303,7 @@ class QSendToELOG(QSendToELOGFrame):
|
|
|
|
|
def on_domain_change(self, i):
|
|
|
|
|
self.section_items.clear()
|
|
|
|
|
self.section_items.addItems(self.elog_section[i])
|
|
|
|
|
#self.section_items.setCurrentIndex(0)
|
|
|
|
|
|
|
|
|
|
def ok(self):
|
|
|
|
|
#proj = self.category_items.currentText()
|
|
|
|
|
|