summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--DockWidgets/DockWidget.py110
-rw-r--r--DockWidgets/__pycache__/DockWidget.cpython-37.pycbin6306 -> 4323 bytes
-rw-r--r--Undo.datbin80258 -> 28665 bytes
3 files changed, 11 insertions, 99 deletions
diff --git a/DockWidgets/DockWidget.py b/DockWidgets/DockWidget.py
index 2087910..d6813ee 100644
--- a/DockWidgets/DockWidget.py
+++ b/DockWidgets/DockWidget.py
@@ -2,10 +2,7 @@ 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/DockWidget.ui')
@@ -20,15 +17,13 @@ class DockWidget(QDockWidget,ui_dialog):
self.obj=obj
self.type = comptype
self.input_dict = {}
- self.x_pclist = []
self.modes()
self.comboBox.currentIndexChanged.connect(self.mode_selection)
print("constructor ", self.input_dict)
self.pushButton_2.clicked.connect(self.param)
- self.dict = {}
- self.name_type = None
+ self.dict = {}
self.container = container
# input data tab
@@ -61,72 +56,18 @@ class DockWidget(QDockWidget,ui_dialog):
try:
print("input_params_list ", self.input_dict)
for c,i in enumerate(self.input_dict):
+ print(i)
if i == None:
continue
- if(i=="thermo_package"):
- print("thermo1")
- combo = QComboBox()
- self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
- print("thermo2")
- for j in self.lines:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- lay = QGridLayout()
- lay.addWidget(QLabel(i+":"), 0,0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.input_dict[i] = combo
- print("thermo")
- elif(i=="Ctype"):
- combo = QComboBox()
- self.lines = ["Total","Partial"]
- for j in self.lines:
- combo.addItem(str(j))
- combo.setMinimumContentsLength(15)
- lay = QGridLayout()
- lay.addWidget(QLabel("Condensor Type :"), 0, 0, alignment=Qt.AlignLeft)
- lay.addWidget(combo, 0, 1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(''), 0, 2, alignment = Qt.AlignCenter)
- self.formLayout.addRow(lay)
- self.input_dict[i] = combo
- elif(i=="x_pc"):
- noc = len(compound_selected)
- print(noc)
- self.x_pclist.clear()
- gp = QGroupBox("Compounds")
- lay = QGridLayout()
- for j in range(noc):
- l = QLineEdit()
- self.input_dict[i] = "x_pc"
- lay.addWidget(QLabel(str(compound_selected[j])+":"),j,0, alignment=Qt.AlignLeft)
- lay.addWidget(l,j,1, alignment=Qt.AlignCenter)
- lay.addWidget(QLabel(self.obj.variables[i]['unit']),j,2, alignment=Qt.AlignCenter)
- self.x_pclist.append(l)
- gp.setLayout(lay)
- self.formLayout.addRow(gp)
- else:
- print("elseloop")
- print(i)
- if i == None:
- continue
- l = QLineEdit()
- if self.input_dict[i] != None:
- l.setText(str(self.input_dict[i]))
- print('before lay')
- lay = QGridLayout()
- lay.addWidget(QLabel(self.obj.variables[i]['name']+":"),0,0, alignment=Qt.AlignLeft) #self.obj.variables[i]['name']
- lay.addWidget(l,0,1, alignment=Qt.AlignCenter)
- print('after lay')
- if(i != 'MolFlow'):
- lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
- else:
- lay.addWidget(QLabel('mol/s'),0,2, alignment=Qt.AlignCenter)
- print('after all')
- self.formLayout.addRow(lay)
- self.input_dict[i] = l
-
-
+ l = QLineEdit()
+ if self.input_dict[i] != None:
+ l.setText(str(self.input_dict[i]))
+ lay = QGridLayout()
+ lay.addWidget(QLabel(self.obj.variables[i]['name']+":"),0,0, alignment=Qt.AlignLeft)
+ lay.addWidget(l,0,1, alignment=Qt.AlignCenter)
+ lay.addWidget(QLabel(self.obj.variables[i]['unit']),0,2, alignment=Qt.AlignCenter)
+ self.formLayout.addRow(lay)
+ self.input_dict[i] = l
except Exception as e:
print(e)
@@ -140,35 +81,6 @@ class DockWidget(QDockWidget,ui_dialog):
for i in self.input_dict:
if (self.input_dict[i] == None):
continue
- if(i=="thermo_package"):
- if (self.input_dict[i].currentText()):
- self.dict[i] = self.input_dict[i].currentText()
- else:
- self.show_error()
- break
- elif(i=="Ctype"):
- if (self.input_dict[i].currentText()):
- self.dict[i] = self.input_dict[i].currentText()
- else:
- self.show_error()
- break
- elif(i =="x_pc"):
- l=[]
- mf = []
- total_moles = 0
- for mol_frac in self.x_pclist:
- if (mol_frac.text()):
- l.append(mol_frac.text())
- total_moles += float(l[-1])
- else:
- self.show_error()
- break
- for c in range(len(compound_selected)):
- mf.append(str(float(l[c])/total_moles))
- self.x_pclist[c].setText(mf[-1])
- self.dict[i] = ",".join(mf)
- elif(i == 'Pout' and self.obj.type == 'Mixer' or i == '' or i == 'HKey' or i == 'LKey'):
- self.dict[i] = self.input_dict[i].currentText()
else:
print(self.input_dict[i], i, self.obj.type)
if (self.input_dict[i].text()):
diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
index 1f3821d..431c298 100644
--- a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
Binary files differ
diff --git a/Undo.dat b/Undo.dat
index b05cceb..b56b18f 100644
--- a/Undo.dat
+++ b/Undo.dat
Binary files differ