summaryrefslogtreecommitdiff
path: root/DockWidgets/DockWidgetFlash.py
diff options
context:
space:
mode:
Diffstat (limited to 'DockWidgets/DockWidgetFlash.py')
-rw-r--r--DockWidgets/DockWidgetFlash.py74
1 files changed, 74 insertions, 0 deletions
diff --git a/DockWidgets/DockWidgetFlash.py b/DockWidgets/DockWidgetFlash.py
new file mode 100644
index 0000000..6098b27
--- /dev/null
+++ b/DockWidgets/DockWidgetFlash.py
@@ -0,0 +1,74 @@
+from PyQt5.QtCore import *
+from PyQt5.QtWidgets import *
+from PyQt5.QtGui import *
+from PyQt5.uic import loadUiType
+import pandas as pd
+from functools import partial
+from ComponentSelector import *
+from collections import defaultdict
+from Graphics import *
+
+ui_dialog,_ = loadUiType('DockWidgets/DockWidgetFlash.ui')
+
+class DockWidgetFlash(QDockWidget,ui_dialog):
+
+ def __init__(self,name,comptype,obj,container,parent=None):
+ QDockWidget.__init__(self,parent)
+ self.setupUi(self)
+ self.setWindowTitle(obj.name)
+ self.name=name
+ self.obj=obj
+ self.type = comptype
+ self.input_dict = []
+ print("constructor ", self.input_dict)
+ self.input_params_list()
+ self.btn.clicked.connect(self.param)
+ self.dict = []
+
+ def input_params_list(self):
+ try:
+ print("input_params_list ", self.input_dict)
+
+ self.l1.setText(self.obj.variables['thermoPackage']['name']+":")
+ self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
+ for j in self.lines:
+ self.cb1.addItem(str(j))
+
+ self.check1.setText(self.obj.variables['Tdef']['name']+":")
+ self.le2.setText(str(self.obj.variables['Tdef']['value']))
+ self.u2.setText(self.obj.variables['Tdef']['unit'])
+ self.check1.toggled.connect(self.fun)
+ self.check2.setText(self.obj.variables['Pdef']['name']+":")
+ self.le3.setText(str(self.obj.variables['Pdef']['value']))
+ self.u3.setText(self.obj.variables['Pdef']['unit'])
+ self.check2.toggled.connect(self.fun)
+
+ self.input_dict = [self.cb1, self.check1, self.le2, self.check2, self.le3]
+
+ except Exception as e:
+ print(e)
+
+ def fun(self):
+ if self.check1.isChecked():
+ self.le2.setDisabled(False)
+ else:
+ self.le2.setDisabled(True)
+ if self.check2.isChecked():
+ self.le3.setDisabled(False)
+ else:
+ self.le3.setDisabled(True)
+
+ def show_error(self):
+ QMessageBox.about(self, 'Important', "Please fill all fields with data")
+
+ def param(self):
+ try:
+ self.dict={}
+ print("param.input_dict ", self.input_dict)
+ self.dict = [self.input_dict[0].currentText(),self.input_dict[1].isChecked(), float(self.input_dict[2].text()), self.input_dict[3].isChecked(), float(self.input_dict[4].text())]
+ print("param ", self.dict)
+ self.obj.param_setter(self.dict)
+ self.hide()
+
+ except Exception as e:
+ print(e) \ No newline at end of file