summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpravindalve2023-02-07 13:04:01 +0530
committerGitHub2023-02-07 13:04:01 +0530
commit651b94f869dde8c3ca75fd1a0e41c32bc01c240d (patch)
tree26a78391fbd38db78e4f3f2a242c7639c3081c56
parente10e1eebbf6927d5548ccb7bbb6563994cee0c35 (diff)
parentf53af896c241d0628625452ef66f4a7255ec2846 (diff)
downloadChemical-Simulator-GUI-651b94f869dde8c3ca75fd1a0e41c32bc01c240d.tar.gz
Chemical-Simulator-GUI-651b94f869dde8c3ca75fd1a0e41c32bc01c240d.tar.bz2
Chemical-Simulator-GUI-651b94f869dde8c3ca75fd1a0e41c32bc01c240d.zip
Merge pull request #46 from brenda-br/Fix-35
Fix 27, 31, 32, 44, 45, 47, 48, 49, 50
-rw-r--r--Container.py6
-rw-r--r--DockWidgets/DockWidget.py8
-rw-r--r--DockWidgets/DockWidgetCompoundSeparator.py5
-rw-r--r--DockWidgets/DockWidgetCompressorExpander.py6
-rw-r--r--DockWidgets/DockWidgetDistillationColumn.py5
-rw-r--r--DockWidgets/DockWidgetFlash.py5
-rw-r--r--DockWidgets/DockWidgetMaterialStream.py9
-rw-r--r--DockWidgets/DockWidgetMixer.py5
-rw-r--r--DockWidgets/DockWidgetShortcutColumn.py5
-rw-r--r--DockWidgets/DockWidgetSplitter.py5
-rw-r--r--DockWidgets/__pycache__/DockWidget.cpython-37.pycbin4849 -> 4932 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pycbin4104 -> 4222 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pycbin10155 -> 10273 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pycbin3202 -> 3318 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pycbin9127 -> 9254 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pycbin2388 -> 2504 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pycbin5350 -> 5468 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pycbin3023 -> 3139 bytes
-rw-r--r--Graphics.py109
-rw-r--r--OMChem/Flowsheet.py2
-rw-r--r--Streams.py57
-rw-r--r--Undo.datbin115346 -> 5449 bytes
-rw-r--r--main.ui4
-rw-r--r--mainApp.py32
24 files changed, 181 insertions, 82 deletions
diff --git a/Container.py b/Container.py
index 443a8bd..a975bc9 100644
--- a/Container.py
+++ b/Container.py
@@ -157,9 +157,9 @@ class Container():
if(len(self.result)== 4):
DockWidget.show_result(NodeItem.get_dock_widget())
- # for i in self.graphics.scene.items():
- # if (isinstance(i, NodeItem)):
- # i.update_tooltip()
+ for i in self.graphics.scene.items():
+ if (isinstance(i, NodeItem) and i.type == 'MaterialStream'):
+ i.update_tooltip_selectedVar()
def flat_list(lst):
flat_lst=[]
diff --git a/DockWidgets/DockWidget.py b/DockWidgets/DockWidget.py
index cc222db..71e9624 100644
--- a/DockWidgets/DockWidget.py
+++ b/DockWidgets/DockWidget.py
@@ -90,7 +90,7 @@ class DockWidget(QDockWidget,ui_dialog):
self.show_error()
break
- print("param ", self.dict)
+ #print("param ", self.dict)
self.obj.param_setter(self.dict)
for i in self.container.graphics.graphicsView.items():
try:
@@ -98,7 +98,9 @@ class DockWidget(QDockWidget,ui_dialog):
i.update_tooltip()
except:
pass
-
+ if(self.isVisible()):
+ currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189)
self.hide()
except Exception as e:
@@ -155,4 +157,4 @@ class DockWidget(QDockWidget,ui_dialog):
def closeEvent(self,event):
scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal
currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
- self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue((scrollHVal+currentVal)/2) \ No newline at end of file
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file
diff --git a/DockWidgets/DockWidgetCompoundSeparator.py b/DockWidgets/DockWidgetCompoundSeparator.py
index 8fcee39..57b1339 100644
--- a/DockWidgets/DockWidgetCompoundSeparator.py
+++ b/DockWidgets/DockWidgetCompoundSeparator.py
@@ -113,6 +113,9 @@ class DockWidgetCompoundSeparator(QDockWidget,ui_dialog):
self.obj.param_setter(self.dict)
+ if(self.isVisible()):
+ currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189)
self.hide()
except Exception as e:
@@ -120,4 +123,4 @@ class DockWidgetCompoundSeparator(QDockWidget,ui_dialog):
def closeEvent(self,event):
scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal
currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
- self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue((scrollHVal+currentVal)/2) \ No newline at end of file
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file
diff --git a/DockWidgets/DockWidgetCompressorExpander.py b/DockWidgets/DockWidgetCompressorExpander.py
index cd0135c..e8e2b31 100644
--- a/DockWidgets/DockWidgetCompressorExpander.py
+++ b/DockWidgets/DockWidgetCompressorExpander.py
@@ -107,7 +107,9 @@ class DockWidgetCompressorExpander(QDockWidget,ui_dialog):
i.update_tooltip()
except:
pass
-
+ if(self.isVisible()):
+ currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189)
self.hide()
except Exception as e:
@@ -154,4 +156,4 @@ class DockWidgetCompressorExpander(QDockWidget,ui_dialog):
def closeEvent(self,event):
scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal
currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
- self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue((scrollHVal+currentVal)/2) \ No newline at end of file
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file
diff --git a/DockWidgets/DockWidgetDistillationColumn.py b/DockWidgets/DockWidgetDistillationColumn.py
index 716cb1a..e2e1031 100644
--- a/DockWidgets/DockWidgetDistillationColumn.py
+++ b/DockWidgets/DockWidgetDistillationColumn.py
@@ -179,6 +179,9 @@ class DockWidgetDistillationColumn(QDockWidget, ui_dialog):
print("param ", self.dict)
self.obj.param_setter(self.dict)
+ if(self.isVisible()):
+ currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189)
self.hide()
except Exception as e:
@@ -361,4 +364,4 @@ class DockWidgetDistillationColumn(QDockWidget, ui_dialog):
def closeEvent(self,event):
scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal
currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
- self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue((scrollHVal+currentVal)/2) \ No newline at end of file
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file
diff --git a/DockWidgets/DockWidgetFlash.py b/DockWidgets/DockWidgetFlash.py
index c288259..c75f950 100644
--- a/DockWidgets/DockWidgetFlash.py
+++ b/DockWidgets/DockWidgetFlash.py
@@ -65,6 +65,9 @@ class DockWidgetFlash(QDockWidget,ui_dialog):
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)
+ if(self.isVisible()):
+ currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189)
self.hide()
except Exception as e:
@@ -73,4 +76,4 @@ class DockWidgetFlash(QDockWidget,ui_dialog):
def closeEvent(self,event):
scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal
currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
- self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue((scrollHVal+currentVal)/2) \ No newline at end of file
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file
diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py
index 64545be..a6396ef 100644
--- a/DockWidgets/DockWidgetMaterialStream.py
+++ b/DockWidgets/DockWidgetMaterialStream.py
@@ -174,7 +174,9 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
i.update_tooltip()
except:
pass
-
+ if(self.isVisible()):
+ currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189)
self.hide()
except Exception as e:
@@ -209,7 +211,7 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
klst = list(d.values())
p = {"Pressure":"P", "Temperature":"T","Vapour Phase Mole Fraction":"xvap", "Phase Molar Enthalpy":"H_p",
- "Phase Molar Entropy":"S_p", "Molar Flow Rate":"F_p"}
+ "Phase Molar Entropy":"S_p", "Molar Flow Rate":"F_p","Mass Flow Rate":"Fm_p"}
# Amounts Tab
if obj.type == 'MaterialStream':
@@ -358,4 +360,5 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
def closeEvent(self,event):
scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal
currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
- self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue((scrollHVal+currentVal)/2) \ No newline at end of file
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189)
+ \ No newline at end of file
diff --git a/DockWidgets/DockWidgetMixer.py b/DockWidgets/DockWidgetMixer.py
index 748ef4f..2d02f8c 100644
--- a/DockWidgets/DockWidgetMixer.py
+++ b/DockWidgets/DockWidgetMixer.py
@@ -46,6 +46,9 @@ class DockWidgetMixer(QDockWidget,ui_dialog):
self.dict={}
self.dict = [int(self.input_dict[0].text()), self.input_dict[1].currentText()]
self.obj.param_setter(self.dict)
+ if(self.isVisible()):
+ currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189)
self.hide()
except Exception as e:
@@ -53,4 +56,4 @@ class DockWidgetMixer(QDockWidget,ui_dialog):
def closeEvent(self,event):
scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal
currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
- self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue((scrollHVal+currentVal)/2) \ No newline at end of file
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file
diff --git a/DockWidgets/DockWidgetShortcutColumn.py b/DockWidgets/DockWidgetShortcutColumn.py
index efb044a..9b65021 100644
--- a/DockWidgets/DockWidgetShortcutColumn.py
+++ b/DockWidgets/DockWidgetShortcutColumn.py
@@ -90,6 +90,9 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog):
self.input_dict[4].currentText(), float(self.input_dict[5].text()), float(self.input_dict[6].text()), float(self.input_dict[7].text()),
self.input_dict[8].currentText()]
self.obj.param_setter(self.dict)
+ if(self.isVisible()):
+ currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189)
self.hide()
except Exception as e:
@@ -135,4 +138,4 @@ class DockWidgetShortcutColumn(QDockWidget,ui_dialog):
def closeEvent(self,event):
scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal
currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
- self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue((scrollHVal+currentVal)/2) \ No newline at end of file
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file
diff --git a/DockWidgets/DockWidgetSplitter.py b/DockWidgets/DockWidgetSplitter.py
index 05dfb0b..24a8ee2 100644
--- a/DockWidgets/DockWidgetSplitter.py
+++ b/DockWidgets/DockWidgetSplitter.py
@@ -65,6 +65,9 @@ class DockWidgetSplitter(QDockWidget,ui_dialog):
self.dict={}
self.dict = [int(self.input_dict[0].text()),self.input_dict[1].currentText(), float(self.input_dict[2].text()), float(self.input_dict[3].text())]
self.obj.param_setter(self.dict)
+ if(self.isVisible()):
+ currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189)
self.hide()
except Exception as e:
print(e)
@@ -72,4 +75,4 @@ class DockWidgetSplitter(QDockWidget,ui_dialog):
def closeEvent(self,event):
scrollHVal = self.parent().container.graphics.graphicsView.horizontalScrollBarVal
currentVal = self.parent().container.graphics.graphicsView.horizontalScrollBar().value()
- self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue((scrollHVal+currentVal)/2) \ No newline at end of file
+ self.parent().container.graphics.graphicsView.horizontalScrollBar().setValue(currentVal-189) \ No newline at end of file
diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
index 5d0ec10..51ca871 100644
--- a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc
index f11f259..ac95283 100644
--- a/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc
index aa0f582..9be19e9 100644
--- a/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc
index 53d07bc..53e426a 100644
--- a/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
index e5bba23..193f8e9 100644
--- a/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc
index 58c8a9e..ce2d5af 100644
--- a/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc
index dd67795..84d18de 100644
--- a/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pyc
Binary files differ
diff --git a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc
index e19a9a3..2f45777 100644
--- a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc
Binary files differ
diff --git a/Graphics.py b/Graphics.py
index c527205..862845b 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -51,14 +51,15 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
else:
self.unit_operations.append(i)
type(i).counter += 1
- print(self.unit_operations)
+ #print(self.unit_operations)
new_box = self.create_node_item(i, container)
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))
+ pass
+ #print(eval(i.type))
elif i.type not in stm:
ip = i.input_stms
op = i.output_stms
@@ -66,11 +67,11 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
pointA = NodeItem.get_instances(v.name)
pointB = NodeItem.get_instances(i.name)
rect = pointA.output[0].boundingRect()
- pointAA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2)
+ pointAA = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2))
pointAA = pointA.output[0].mapToScene(pointAA)
socketB = next((s for s in pointB.input if k == s.id))
rectB = socketB.boundingRect()
- pointBB = QtCore.QPointF(rectB.x() + rectB.width()/2, rectB.y() + rectB.height()/2)
+ pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2), rectB.y() + rectB.height()/(2))
pointBB = socketB.mapToScene(pointBB)
self.new_line = NodeLine(pointAA, pointBB, 'in')
self.new_line.source = pointA.output[0]
@@ -86,10 +87,10 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
pointB = NodeItem.get_instances(v.name)
socketA = next(s for s in pointA.output if k == s.id)
rect = socketA.boundingRect()
- pointAA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2)
+ pointAA = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2))
pointAA = socketA.mapToScene(pointAA)
rectB = pointB.input[0].boundingRect()
- pointBB = QtCore.QPointF(rectB.x() + rectB.width()/2, rectB.y() + rectB.height()/2)
+ pointBB = QtCore.QPointF(rectB.x() + rectB.width()/(2), rectB.y() + rectB.height()/(2))
pointBB = pointB.input[0].mapToScene(pointBB)
self.new_line = NodeLine(pointAA, pointBB, 'out')
self.new_line.source = socketA
@@ -263,14 +264,10 @@ class NodeSocket(QtWidgets.QGraphicsItem):
self.other_line=None
# Brush
- self.brush = QtGui.QBrush()
- self.brush.setStyle(QtCore.Qt.SolidPattern)
- self.brush.setColor(QtGui.QColor(220,220,220,220))
+ self.brush = QtGui.QBrush(Qt.transparent)
# Pen
- self.pen = QtGui.QPen()
- self.pen.setStyle(QtCore.Qt.SolidLine)
- self.pen.setWidth(1)
- self.pen.setColor(QtGui.QColor(0,70,70,255))
+ self.pen = QtGui.QPen(Qt.NoPen)
+
# Lines
self.out_lines = []
self.in_lines = []
@@ -284,9 +281,11 @@ class NodeSocket(QtWidgets.QGraphicsItem):
return QtCore.QRectF(self.rect)
def paint(self, painter, option, widget):
- painter.setBrush(self.brush)
+
painter.setPen(self.pen)
- painter.drawEllipse(self.rect)
+ painter.drawEllipse(self.rect.x(),self.rect.y(),self.rect.height(),self.rect.width())
+ painter.setBrush(self.brush)
+ painter.drawEllipse(self.rect.x()+2,self.rect.y()+2,(self.rect.height()/3)*2,(self.rect.width()/3)*2)
def mousePressEvent(self, event):
cursor = QCursor( Qt.PointingHandCursor )
@@ -294,7 +293,7 @@ class NodeSocket(QtWidgets.QGraphicsItem):
if self.type == 'op':
rect = self.boundingRect()
- pointA = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2)
+ pointA = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2))
pointA = self.mapToScene(pointA)
pointB = self.mapToScene(event.pos())
self.new_line = NodeLine(pointA, pointB ,'op')
@@ -303,7 +302,7 @@ class NodeSocket(QtWidgets.QGraphicsItem):
elif self.type == 'in':
rect = self.boundingRect()
pointA = self.mapToScene(event.pos())
- pointB = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2)
+ pointB = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2))
pointB = self.mapToScene(pointB)
self.new_line = NodeLine(pointA, pointB, 'in')
self.in_lines.append(self.new_line)
@@ -338,7 +337,7 @@ class NodeSocket(QtWidgets.QGraphicsItem):
self.new_line.target = item
item.in_lines.append(self.new_line)
self.new_line.pointB = item.get_center()
- print(type(self.new_line.source))
+ #print(type(self.new_line.source))
if self.new_line.source.parent.obj.type not in stm:
self.new_line.source.parent.obj.add_connection(0, self.new_line.source.id, self.new_line.target.parent.obj)
if self.new_line.target.parent.obj.type not in stm:
@@ -349,7 +348,7 @@ class NodeSocket(QtWidgets.QGraphicsItem):
self.new_line.target = self
item.out_lines.append(self.new_line)
self.new_line.pointA = item.get_center()
- print(type(self.new_line.source))
+ #print(type(self.new_line.source))
if self.new_line.source.parent.obj.type not in stm:
self.new_line.source.parent.obj.add_connection(0, self.new_line.source.id, self.new_line.target.parent.obj)
if self.new_line.target.parent.obj.type not in stm:
@@ -381,7 +380,7 @@ class NodeSocket(QtWidgets.QGraphicsItem):
def get_center(self):
rect = self.boundingRect()
- center = QtCore.QPointF(rect.x() + rect.width()/2, rect.y() + rect.height()/2)
+ center = QtCore.QPointF(rect.x() + rect.width()/(2), rect.y() + rect.height()/(2))
center = self.mapToScene(center)
return center
@@ -392,7 +391,17 @@ class NodeSocket(QtWidgets.QGraphicsItem):
def hoverLeaveEvent(self, event):
cursor = QCursor( Qt.ArrowCursor )
QApplication.instance().setOverrideCursor(cursor)
-
+
+ def show(self):
+ # set pen to show
+ self.pen = QPen(QtGui.QColor(0,70,70,220), 1, Qt.SolidLine)
+ self.brush = QBrush(QtGui.QColor(33,225,162,255))
+
+ def hide(self):
+ # set pen to transparent
+ self.pen = QPen(Qt.NoPen)
+ self.brush = QBrush(Qt.transparent)
+
# all created node items will be put inside this list
# it is used for recreating the node lines by returning the node item object based on unit operation object's name
lst = []
@@ -418,7 +427,7 @@ class NodeItem(QtWidgets.QGraphicsItem):
self.obj = unit_operation
self.container = container
self.graphicsView = graphicsView
-
+ self.setAcceptHoverEvents(True)
self.name = self.obj.name
self.type = self.obj.type
@@ -474,7 +483,8 @@ class NodeItem(QtWidgets.QGraphicsItem):
# updating input values
if self.dock_widget.obj.type != 'MaterialStream':
- print(self.dock_widget.obj.type)
+ pass
+ #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:
@@ -533,28 +543,28 @@ class NodeItem(QtWidgets.QGraphicsItem):
def initialize_sockets(self,type):
if(self.type=="Flash" or self.type=="CompoundSeparator"):
- input = [NodeSocket(QtCore.QRect(5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'in', x) for x in range(1,self.nin+1) ]
- output = [NodeSocket(QtCore.QRect(self.rect.width()-9,(self.rect.height()*x*1/(self.nop+1)),4,4), self, 'op', x) for x in range(1,self.nop+1)]
+ input = [NodeSocket(QtCore.QRect(1,(self.rect.height()*x/(self.nin+1)-6),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-13,(self.rect.height()*x*1/(self.nop+1))-4,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)]
return input,output
elif(self.type=="AdiabaticCompressor" or self.type=="AdiabaticExpander" or self.type =="Mixer" or self.type =="Splitter" or self.type =="Valve" ):
- input = [NodeSocket(QtCore.QRect(-2.5, (self.rect.height()*x/(self.nin+1))-2,4,4), self, 'in', x) for x in range(1,self.nin+1) ]
- output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nop+1))-2,4,4), self, 'op', x) for x in range(1,self.nop+1)]
+ input = [NodeSocket(QtCore.QRect(-6.5, (self.rect.height()*x/(self.nin+1))-6,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-6.5,(self.rect.height()*x/(self.nop+1))-6,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)]
return input,output
elif(self.type=="Cooler" or self.type=="Heater"):
- input = [NodeSocket(QtCore.QRect(3.5, (self.rect.height()*x/(self.nin+1))-2,4,4), self, 'in', x) for x in range(1,self.nin+1) ]
- output = [NodeSocket(QtCore.QRect(self.rect.width()-8.0,(self.rect.height()*x/(self.nop+1))-2,4,4), self, 'op', x) for x in range(1,self.nop+1)]
+ input = [NodeSocket(QtCore.QRect(-0.5, (self.rect.height()*x/(self.nin+1))-6,4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-12.0,(self.rect.height()*x/(self.nop+1))-6,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)]
return input,output
elif(self.type=="CentrifugalPump"):
- input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1))-7, 4,4), self, 'in', x) for x in range(1,self.nin+1) ]
- output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,-1.5,4,4), self, 'op', x) for x in range(1,self.nop+1)]
+ input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1))-11, 4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-6.5,-5.5,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)]
return input,output
elif(self.type=="DistillationColumn" or self.type=="ShortcutColumn"):
- input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)),5,5), self, 'in', x) for x in range(1,self.nin+1) ]
- output = [NodeSocket(QtCore.QRect(self.rect.width()-5.5,(self.rect.height()*1.44*x/(self.nop+1))-55,5,5), self, 'op', x) for x in range(1,self.nop+1)]
+ input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1)-4),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-9.5,(self.rect.height()*1.44*x/(self.nop+1))-59,4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)]
return input,output
elif(self.type=="MaterialStream"):
- input = [NodeSocket(QtCore.QRect(-2.5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'in', x) for x in range(1,self.nin+1) ]
- output = [NodeSocket(QtCore.QRect(self.rect.width()-2.5,(self.rect.height()*x/(self.nin+1)-2),4,4), self, 'op', x) for x in range(1,self.nop+1)]
+ input = [NodeSocket(QtCore.QRect(-6.5,(self.rect.height()*x/(self.nin+1)-6),4*3,4*3), self, 'in', x) for x in range(1,self.nin+1) ]
+ output = [NodeSocket(QtCore.QRect(self.rect.width()-6.5,(self.rect.height()*x/(self.nin+1)-6),4*3,4*3), self, 'op', x) for x in range(1,self.nop+1)]
return input,output
def mouseMoveEvent(self, event):
@@ -591,14 +601,39 @@ class NodeItem(QtWidgets.QGraphicsItem):
default_tooltip = default_tooltip + f" {i} : {j}\n"
self.setToolTip(default_tooltip)
+ def update_tooltip_selectedVar(self):
+ default_tooltip = f"{self.name}\n\n"
+ default_tooltip_dict = self.obj.param_getter_tooltip_selectedVar()
+ for i, j in default_tooltip_dict.items():
+ if j is not None:
+ default_tooltip = default_tooltip + f" {i} : {j}\n"
+ self.setToolTip(default_tooltip)
+
def update_compounds(self):
try:
self.obj.update_compounds()
self.dock_widget.update_compounds()
except AttributeError:
pass
-
-
+
+ def hoverEnterEvent(self, event):
+ super(NodeItem,self).hoverEnterEvent(event)
+ for i in self.graphicsView.items():
+ if(isinstance(i,NodeItem)):
+ for ip in i.input:
+ ip.show()
+ for op in i.output:
+ op.show()
+
+ def hoverLeaveEvent(self, event):
+ super(NodeItem,self).hoverLeaveEvent(event)
+ for i in self.graphicsView.items():
+ if(isinstance(i,NodeItem)):
+ for ip in i.input:
+ ip.hide()
+ for op in i.output:
+ op.hide()
+
def findMainWindow(self):
'''
Global function to find the (open) QMainWindow in application
diff --git a/OMChem/Flowsheet.py b/OMChem/Flowsheet.py
index ce0da55..c38b94e 100644
--- a/OMChem/Flowsheet.py
+++ b/OMChem/Flowsheet.py
@@ -152,7 +152,7 @@ class Flowsheet():
mosFile.write('loadFile(\"Flowsheet.mo\");\n')
mosFile.write('simulate(Flowsheet, outputFormat=\"csv\", stopTime=1.0, numberOfIntervals=1);\n')
- print('Initiating Simulation in Equation Oriented Mode')
+ #print('Initiating Simulation in Equation Oriented Mode')
self.send_for_simulation_Eqn()
diff --git a/Streams.py b/Streams.py
index 0559831..f90546b 100644
--- a/Streams.py
+++ b/Streams.py
@@ -35,19 +35,20 @@ class MaterialStream():
self.variables = {
'P' : {'name':'Pressure', 'value':101325, 'unit':'Pa'},
'T' : {'name':'Temperature', 'value':300, 'unit':'K'},
+
+ 'xvap' : {'name':'Vapour Mole Fraction', 'value':None, 'unit':''},
+ 'H_p[1]' : {'name':'Mixture Molar Entalpy', 'value':None, 'unit':'J/mol'},
+ 'S_p[1]' : {'name':'Mixture Molar Entropy', 'value':None, 'unit':'J/mol.K'},
+ 'F_p[1]' : {'name':'Mixture Molar Flow', 'value':100, 'unit':'mol/s'},
+ 'Fm_p[1]' : {'name':'Mixture Mass Flow', 'value':None, 'unit':'g/s'},
- 'xvap' : {'name':'Vapour Phase Mole Fraction', 'value':None, 'unit':''},
- 'H_p[1]' : {'name':'Mixture Phase Molar Entalpy', 'value':None, 'unit':'J/mol'},
- 'S_p[1]' : {'name':'Mixture Phase Molar Entropy', 'value':None, 'unit':'J/mol.K'},
- 'F_p[1]' : {'name':'Mixture Molar Flow Rate', 'value':100, 'unit':'mol/s'},
-
- 'H_p[2]' : {'name':'Liquid Phase Molar Entalpy', 'value':None, 'unit':'J/mol'},
- 'S_p[2]' : {'name':'Liquid Phase Molar Entropy', 'value':None, 'unit':'J/mol.K'},
- 'F_p[2]' : {'name':'Liquid Molar Flow Rate', 'value':None, 'unit':'mol/s'},
+ 'H_p[2]' : {'name':'Liquid Molar Entalpy', 'value':None, 'unit':'J/mol'},
+ 'S_p[2]' : {'name':'Liquid Molar Entropy', 'value':None, 'unit':'J/mol.K'},
+ 'F_p[2]' : {'name':'Liquid Molar Flow', 'value':None, 'unit':'mol/s'},
- 'H_p[3]' : {'name':'Vapour Phase Molar Entalpy', 'value':None, 'unit':'J/mol'},
- 'S_p[3]' : {'name':'Vapour Phase Molar Entropy', 'value':None, 'unit':'J/mol.K'},
- 'F_p[3]' : {'name':'Vapour Molar Flow Rate', 'value':None, 'unit':'mol/s'},
+ 'H_p[3]' : {'name':'Vapour Molar Entalpy', 'value':None, 'unit':'J/mol'},
+ 'S_p[3]' : {'name':'Vapour Molar Entropy', 'value':None, 'unit':'J/mol.K'},
+ 'F_p[3]' : {'name':'Vapour Molar Flow', 'value':None, 'unit':'mol/s'},
'x_pc' : {'name':'Mole Fraction', 'value':[], 'unit':''},
'xm_pc' : {'name':'Mass Fraction', 'value':None, 'unit':''},
@@ -136,6 +137,40 @@ class MaterialStream():
dict[self.variables['x_pc']['name']] = str(self.variables['x_pc']['value'])+' '+self.variables['x_pc']['unit']
dict['Thermo Package'] = self.thermo_package
return dict
+
+ def param_getter_tooltip_selectedVar(self):
+ dict = {}
+
+ pressure_name = self.variables['P']['name']
+ pressure_val = self.variables['P']['value']
+ pressure_unit = self.variables['P']['unit']
+ temp_name = self.variables['T']['name']
+ temp_val = self.variables['T']['value']
+ temp_unit = self.variables['T']['unit']
+ mixMolEntal_name = self.variables['H_p[1]']['name']
+ mixMolEntal_val = round(float(self.variables['H_p[1]']['value']),2)
+ mixMolEntal_unit = self.variables['H_p[1]']['unit']
+ mixMolEntro_name = self.variables['S_p[1]']['name']
+ mixMolEntro_val = round(float(self.variables['S_p[1]']['value']),2)
+ mixMolEntro_unit = self.variables['S_p[1]']['unit']
+ vapMolFrac_name = self.variables['xvap']['name']
+ vapMolFrac_val = self.variables['xvap']['value']
+ vapMolFrac_unit = self.variables['xvap']['unit']
+ mixMolFlo_name = self.variables['F_pc']['name']
+ mixMolFlo_val = self.variables['F_pc']['value']
+ mixMolFlo_unit = self.variables['F_pc']['unit']
+ mixMassFlo_name = self.variables['Fm_p[1]']['name']
+ mixMassFlo_val = self.variables['Fm_p[1]']['value']
+ mixMassFlo_unit = self.variables['Fm_p[1]']['unit']
+
+ dict = {pressure_name:str(pressure_val)+' '+pressure_unit,
+ temp_name:str(temp_val)+' '+temp_unit,
+ vapMolFrac_name:str(vapMolFrac_val)+' '+vapMolFrac_unit,
+ mixMolEntal_name:str(mixMolEntal_val)+' '+mixMolEntal_unit,
+ mixMolEntro_name:str(mixMolEntro_val)+' '+mixMolEntro_unit,
+ mixMolFlo_name:str(mixMolFlo_val)+' '+mixMolFlo_unit,
+ mixMassFlo_name:str(mixMassFlo_val)+' '+mixMassFlo_unit}
+ return dict
def param_getter(self,mode):
dict = {}
diff --git a/Undo.dat b/Undo.dat
index 501e2fd..25d4faf 100644
--- a/Undo.dat
+++ b/Undo.dat
Binary files differ
diff --git a/main.ui b/main.ui
index aa9350a..f707ba8 100644
--- a/main.ui
+++ b/main.ui
@@ -108,14 +108,14 @@
<item row="1" column="0">
<widget class="QDockWidget" name="dockWidget_2">
<property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
- <width>109</width>
+ <width>0</width>
<height>150</height>
</size>
</property>
diff --git a/mainApp.py b/mainApp.py
index 1430960..32128ae 100644
--- a/mainApp.py
+++ b/mainApp.py
@@ -335,21 +335,25 @@ class MainApp(QMainWindow,ui):
file_name, _ = QFileDialog.getOpenFileName(self, "Open As",
initial_path, "%s Files (*.%s);; All Files (*)" %
(file_format.upper(), file_format))
+ if file_name:
+ self.undo_redo_helper()
- self.undo_redo_helper()
-
- with open(file_name, 'rb') as f:
- obj = pickle.load(f)
- temp_result = obj[-1]
- obj.pop()
- compound_selected = obj[-1]
- obj.pop()
- self.comp.set_compounds(compound_selected)
- for i in compound_selected:
- self.comp.compound_selection(self.comp, i)
- self.container.graphics.load_canvas(obj, self.container)
- self.container.result = temp_result
- DockWidget.show_result(dock_widget_lst)
+ with open(file_name, 'rb') as f:
+ obj = pickle.load(f)
+ temp_result = obj[-1]
+ obj.pop()
+ compound_selected = obj[-1]
+ obj.pop()
+ self.comp.set_compounds(compound_selected)
+ for i in compound_selected:
+ self.comp.compound_selection(self.comp, i)
+ self.comp.hide()
+ self.container.graphics.load_canvas(obj, self.container)
+ self.container.result = temp_result
+ DockWidget.show_result(dock_widget_lst)
+
+ for i in dock_widget_lst:
+ i.param()
except Exception as e: