diff options
-rw-r--r-- | container.py | 27 | ||||
-rw-r--r-- | main.ui | 13 | ||||
-rw-r--r-- | mainApp.py | 4 |
3 files changed, 28 insertions, 16 deletions
diff --git a/container.py b/container.py index 89fb897..4211ed9 100644 --- a/container.py +++ b/container.py @@ -13,6 +13,7 @@ class Container(): self.unitOp = [] self.thermoPackage = None self.compounds = None + self.flowsheet = None self.conn = defaultdict(list) self.op=defaultdict(list) self.ip=defaultdict(list) @@ -71,14 +72,14 @@ class Container(): except Exception as e: print(e) - def msgBrowser(self,f): - std = f.stdout.decode("utf-8") + def msgBrowser(self): + std = self.flowsheet.stdout.decode("utf-8") if(std): stdout = str(std) stdout = stdout.replace("\n","<br/>") self.msg.append("<span style=\"color:green\">"+stdout+"</span>") - stde = f.stderr.decode("utf-8") + stde = self.flowsheet.stderr.decode("utf-8") if(stde): stdout = str(stde) stdout = stdout.replace("\n","<br/>") @@ -88,26 +89,26 @@ class Container(): print(mode) self.compounds = compound_selected self.connection() - f = Flowsheet() - f.add_comp_list(self.compounds) + self.flowsheet = Flowsheet() + self.flowsheet.add_comp_list(self.compounds) print("######## connection master#########\n",self.conn) for i in self.unitOp : if i in self.opl: print("here",i) - f.add_UnitOpn(i,1) + self.flowsheet.add_UnitOpn(i,1) else: - f.add_UnitOpn(i,0) + self.flowsheet.add_UnitOpn(i,0) if mode=='SM': self.msg.append("<span>["+str(self.currentTime())+"] Simulating in <b>Sequential</b> mode ... </span>") - f.simulateSM(self.ip,self.op) - self.msgBrowser(f) - self.result=f.resdata + self.flowsheet.simulateSM(self.ip,self.op) + self.msgBrowser() + self.result=self.flowsheet.resdata print("under SEQ mode simulation") elif mode=='EQN': self.msg.append("<span>["+str(self.currentTime())+"] Simulating in <b>equation</b> mode ... </span>") - f.simulateEQN() - self.msgBrowser(f) - self.result=f.resdata + self.flowsheet.simulateEQN() + self.msgBrowser() + self.result=self.flowsheet.resdata print("under Eqn mode simulation") def flatlist(lst): @@ -148,7 +148,7 @@ <x>0</x> <y>0</y> <width>1068</width> - <height>21</height> + <height>26</height> </rect> </property> <widget class="QMenu" name="menuFile"> @@ -178,6 +178,8 @@ </property> <addaction name="actionEquation_oriented"/> <addaction name="actionSequential_mode"/> + <addaction name="separator"/> + <addaction name="actionTerminate"/> </widget> <widget class="QMenu" name="menuComponds"> <property name="title"> @@ -256,8 +258,8 @@ <rect> <x>0</x> <y>0</y> - <width>221</width> - <height>956</height> + <width>222</width> + <height>978</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_5"> @@ -1194,6 +1196,11 @@ <string>Open</string> </property> </action> + <action name="actionTerminate"> + <property name="text"> + <string>Terminate</string> + </property> + </action> </widget> <resources/> <connections/> @@ -104,6 +104,7 @@ class MainApp(QMainWindow,ui): # self.actionRedo.triggered.connect(self.undoStack.redo) self.actionSave_2.triggered.connect(self.save) self.actionOpen.triggered.connect(self.open) + self.actionTerminate.triggered.connect(self.terminate) ''' Handles all the buttons of different components. @@ -162,6 +163,9 @@ class MainApp(QMainWindow,ui): self.addDockWidget(Qt.LeftDockWidgetArea, self.res) self.res.show() + def terminate(self): + print('----------------------------terminate called-----------------------------') + ''' Resets the zoom level to default scaling ''' |