summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpravindalve2020-12-03 21:25:50 +0530
committerpravindalve2020-12-03 21:25:50 +0530
commita1a966934198e67c3a7bcc8236ed51503ae48a04 (patch)
treefe5629b984462fd3c1a78b303f65428ec4ff6204
parent37566839d914ce9e155b63d4df57daf46001d2bf (diff)
downloadChemical-Simulator-GUI-a1a966934198e67c3a7bcc8236ed51503ae48a04.tar.gz
Chemical-Simulator-GUI-a1a966934198e67c3a7bcc8236ed51503ae48a04.tar.bz2
Chemical-Simulator-GUI-a1a966934198e67c3a7bcc8236ed51503ae48a04.zip
Fixes for reloading saving file
-rw-r--r--DockWidgets/DockWidget.py19
-rw-r--r--DockWidgets/DockWidgetMaterialStream.py24
-rw-r--r--DockWidgets/__pycache__/DockWidget.cpython-37.pycbin4341 -> 4329 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pycbin8132 -> 8124 bytes
-rw-r--r--Graphics.py11
-rw-r--r--Streams.py1
-rw-r--r--Undo.datbin4739 -> 3191 bytes
-rw-r--r--UnitOperations.py3
8 files changed, 40 insertions, 18 deletions
diff --git a/DockWidgets/DockWidget.py b/DockWidgets/DockWidget.py
index b3845bb..b3997f3 100644
--- a/DockWidgets/DockWidget.py
+++ b/DockWidgets/DockWidget.py
@@ -59,15 +59,13 @@ class DockWidget(QDockWidget,ui_dialog):
print(i)
if i == None:
continue
- l = QLineEdit()
- if self.input_dict[i] != None:
- l.setText(str(self.input_dict[i]))
+ l = QLineEdit(self.obj.variables[i]['value'])
lay = QGridLayout()
- lay.addWidget(QLabel(self.obj.variables[i]['name']+":"),0,0, alignment=Qt.AlignLeft)
+ 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
+ self.input_dict[i] = l
except Exception as e:
print(e)
@@ -132,7 +130,16 @@ class DockWidget(QDockWidget,ui_dialog):
self.tableWidget.setItem(rowPosition , 2, QTableWidgetItem(obj.variables[val]['unit']))
self.tableWidget.resizeColumnsToContents()
+ # Updating result in class
+ obj.variables[val]['value'] = resultval
+ # try:
+ # if obj.type == "Heater":
+ # print(obj.variables[val]['name'] + str(obj.variables[val]['value']))
+ # except Exception as e:
+ # print(e)
+
+
+
except Exception as e:
print(e)
- \ No newline at end of file
diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py
index d272933..792a985 100644
--- a/DockWidgets/DockWidgetMaterialStream.py
+++ b/DockWidgets/DockWidgetMaterialStream.py
@@ -62,10 +62,10 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
gp = QGroupBox("Mole Fractions")
lay = QGridLayout()
for j in range(noc):
- l = QLineEdit()
- if self.input_dict[i] != '':
- l.setText(str(self.obj.variables['x_pc']['value'][j]))
- print('l = ', str(self.obj.variables['x_pc']['value'][j]))
+ l = QLineEdit(str(self.obj.variables['x_pc']['value'][j]))
+ # if self.input_dict[i] != '':
+ # l.setText(str(self.obj.variables['x_pc']['value'][j]))
+ # print('l = ', str(self.obj.variables['x_pc']['value'][j]))
self.input_dict[i] = "x_pc"
lay.addWidget(QLabel(str(compound_selected[j])+":"),j,0, alignment= Qt.AlignLeft)
@@ -141,6 +141,9 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
except Exception as e:
print(e)
+ def update_input_values(self):
+ self.init()
+
@staticmethod
def show_result(lst):
for i in lst:
@@ -285,21 +288,22 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
self.input_dict = {}
self.input_dict = self.obj.param_getter(self.comboBox.currentText())
- print("before", self.input_dict)
- self.input_dict.pop("x_pc")
- temp = self.input_dict.pop('thermo_package')
+ # print("before", self.input_dict)
+ # self.input_dict.pop("x_pc")
+ # temp = self.input_dict.pop('thermo_package')
for i in range(len(compound_selected)):
print(i)
self.input_dict['x_pc[1,' + str(i+1) + ']'] = self.obj.variables['x_pc[1,' + str(i+1) +']']['value']
- self.input_dict['thermo_package'] = temp
- print("after", self.input_dict)
+ # self.input_dict['thermo_package'] = temp
+ # print("after", self.input_dict)
- # chaning index for updating the input data
+ # changing index for updating the input data
indexx = self.comboBox.currentIndex()
self.comboBox.setCurrentIndex(1)
self.comboBox.setCurrentIndex(indexx)
+
except Exception as e:
print(e) \ No newline at end of file
diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
index 61691e2..72623eb 100644
--- a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
index f3850cf..7d5b43a 100644
--- a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
Binary files differ
diff --git a/Graphics.py b/Graphics.py
index 8d7c220..16ef1a7 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -56,6 +56,7 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
new_box.setPos(i.pos.toPoint().x(), i.pos.toPoint().y())
self.scene.addItem(new_box)
+
for i in obj:
if i.type == "MaterialStream":
print(eval(i.type))
@@ -462,6 +463,16 @@ class NodeItem(QtWidgets.QGraphicsItem):
self.dock_widget.setFixedHeight(640)
self.dock_widget.DockWidgetFeature(QDockWidget.AllDockWidgetFeatures)
self.main_window.addDockWidget(Qt.LeftDockWidgetArea, self.dock_widget)
+
+ # updating input values
+ if self.dock_widget.obj.type != 'MaterialStream':
+ print(self.dock_widget.obj.type)
+ try:
+ self.dock_widget.obj.param_setter(self.dock_widget.obj.param_getter(self.dock_widget.obj.mode))
+ except Exception as e:
+ print(e)
+ # self.dock_widget.param()
+
self.dock_widget.hide()
self.pic=QtGui.QPixmap("Icons/"+self.type+".png")
diff --git a/Streams.py b/Streams.py
index 3cf3fc0..ac89830 100644
--- a/Streams.py
+++ b/Streams.py
@@ -89,6 +89,7 @@ class MaterialStream():
dict = {self.mode1:self.variables['P']['value'], self.mode2:self.variables['T']['value'],
"MolFlow":self.variables['F_p[1]']['value'],"x_pc":self.variables['x_pc']['value']}
+ print('dictionary is :' + str(dict))
elif(mode=="PH"):
self.mode1 = 'P'
diff --git a/Undo.dat b/Undo.dat
index 15e304e..914294e 100644
--- a/Undo.dat
+++ b/Undo.dat
Binary files differ
diff --git a/UnitOperations.py b/UnitOperations.py
index 410cdd1..08a871d 100644
--- a/UnitOperations.py
+++ b/UnitOperations.py
@@ -48,7 +48,6 @@ class UnitOperation():
for k,v in params.items():
if k == 'Thermo Package':
self.thermo_package = v
- print('haha')
elif k != self.mode:
self.k = v
self.variables[k]['value'] = v
@@ -152,7 +151,7 @@ class UnitOperation():
self.OM_data_eqn += ('connect(' + self.name + '.Out,' + self.output_stms[0].name + '.In);\n')
if self.mode:
- self.OM_data_eqn += (self.name + '.' + self.mode + '=' + self.mode_val + ';\n')
+ self.OM_data_eqn += (self.name + '.' + self.mode + '=' + str(self.mode_val) + ';\n')
return self.OM_data_eqn