summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--OMChem/Flowsheet.py12
-rw-r--r--mainApp.py6
2 files changed, 11 insertions, 7 deletions
diff --git a/OMChem/Flowsheet.py b/OMChem/Flowsheet.py
index cfd9bae..0cf870a 100644
--- a/OMChem/Flowsheet.py
+++ b/OMChem/Flowsheet.py
@@ -14,8 +14,8 @@ class Flowsheet():
self.compounds = []
self.interface = ''
self.omc_path = None
- self.curr_path = os.getcwd() # Chemical-Simulator-GUI
- self.sim_dir_path = os.path.join(self.curr_path, 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')
@@ -61,7 +61,7 @@ class Flowsheet():
#print(s)
#print("############### StdOut ################")
print(self.stdout)
- os.chdir(self.curr_path)
+ os.chdir(self.root_dir)
#os.system(self.omc_path + ' -s ' + simpath)
print("Hello")
if self.sim_method == 'Eqn':
@@ -297,7 +297,7 @@ class Flowsheet():
print("################################11")
for unitop in self.unit:
- os.chdir(self.curr_path)
+ os.chdir(self.root_dir)
self.data = []
if unitop.type not in ['MatStm','EngStm']:
inpstms = unitop.InputStms
@@ -379,7 +379,7 @@ class Flowsheet():
sim = os.path.join(self.sim_dir_path,unitop.name.lower()+'.mos')
process = Popen([self.omc_path, '-s',sim], stdout=PIPE, stderr=PIPE)
self.stdout, self.stderr = process.communicate()
- os.chdir(self.curr_path)
+ os.chdir(self.root_dir)
#s = subprocess.check_output([self.omc_path, '-s',simpath])
#print(s)
print("############### StdOut ################")
@@ -396,7 +396,7 @@ class Flowsheet():
for row in csvreader:
self.resdata.append(row)
- os.chdir(self.curr_path)
+ os.chdir(self.root_dir)
if type(inpstms) is list:
for stm in inpstms:
for key, value in stm.Prop.items():
diff --git a/mainApp.py b/mainApp.py
index 3be6c08..d169c64 100644
--- a/mainApp.py
+++ b/mainApp.py
@@ -27,6 +27,7 @@ import datetime
from container import Container
from Graphics import Graphics
import pickle
+import threading
ui,_ = loadUiType('main.ui')
@@ -51,6 +52,7 @@ class MainApp(QMainWindow,ui):
# Initializing attributes
self.zoomcount = 0
+ self.thrd = None
# Creating instances of classes for the main app
self.Container = Container(self.textBrowser)
@@ -152,7 +154,9 @@ class MainApp(QMainWindow,ui):
selected by the user.
'''
def simulate(self,mode):
- self.Container.simulate(mode)
+ self.thrd = threading.Thread(target=self.Container.simulate, args=(mode,))
+ self.thrd.start()
+ # self.Container.simulate(mode)
self.dockWidget_2.show()
self.res = resdockWidget(self.Container)
self.addDockWidget(Qt.LeftDockWidgetArea, self.res)