diff options
author | lucaszhao19 | 2020-01-08 17:04:01 +0530 |
---|---|---|
committer | lucaszhao19 | 2020-01-08 17:04:01 +0530 |
commit | db1e22fcf2aa9fd38a10867cc24813f8c4c9f079 (patch) | |
tree | 3e87860c7dff3594ce21c24c7b38ac4c6466f481 /container.py | |
parent | 39ecc236c572ae17343b9afb39997233e7eb28f0 (diff) | |
download | Chemical-Simulator-GUI-db1e22fcf2aa9fd38a10867cc24813f8c4c9f079.tar.gz Chemical-Simulator-GUI-db1e22fcf2aa9fd38a10867cc24813f8c4c9f079.tar.bz2 Chemical-Simulator-GUI-db1e22fcf2aa9fd38a10867cc24813f8c4c9f079.zip |
Creating, deleting, saving and loading graphics related parts fully completed
Diffstat (limited to 'container.py')
-rw-r--r-- | container.py | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/container.py b/container.py index 8b47c05..6cfc689 100644 --- a/container.py +++ b/container.py @@ -10,19 +10,18 @@ from PyQt5.QtWidgets import QGraphicsProxyWidget, QGraphicsObject, QGraphicsElli from PyQt5.QtGui import QBrush ,QTransform ,QMouseEvent import PyQt5.QtCore as QtCore import PyQt5.QtWidgets as QtWidgets -from dockWidget import dockWidget import datetime import itertools import json import pickle import os import sys -unitOp = [] +from Graphics import * + class Container(): - def __init__(self,msgbrowser): - #self.unitOp = [] + self.unitOp = [] self.thermoPackage = None self.compounds = None self.flowsheet = None @@ -33,6 +32,7 @@ class Container(): self.msg.setText("") self.opl=[] self.result=[] + self.graphics = Graphics(self.unitOp) def currentTime(self): now = datetime.datetime.now() @@ -65,24 +65,26 @@ class Container(): except Exception as e: print(e) - def addUnitOp(self,obj,scene,graphics): + @staticmethod + def addUnitOpObj(obj): + self.unitOp.append(obj) + + def addUnitOp(self,obj): box = None self.obj = obj - self.scene = scene - self.graphics = graphics + self.scene = self.graphics.getScene() box = self.graphics.createNodeItem(self.obj) self.scene.addItem(box) box.setPos(2500-30, 2500-30) - if(obj in unitOp): + if(obj in self.unitOp): pass else: - #self.unitOp.append(obj) - unitOp.append(obj) + self.unitOp.append(obj) self.msg.append("<span style=\"color:blue\">["+str(self.currentTime())+"]<b> "+obj.name+" </b>is instantiated .""</span>") def fetchObject(self,name): - for i in unitOp: + for i in self.unitOp: if(i.name==name): return i @@ -109,11 +111,10 @@ class Container(): print("SIMULATE") print(mode) self.compounds = compound_selected - #self.connection() self.flowsheet = Flowsheet() self.flowsheet.add_comp_list(self.compounds) print("######## connection master#########\n",self.conn) - for i in unitOp : + for i in self.unitOp : print("here",i) self.flowsheet.add_UnitOpn(i) |