summaryrefslogtreecommitdiff
path: root/Graphics.py
diff options
context:
space:
mode:
authorlucaszhao192020-08-07 21:10:13 +0630
committerlucaszhao192020-08-07 21:10:13 +0630
commit4babc3c0fb44e9dc0332e4d0da9bd12ab67b3c57 (patch)
tree12aff34d46abef134c4edaf3bfe74af298463a01 /Graphics.py
parent37a360da5346302eb881071f7db2fe7159f8e643 (diff)
downloadChemical-Simulator-GUI-4babc3c0fb44e9dc0332e4d0da9bd12ab67b3c57.tar.gz
Chemical-Simulator-GUI-4babc3c0fb44e9dc0332e4d0da9bd12ab67b3c57.tar.bz2
Chemical-Simulator-GUI-4babc3c0fb44e9dc0332e4d0da9bd12ab67b3c57.zip
Clean unnecessary codes from Graphics.py, Container.py and Streams.py
Diffstat (limited to 'Graphics.py')
-rw-r--r--Graphics.py50
1 files changed, 9 insertions, 41 deletions
diff --git a/Graphics.py b/Graphics.py
index ba034fb..8d7c220 100644
--- a/Graphics.py
+++ b/Graphics.py
@@ -1,20 +1,10 @@
-from functools import partial
-from collections import defaultdict
-import sys
-import numpy as np
-from OMChem.Flowsheet import Flowsheet
-import pandas as pd
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
-from PyQt5.QtGui import QTextDocument ,QTextCursor ,QTextCharFormat ,QFont ,QPixmap
-from PyQt5.uic import loadUiType
-from PyQt5.QtCore import Qt
-from PyQt5.QtWidgets import QGraphicsProxyWidget, QGraphicsObject, QGraphicsEllipseItem ,QGraphicsPixmapItem,QApplication, QGraphicsView, QGraphicsScene, QHBoxLayout, QWidget, QLabel
-from PyQt5.QtGui import QBrush ,QTransform ,QMouseEvent, QIcon
+from PyQt5.QtGui import *
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
-from ComponentSelector import *
+
from DockWidgets.DockWidget import *
from DockWidgets.DockWidgetMaterialStream import *
from DockWidgets.DockWidgetDistillationColumn import *
@@ -25,12 +15,10 @@ from DockWidgets.DockWidgetFlash import *
from DockWidgets.DockWidgetCompoundSeparator import *
from DockWidgets.DockWidgetCompressorExpander import *
-import datetime
-
from Container import *
-import Container
from Streams import *
from UnitOperations import *
+from ComponentSelector import *
class Graphics(QDialog, QtWidgets.QGraphicsItem):
@@ -42,7 +30,6 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
self.graphicsView = graphicsView
self.pos = None
self.unit_operations = unit_operations
- # self.node_item_list = []
def get_scene(self):
return self.scene
@@ -51,13 +38,7 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
return ComponentSelector(self)
def create_node_item(self,unit_operation, container):
- # node_item = NodeItem(unit_operation, container, self.graphicsView)
- # self.node_item_list.append(node_item)
- # return node_item
return NodeItem(unit_operation, container, self.graphicsView)
-
- # def boundingRect(self):
- # return QtCore.QRectF(self.rect)
def load_canvas(self, obj, container):
stm = ['MaterialStream','EngStm']
@@ -78,16 +59,9 @@ class Graphics(QDialog, QtWidgets.QGraphicsItem):
for i in obj:
if i.type == "MaterialStream":
print(eval(i.type))
- # eval(i.type).counter += 1
- # print(eval(i.type).counter)
elif i.type not in stm:
ip = i.input_stms
op = i.output_stms
- print(ip)
- print(op)
- # print(eval(i.type))
- # eval(i.type).counter += 1
- # print(eval(i.type).counter)
for j in ip:
pointA = NodeItem.get_instances(j.name)
pointB = NodeItem.get_instances(i.name)
@@ -285,17 +259,16 @@ class NodeSocket(QtWidgets.QGraphicsItem):
self.new_line=None
self.other_line=None
- # Brush.
+ # Brush
self.brush = QtGui.QBrush()
self.brush.setStyle(QtCore.Qt.SolidPattern)
- self.brush.setColor(QtGui.QColor(220,220,220,220)) #180,20,90,255
- # Pen.
+ self.brush.setColor(QtGui.QColor(220,220,220,220))
+ # Pen
self.pen = QtGui.QPen()
self.pen.setStyle(QtCore.Qt.SolidLine)
self.pen.setWidth(1)
- self.pen.setColor(QtGui.QColor(0,70,70,255)) #20,20,20,255
-
- # Lines.
+ self.pen.setColor(QtGui.QColor(0,70,70,255))
+ # Lines
self.out_lines = []
self.in_lines = []
@@ -492,9 +465,7 @@ class NodeItem(QtWidgets.QGraphicsItem):
self.dock_widget.hide()
self.pic=QtGui.QPixmap("Icons/"+self.type+".png")
- # self.pic = QIcon("svg/Cooler.svg")
self.rect = QtCore.QRect(0,0,self.pic.width(),self.pic.height())
- # self.rect = QtCore.QRect(0,0,100,100)
self.text = QGraphicsTextItem(self)
f = QFont()
f.setPointSize(8)
@@ -511,7 +482,7 @@ class NodeItem(QtWidgets.QGraphicsItem):
self.brush = QtGui.QBrush()
self.brush.setStyle(QtCore.Qt.SolidPattern)
self.brush.setColor(QtGui.QColor(80,0,90,255))
- # Pen.
+ # Pen
self.pen = QtGui.QPen()
self.pen.setStyle(QtCore.Qt.SolidLine)
self.pen.setWidth(1)
@@ -525,7 +496,6 @@ class NodeItem(QtWidgets.QGraphicsItem):
# initializing the node sockets
self.input , self.output = self.initialize_sockets(self.type)
-
def shape(self):
path = QtGui.QPainterPath()
path.addRect(self.boundingRect())
@@ -541,7 +511,6 @@ class NodeItem(QtWidgets.QGraphicsItem):
else:
painter.setPen(self.pen)
painter.drawPixmap(self.rect,self.pic)
- # painter.drawPixmap(self.rect, self.pic.pixmap(QSize(1000,1000)))
def initialize_sockets(self,type):
if(self.type=="Flash" or self.type=="CompoundSeparator"):
@@ -598,7 +567,6 @@ class NodeItem(QtWidgets.QGraphicsItem):
if j is not None:
default_tooltip = default_tooltip + f" {i} : {j}\n"
self.setToolTip(default_tooltip)
-
def findMainWindow(self):
'''