diff options
-rw-r--r-- | Container.py | 35 | ||||
-rw-r--r-- | Undo.dat | bin | 61657 -> 0 bytes | |||
-rw-r--r-- | icons/stop.png | bin | 0 -> 5514 bytes | |||
-rw-r--r-- | main.ui | 18 | ||||
-rw-r--r-- | mainApp.py | 11 |
5 files changed, 46 insertions, 18 deletions
diff --git a/Container.py b/Container.py index 8bb1b1d..5e6836c 100644 --- a/Container.py +++ b/Container.py @@ -119,12 +119,9 @@ class Container(): self.msg.append("<span style=\"color:red\">"+stdout+"</span>") def simulate(self,mode): - self.graphicsView.parent().parent().menubar.setProperty('enabled',False) - self.graphicsView.parent().parent().toolBar.setProperty('enabled',False) - self.graphicsView.parent().parent().dockWidget.setProperty('enabled',False) - self.graphicsView.setInteractive(False) - QApplication.instance().setOverrideCursor(QCursor(Qt.WaitCursor)) + self.disableInterfaceforSimulation(True) + for i in self.graphics.scene.items(): if (isinstance(i, NodeItem)): try: @@ -170,13 +167,29 @@ class Container(): no_output_lines = len(i.output[0].out_lines) if(no_input_lines>0): #Checks if material stream is input or output stream if it is output stream it continues i.obj.disableInputDataTab(i.dock_widget) + + self.disableInterfaceforSimulation(False) + + def enableToolbar(self,status): + self.graphicsView.parent().parent().actionNew.setProperty('enabled',status) + self.graphicsView.parent().parent().actionZoomIn.setProperty('enabled',status) + self.graphicsView.parent().parent().actionZoomOut.setProperty('enabled',status) + self.graphicsView.parent().parent().actionResetZoom.setProperty('enabled',status) + self.graphicsView.parent().parent().actionEquationOriented.setProperty('enabled',status) + self.graphicsView.parent().parent().actionTerminate.setProperty('enabled',not status) + self.graphicsView.parent().parent().actionSelectCompounds.setProperty('enabled',status) + + def disableInterfaceforSimulation(self,status): + self.graphicsView.parent().parent().menubar.setProperty('enabled',not status) + self.enableToolbar(not status) + self.graphicsView.parent().parent().dockWidget.setProperty('enabled',not status) + self.graphicsView.setInteractive(not status) + if status: + QApplication.instance().setOverrideCursor(QCursor(Qt.WaitCursor)) + else: + QApplication.instance().restoreOverrideCursor() + QApplication.instance().setOverrideCursor(QCursor(Qt.ArrowCursor)) - self.graphicsView.parent().parent().menubar.setProperty('enabled',True) - self.graphicsView.parent().parent().toolBar.setProperty('enabled',True) - self.graphicsView.parent().parent().dockWidget.setProperty('enabled',True) - self.graphicsView.setInteractive(True) - QApplication.instance().restoreOverrideCursor() - QApplication.instance().setOverrideCursor(QCursor(Qt.ArrowCursor)) def flat_list(lst): flat_lst=[] for sublist in lst: Binary files differdiff --git a/icons/stop.png b/icons/stop.png Binary files differnew file mode 100644 index 0000000..d365d34 --- /dev/null +++ b/icons/stop.png @@ -115,7 +115,7 @@ </property> <property name="minimumSize"> <size> - <width>0</width> + <width>89</width> <height>150</height> </size> </property> @@ -2025,6 +2025,8 @@ <addaction name="actionEquationOriented"/> <addaction name="actionSequentialMode"/> <addaction name="separator"/> + <addaction name="actionTerminate"/> + <addaction name="separator"/> <addaction name="actionSelectCompounds"/> </widget> <action name="actionZoomIn"> @@ -2075,6 +2077,18 @@ <string>Sequential mode</string> </property> </action> + <action name="actionTerminate"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="icon"> + <iconset> + <normaloff>Icons/stop.png</normaloff>Icons/stop.png</iconset> + </property> + <property name="text"> + <string>Stop Simulation</string> + </property> + </action> <action name="actionSelectCompounds"> <property name="icon"> <iconset> @@ -2115,7 +2129,7 @@ </action> <action name="actionTerminate"> <property name="text"> - <string>Terminate</string> + <string>Stop Simulation</string> </property> </action> <action name="actionUndo"> @@ -173,16 +173,17 @@ class MainApp(QMainWindow,ui): os.chdir(self.container.flowsheet.root_dir) if self.thrd: thread_id = self.thrd.ident - print('____________________Going to terminate simulation thread with Thread ID:',thread_id,'____________________') - print('____________________Going to terminate the new process created for omc____________________') + # print('____________________Going to terminate simulation thread with Thread ID:',thread_id,'____________________') + # print('____________________Going to terminate the new process created for omc____________________') self.container.flowsheet.process.terminate() print('____________________New process created for omc is terminated.____________________') res = ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id, ctypes.py_object(SystemExit)) - self.textBrowser.append("<span style=\"color:red\">["+str(self.current_time())+"]<b> Terminating the simulation </b></span>") - print('____________________Simulation thread terminated____________________') + self.textBrowser.append("<span style=\"color:red\">["+str(self.current_time())+"]<b>Simulation Terminated.</b></span>") + self.container.disableInterfaceforSimulation(False) + # print('____________________Simulation thread terminated____________________') if res > 1: ctypes.pythonapi.PyThreadState_SetAsyncExc(thread_id, 0) - print('Exception raise (Thread termination) failure') + # print('Exception raise (Thread termination) failure') ''' Resets the zoom level to default scaling |