summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Bin_Phase_env.py68
-rw-r--r--DockWidgets/DockWidgetMaterialStream.py19
-rw-r--r--DockWidgets/__pycache__/DockWidget.cpython-37.pycbin4323 -> 4341 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetCompoundSeparator.cpython-37.pycbin3047 -> 3065 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetDistillationColumn.cpython-37.pycbin4893 -> 4911 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetFlash.cpython-37.pycbin2719 -> 2737 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetMaterialStream.cpython-37.pycbin8308 -> 8326 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetMixer.cpython-37.pycbin1983 -> 2001 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetShortcutColumn.cpython-37.pycbin4417 -> 4435 bytes
-rw-r--r--DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pycbin2501 -> 2519 bytes
-rw-r--r--OMChem/ConvReactor.py3
-rw-r--r--OMChem/Flowsheet.py68
-rw-r--r--OMChem/setup.py2
-rw-r--r--Streams.py4
-rw-r--r--Undo.datbin24066 -> 0 bytes
-rw-r--r--mainApp.py44
-rw-r--r--requirements.txt4
17 files changed, 60 insertions, 152 deletions
diff --git a/Bin_Phase_env.py b/Bin_Phase_env.py
index a63ba1c..d9975fe 100644
--- a/Bin_Phase_env.py
+++ b/Bin_Phase_env.py
@@ -4,16 +4,16 @@ import numpy as np
import os
import csv
from subprocess import Popen, PIPE
+
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
-#import PyQt5.QtGuiApplication
from PyQt5.QtGui import *
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
+from PyQt5.uic import loadUiType
+
+
import pyqtgraph as pg
import pyqtgraph.exporters
@@ -65,7 +65,6 @@ class BinPhaseEnv(QWidget,ui_dialog):
self.points = QLineEdit()
self.points.setText("40")
self.formLayout.addRow(QLabel("Number of data points"),self.points)
- #print("T-XY")
def P_xy(self):
self.radioButton_2.setChecked(True)
@@ -81,7 +80,6 @@ class BinPhaseEnv(QWidget,ui_dialog):
self.points.setText("40")
self.formLayout.addRow(QLabel("T(K)"),self.first)
self.formLayout.addRow(QLabel("Number of data points"),self.points)
- #print("")
def get_omc_path(self):
try:
@@ -97,9 +95,7 @@ class BinPhaseEnv(QWidget,ui_dialog):
print("The OpenModelica compiler is missing in the System path please install it" )
raise
- def plot(self):
- #print(self.type)
-
+ def plot(self):
try:
val = int(self.first.text(),10)
except:
@@ -120,12 +116,6 @@ class BinPhaseEnv(QWidget,ui_dialog):
self.comp2 = self.comboBox_2.currentText()
self.thermoPack = self.comboBox_3.currentText()
- # print(val)
- # print(data_points)
- # print(self.comp1)
- # print(self.comp2)
- # print(self.thermoPack)
-
self.data.append("model Graph\n")
self.data.append("import data = Simulator.Files.Chemsep_Database;\n")
self.data.append("parameter data."+self.comp1+" comp1;\n")
@@ -144,8 +134,6 @@ class BinPhaseEnv(QWidget,ui_dialog):
mosFile.write("loadFile(\"Graph.mo\");\n")
mosFile.write("simulate(Graph, outputFormat=\"csv\", stopTime=1.0, numberOfIntervals=1);\n")
- print(self.data)
-
self.resdata = []
self.omc_path = self.get_omc_path()
simpath = self.plot_mos_path
@@ -164,62 +152,43 @@ class BinPhaseEnv(QWidget,ui_dialog):
self.rows = []
with open (csvpath,'r') as resultFile:
- self.resdata = []
- print("opened")
- csvreader = csv.reader(resultFile,delimiter=',')
- for row in csvreader:
- print("124125")
- self.resdata.append(row)
- self.rows.append(row)
-
- print("SIMULATION DONE")
+ self.resdata = []
+ csvreader = csv.reader(resultFile,delimiter=',')
+ for row in csvreader:
+ self.resdata.append(row)
+ self.rows.append(row)
if self.type=='T':
for k in range(len(self.rows[0])):
if self.rows[0][k][0]=='P':
self.datay.append(float(self.rows[1][k]))
- #print(col)
length = len(self.rows[0][k])
if self.rows[0][k][0]=='x' and self.rows[0][k][length-2]=='1':
self.datax1.append(float(self.rows[1][k]))
- # k+=1
if self.rows[0][k][0]=='y' and self.rows[0][k][length-2]=='1':
self.datax2.append(float(self.rows[1][k]))
- #k+=1
- #k+=1
else:
for k in range(len(self.rows[0])):
if self.rows[0][k][0]=='T':
self.datay.append(float(self.rows[1][k]))
- #print(col)
- #print(self.rows[0][k])
length = len(self.rows[0][k])
if self.rows[0][k][0]=='x' and self.rows[0][k][length-2]=='1':
-
self.datax1.append(float(self.rows[1][k]))
- # k+=1
if self.rows[0][k][0]=='y' and self.rows[0][k][length-2]=='1':
self.datax2.append(float(self.rows[1][k]))
- #k+=1
plt = pg.PlotWidget()
plt.showGrid(x=True,y=True)
plt.addLegend()
plt.setXRange(0,1)
- # print("SIZE UP AHEAD")
- # print(len(self.datay))
- # print(len(self.datax1))
- # print(len(self.datax2))
- # print("SIZES DONE")
c1 = plt.plot(self.datax1, self.datay,pen=pg.mkPen('b',width = 1), name='dew points')
c2 = plt.plot(self.datax2, self.datay,pen=pg.mkPen('r',width = 1), name='bubble points')
view_box = plt.plotItem.vb
self.tool_tip = ""
def press_event(evt):
- #print("HELLO")
a = 10
pos = evt
mousepoint = view_box.mapSceneToView(pos)
@@ -229,7 +198,6 @@ class BinPhaseEnv(QWidget,ui_dialog):
screen = QGuiApplication.primaryScreen()
image = screen.grabWindow(QApplication.desktop().winId()).toImage()
colour = QtGui.QColor(image.pixel(find_color.x(),find_color.y()))
- #print("red:{}, green:{}, blue:{}".format(colour.red(),colour.green(),colour.blue()))
if colour.red()==255 or colour.blue()==255:
self.lineEdit_x.setText(str(round(mousepoint.x(),3)))
@@ -242,31 +210,17 @@ class BinPhaseEnv(QWidget,ui_dialog):
self.tool_tip = ""
QApplication.setOverrideCursor(QCursor(QtCore.Qt.ArrowCursor))
- #self.prev = None
def entered(items):
for i in items:
- #print(i.__class__.__name__)
if i.__class__.__name__ =="LegendItem":
self.lineEdit_x.setText("")
self.lineEdit_y.setText("")
QApplication.setOverrideCursor(QCursor(QtCore.Qt.ArrowCursor))
else:
i.setToolTip(self.tool_tip)
- # print(items)
- #proxy = pg.SignalProxy(plt.scene().sigMouseMoved, rateLimit = 60, slot = press_event)
+
plt.scene().sigMouseMoved.connect(press_event)
plt.scene().sigMouseHover.connect(entered)
- #c1.setAcceptHoverEvents(True)
- #c2.setAcceptHoverEvents(True)
-
- # def hoverEnterEvent(c1,event):
- # print("Object ZONE")
-
- # def hoverEnterEvent(c2,event):
- # print("Object ZONE")
-
- #c1.hoverMoveEvent.connect(item)
- #c2.hoverMoveEvent.connect(item)
plt.setLabel('left',self.other+self.otherunit,units = '')
plt.setLabel('bottom',self.comp1+'(mol. frac.)',units = '')
diff --git a/DockWidgets/DockWidgetMaterialStream.py b/DockWidgets/DockWidgetMaterialStream.py
index a661362..de223c3 100644
--- a/DockWidgets/DockWidgetMaterialStream.py
+++ b/DockWidgets/DockWidgetMaterialStream.py
@@ -52,33 +52,33 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
self.input_params_list()
def input_params_list(self):
- try:
+ try:
for c,i in enumerate(self.input_dict):
if(i=="x_pc"):
noc = len(compound_selected)
print(noc)
self.x_pclist.clear()
-
+
gp = QGroupBox("Mole Fractions")
lay = QGridLayout()
for j in range(noc):
- l = QLineEdit()
+ 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]))
-
+
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)
- self.x_pclist.append(l)
+ self.x_pclist.append(l)
gp.setLayout(lay)
- self.formLayout.addRow(gp)
+ self.formLayout.addRow(gp)
else:
print("elseloop")
l = QLineEdit()
if self.input_dict[i] != None:
l.setText(str(self.input_dict[i]))
-
+
lay = QGridLayout()
lay.addWidget(QLabel(i+":"),0,0, alignment=Qt.AlignLeft)
lay.addWidget(l,0,1, alignment=Qt.AlignCenter)
@@ -87,13 +87,13 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
else:
lay.addWidget(QLabel("mol/s"),0,2, alignment=Qt.AlignCenter)
self.formLayout.addRow(lay)
- self.input_dict[i] = l
+ self.input_dict[i] = l
self.lines = [line.rstrip('\n') for line in open('thermopackage.txt')]
for j in self.lines:
self.cbTP.addItem(str(j))
self.input_dict['Thermo Package'] = self.cbTP
-
+
except Exception as e:
print(e)
@@ -133,6 +133,7 @@ class DockWidgetMaterialStream(QDockWidget,ui_dialog):
break
print("param ", self.dict)
+
self.obj.param_setter(self.dict)
self.hide()
diff --git a/DockWidgets/__pycache__/DockWidget.cpython-37.pyc b/DockWidgets/__pycache__/DockWidget.cpython-37.pyc
index 86045c1..61691e2 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 08716b1..03ba8d4 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 55be9b4..f538f77 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 6828ab1..d8eaa0b 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 a8c9f80..4f5c2cd 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 460aa1b..939df5f 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 13f8328..d057db2 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 fea33a2..7cc065b 100644
--- a/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc
+++ b/DockWidgets/__pycache__/DockWidgetSplitter.cpython-37.pyc
Binary files differ
diff --git a/OMChem/ConvReactor.py b/OMChem/ConvReactor.py
index 9061294..ccdf524 100644
--- a/OMChem/ConvReactor.py
+++ b/OMChem/ConvReactor.py
@@ -12,7 +12,8 @@ class ConvReactor():
self.OM_data_eqn = ''
self.OM_data_init = ''
self.InputStms = []
- self.OutputStms = [] self.Tdef = str(Tdef)
+ self.OutputStms = []
+ self.Tdef = str(Tdef)
self.type = 'ConvReactor'
self.EngStms = EngStms(name="EngStm")
diff --git a/OMChem/Flowsheet.py b/OMChem/Flowsheet.py
index ab4d729..bc218c6 100644
--- a/OMChem/Flowsheet.py
+++ b/OMChem/Flowsheet.py
@@ -1,8 +1,6 @@
-# from OMPython import OMCSession
import os
import csv
from subprocess import Popen, PIPE
-#import subprocess
import pandas as pd
class Flowsheet():
@@ -14,8 +12,8 @@ class Flowsheet():
self.compounds = []
self.interface = ''
self.omc_path = None
- self.root_dir = os.getcwd() # Chemical-Simulator-GUI
- self.sim_dir_path = os.path.join(self.root_dir, self.sim_name) # Chemical-Simulator-GUI/Simulator
+ self.root_dir = os.getcwd() # Chemical-Simulator-GUI
+ self.sim_dir_path = os.path.join(self.root_dir, self.sim_name) # Chemical-Simulator-GUI/Simulator
self.Flomo_path = os.path.join(self.sim_dir_path,'Flowsheet.mo')
self.eqn_mos_path = os.path.join(self.sim_dir_path,'simulateEQN.mos')
self.sm_mos_path = os.path.join(self.sim_dir_path,'simulateSM.mos')
@@ -63,28 +61,21 @@ class Flowsheet():
self.result_data = []
else:
csvpath = os.path.join(self.sim_dir_path,'Flowsheet_res.csv')
- print("csvPath",csvpath)
with open (csvpath,'r') as resultFile:
self.result_data = []
- print("opened")
csvreader = csv.reader(resultFile,delimiter=',')
for row in csvreader:
- print("in reading csvreader")
self.result_data.append(row)
- print(self.result_data)
def send_for_simulation_SM(self,unitop):
self.result_data = []
self.omc_path = self.get_omc_path()
os.chdir(self.sim_dir_path)
- #os.system(self.omc_path + ' -s ' + unitop.name+'.mos')
self.process = Popen([self.omc_path, '-s',unitop.name,'.mos'], stdout=PIPE, stderr=PIPE)
stdout, stderr = self.process.communicate()
- #s = subprocess.check_output([self.omc_path, '-s',simpath])
- #print(s)
- print("############### StdOut ################")
- print(stdout)
+ # print("############### StdOut ################")
+ # print(stdout)
self.result_data = []
print('Simulating '+unitop.name+'...')
csvpath = os.path.join(self.sim_dir_path,unitop.name+'_res.csv')
@@ -102,14 +93,10 @@ class Flowsheet():
if property_name in self.result_data[0]:
ind = self.result_data[0].index(property_name)
resultval = str(self.result_data[-1][ind])
- #resultval = str(omc.sendExpression("val("+unit.name+ "." + value + ", 0.5)"))
- print(resultval)
unit[0].Prop[key] = resultval
def simulate_EQN(self):
self.data = []
- print("##################################################")
- print("##################################################")
self.sim_method = 'Eqn'
self.data.append("model Flowsheet\n")
@@ -124,7 +111,6 @@ class Flowsheet():
else:
self.data.append(unitop.OM_Flowsheet_Initialize(self.compounds))
-
self.data.append("equation\n")
self.outlist = []
@@ -133,11 +119,9 @@ class Flowsheet():
if unitop.type not in self.stm:
for j in unitop.output_stms:
self.outlist.append(j)
- print(j.name)
for unitop in self.unit_operations:
if unitop not in self.outlist:
-
if unitop.type == 'MaterialStream':
self.data.append(unitop.OM_Flowsheet_Equation(self.compounds,'Eqn'))
else:
@@ -160,40 +144,27 @@ class Flowsheet():
self.send_for_simulation_Eqn()
-
def simulate_SM(self,ip,op):
- print("ip op = ", ip, op)
self.sim_method = 'SM'
self.data = []
self.result_data = []
self.unit = []
self.csvlist = []
- print("op list",op)
- print("ip list",ip)
+
for i in ip:
common = ip[i]
- print("common #############3",common)
- print("*********** i *********",i)
+
for k,v in op.items():
- print("Print K",k)
if(set(v) & set(common)):
- print("*****************common MaterialStream***************")
if((i in self.unit) and (k in self.unit)):
- print("both exist")
pass
elif(i in self.unit):
- print("output exist")
self.unit.insert(self.unit.index(i),k)
elif(k in self.unit):
- print("input exists")
self.unit.append(i)
else:
- print("nothing exists")
self.unit.append(k)
self.unit.append(i)
- print("##############################33")
- print(self.unit)
- print("################################11")
for unitop in self.unit:
os.chdir(self.root_dir)
@@ -214,7 +185,6 @@ class Flowsheet():
lcase = c.lower()
self.data.append("parameter Simulator.Files.Chemsep_Database." + ucase +' '+ ucase + "; \n")
- print("##############compounds added")
self.data.append(unitop.OM_Flowsheet_Initialize())
if type(outstms) is list:
@@ -223,7 +193,6 @@ class Flowsheet():
else:
self.data.append(outstms.OM_Flowsheet_Initialize())
-
if engstms:
self.data.append(engstms.OM_Flowsheet_Initialize())
@@ -234,18 +203,14 @@ class Flowsheet():
self.data.append(inpstms.OM_Flowsheet_Initialize())
self.data.append('equation\n')
- print("##################equation")
self.data.append(unitop.OM_Flowsheet_Equation())
if type(inpstms) is list:
for stm in inpstms:
- #stm.GetEquationValues()
self.data.append(stm.OM_Flowsheet_Equation())
else:
- #inpstms.GetEquationValues()
self.data.append(inpstms.OM_Flowsheet_Equation())
- # os.chdir(self.sim_dir_path)
unitmofile = os.path.join(self.sim_dir_path,unitop.name.lower()+'.mo')
with open(unitmofile,'w') as unitFile:
@@ -262,22 +227,18 @@ class Flowsheet():
mosFile.write("simulate("+unitop.name.lower()+", outputFormat=\"csv\", stopTime=1.0, numberOfIntervals=1);\n")
print("Initiating simulation in Sequential Modular Mode")
- #self.result_data = []
self.omc_path = self.get_omc_path()
os.chdir(self.sim_dir_path)
- #os.system(self.omc_path + ' -s ' + unitop[0].name.lower()+"SEQ"+'.mos')
- print("SIM directory Path 1 ###",self.sim_dir_path)
sim = os.path.join(self.sim_dir_path,unitop.name.lower()+'.mos')
self.process = Popen([self.omc_path, '-s',sim], stdout=PIPE, stderr=PIPE)
self.stdout, self.stderr = self.process.communicate()
os.chdir(self.root_dir)
- #s = subprocess.check_output([self.omc_path, '-s',simpath])
- #print(s)
- print("############### StdOut ################")
- print(self.stdout)
- print("############### StdErr ################")
- print(self.stderr)
- print('Simulating '+unitop.name.lower()+'...')
+
+ # print("############### StdOut ################")
+ # print(self.stdout)
+ # print("############### StdErr ################")
+ # print(self.stderr)
+ # print('Simulating '+unitop.name.lower()+'...')
csvpath = os.path.join(self.sim_dir_path,unitop.name.lower()+'_res.csv')
self.csvlist.append(csvpath)
@@ -296,8 +257,6 @@ class Flowsheet():
ind = self.result_data[0].index(property_name)
resultval = str(self.result_data[-1][ind])
stm.Prop[key] = resultval
- #print("input",stm.Prop[key])
-
else:
for key, value in inpstms.Prop.items():
property_name = inpstms.name + '.' + key
@@ -305,7 +264,6 @@ class Flowsheet():
ind = self.result_data[0].index(property_name)
resultval = str(self.result_data[-1][ind])
inpstms.Prop[key] = resultval
- #print("input",inpstms.Prop[key])
if type(outstms) is list:
for stm in outstms:
@@ -315,7 +273,6 @@ class Flowsheet():
ind = self.result_data[0].index(property_name)
resultval = str(self.result_data[-1][ind])
stm.Prop[key] = resultval
- print("output key:",key,"value:",stm.Prop[key])
else:
for key, value in outstms.Prop.items():
property_name = outstms.name + '.' + key
@@ -323,7 +280,6 @@ class Flowsheet():
ind = self.result_data[0].index(property_name)
resultval = str(self.result_data[-1][ind])
outstms.Prop[key] = resultval
- print("output key:",key,"value:",outstms.Prop[key])
self.dataframes = [pd.read_csv(i) for i in self.csvlist]
os.chdir(self.sim_dir_path)
diff --git a/OMChem/setup.py b/OMChem/setup.py
index 765aa04..037da1c 100644
--- a/OMChem/setup.py
+++ b/OMChem/setup.py
@@ -31,7 +31,7 @@ def generateIDL():
warningOrError(errorOnFailure, "Path not found: %s" % idl)
return
- if 0<>call(["omniidl","-bpython","-Wbglobal=_OMCIDL","-Wbpackage=OMPythonIDL",idl]):
+ if 0 is not call(["omniidl","-bpython","-Wbglobal=_OMCIDL","-Wbpackage=OMPythonIDL",idl]):
warningOrError(errorOnFailure, "omniidl command failed")
return
print("Generated OMPythonIDL files")
diff --git a/Streams.py b/Streams.py
index 2142e8f..d9b939e 100644
--- a/Streams.py
+++ b/Streams.py
@@ -114,9 +114,9 @@ class MaterialStream():
return dict
def param_setter(self,dict):
-
self.variables['x_pc']['value'] = dict['x_pc'].split(",")
- self.thermo_package = dict['Thermo package']
+ print('xpc is :' + str(self.variables['x_pc']['value']))
+ self.thermo_package = dict['Thermo Package']
self.variables['F_p[1]']['value'] = dict['MolFlow']
self.variables[self.mode1]['value'] = dict[self.mode1]
self.variables[self.mode2]['value'] = dict[self.mode2]
diff --git a/Undo.dat b/Undo.dat
index 80038db..e69de29 100644
--- a/Undo.dat
+++ b/Undo.dat
Binary files differ
diff --git a/mainApp.py b/mainApp.py
index e2328dd..adf132c 100644
--- a/mainApp.py
+++ b/mainApp.py
@@ -1,31 +1,25 @@
-from functools import partial
-from collections import defaultdict
+import pickle
+import threading
+import os
+import ctypes
import sys
-import numpy as np
-from OMChem.Flowsheet import Flowsheet
-import pandas as pd
+import datetime
+from functools import partial
+
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, QUndoStack
-from PyQt5.QtGui import QBrush ,QTransform ,QMouseEvent
+from PyQt5.QtGui import *
import PyQt5.QtGui as QtGui
import PyQt5.QtCore as QtCore
import PyQt5.QtWidgets as QtWidgets
+
+from OMChem.Flowsheet import Flowsheet
from ComponentSelector import *
from Bin_Phase_env import *
from UnitOperations import *
from Streams import *
-import datetime
from Container import *
from Graphics import *
-import pickle
-import threading
-import os
-import ctypes
-import sys
ui,_ = loadUiType('main.ui')
@@ -51,7 +45,7 @@ class MainApp(QMainWindow,ui):
self.comp = ComponentSelector(self)
# Setting up interactive canvas
- self.scene = self.container.graphics.get_scene() ###
+ self.scene = self.container.graphics.get_scene()
self.graphicsView.setScene(self.scene)
self.graphicsView.setMouseTracking(True)
self.graphicsView.keyPressEvent=self.delete_call
@@ -128,14 +122,14 @@ class MainApp(QMainWindow,ui):
msgBox.setStandardButtons(QMessageBox.Ok)
msgBox.exec_()
+ '''
+ Creates Binary Phase envelope
+ '''
def bin_phase_env(self):
- #compounds = self.comp.getComp()
if len(self.comp.get_compounds())<2:
QMessageBox.about(self, 'Important', "Please select at least 2 Compounds first")
self.comp.show()
- #compunds = self.comp.getComp()
else:
-
self.bin_phase = BinPhaseEnv(self.comp)
self.bin_phase.show()
@@ -162,6 +156,9 @@ class MainApp(QMainWindow,ui):
self.thrd = threading.Thread(target=self.container.simulate, args=(mode,))
self.thrd.start()
+ '''
+ Terminate the current running simulation
+ '''
def terminate(self):
os.chdir(self.container.flowsheet.root_dir)
if self.thrd:
@@ -235,8 +232,6 @@ class MainApp(QMainWindow,ui):
try:
if event.key() == QtCore.Qt.Key_Delete:
l=self.scene.selectedItems()
- # for i in l:
- # eval(i.type).counter -= 1
self.container.delete(l)
except Exception as e:
print(e)
@@ -312,9 +307,8 @@ class MainApp(QMainWindow,ui):
file_name, _ = QFileDialog.getSaveFileName(self, "Save As",
initial_path, "%s Files (*.%s);; All Files (*)" %
(file_format.upper(), file_format))
- #if file_name != "":
try:
- with open(file_name, 'wb') as f: #'saved_file.sim'
+ with open(file_name, 'wb') as f:
pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
except Exception as e:
pass
@@ -330,8 +324,6 @@ class MainApp(QMainWindow,ui):
file_name, _ = QFileDialog.getOpenFileName(self, "Open As",
initial_path, "%s Files (*.%s);; All Files (*)" %
(file_format.upper(), file_format))
- # if fileName != "":
- # self.new()
self.undo_redo_helper()
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..14e451a
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,4 @@
+pyqtgraph==0.10.0
+pandas==1.0.1
+numpy==1.17.3
+PyQt5==5.15.1