From 68c0ed4e6bb6659928423ea7363ed2f28fbdd4ca Mon Sep 17 00:00:00 2001
From: athulappadan
Date: Fri, 10 Apr 2015 12:17:58 +0530
Subject: Exit method modified
---
src/configuration/Appconfig.py | 6 +++---
src/frontEnd/Application.py | 22 ++++++++++++++--------
src/projManagement/Worker.py | 14 ++++++--------
3 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/src/configuration/Appconfig.py b/src/configuration/Appconfig.py
index 5735534b..a5dfa546 100644
--- a/src/configuration/Appconfig.py
+++ b/src/configuration/Appconfig.py
@@ -20,7 +20,8 @@
from PyQt4 import QtGui
import os
-
+global procThread_list # keeps tracking all the processes called
+procThread_list = []
class Appconfig(QtGui.QWidget):
"""
@@ -33,8 +34,7 @@ class Appconfig(QtGui.QWidget):
current_project = {"ProjectName":None}
#Workspace detail
workspace_text = '''ecSim stores your project in a folder called a workspace. You can choose a different workspace folder to use for this session.'''
-
-
+ procThread_list = []
def __init__(self):
super(Appconfig, self).__init__()
diff --git a/src/frontEnd/Application.py b/src/frontEnd/Application.py
index 1d6b4f03..2863ed6c 100755
--- a/src/frontEnd/Application.py
+++ b/src/frontEnd/Application.py
@@ -27,6 +27,7 @@ import ViewManagement
import Workspace
import sys
import time
+import subprocess
class Application(QtGui.QMainWindow):
@@ -57,21 +58,20 @@ class Application(QtGui.QMainWindow):
def initActions(self):
-
- self.newproj = QtGui.QAction(QtGui.QIcon('../images/newProject.png'),'New Project',self)
+
+ self.newproj = QtGui.QAction(QtGui.QIcon('../images/newProject.svg'),'New Project',self)
self.newproj.setShortcut('Ctrl+N')
self.newproj.triggered.connect(self.new_project)
-
- self.openproj = QtGui.QAction(QtGui.QIcon('../images/openProject.png'),'Open Project',self)
+ self.openproj = QtGui.QAction(QtGui.QIcon('../images/openProject.svg'),'Open Project',self)
self.openproj.setShortcut('Ctrl+O')
self.openproj.triggered.connect(self.open_project)
- self.exitproj = QtGui.QAction(QtGui.QIcon('../images/closeProject.png'),'Exit',self)
+ self.exitproj = QtGui.QAction(QtGui.QIcon('../images/closeProject.svg'),'Exit',self)
self.exitproj.setShortcut('Ctrl+X')
self.exitproj.triggered.connect(self.exit_project)
- self.helpfile = QtGui.QAction(QtGui.QIcon('../images/helpProject.png'),'Help',self)
+ self.helpfile = QtGui.QAction(QtGui.QIcon('../images/default.png'),'Help',self)
self.helpfile.setShortcut('Ctrl+H')
self.helpfile.triggered.connect(self.help_project)
@@ -106,7 +106,13 @@ class Application(QtGui.QMainWindow):
def exit_project(self):
print "Exit Project called"
- self.destroy()
+ for proc in self.obj_appconfig.procThread_list:
+ try:
+ proc.terminate()
+ except:
+ pass
+ self.project.close()
+ self.close()
def help_project(self):
print "Help is called"
@@ -125,7 +131,7 @@ def main(args):
It is main function of the module.It starts the application
"""
print "Hello Main"
- app = QtGui.QApplication(args)
+ app = QtGui.QApplication(sys.argv)
"""
splash_pix = QtGui.QPixmap('../images/FreeEDAlogo.jpg')
diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py
index 58078b86..d31ba7c3 100644
--- a/src/projManagement/Worker.py
+++ b/src/projManagement/Worker.py
@@ -16,15 +16,15 @@
# REVISION: ---
#===============================================================================
from PyQt4 import QtCore
-import os
+import subprocess
+from configuration.Appconfig import Appconfig
class WorkerThread(QtCore.QThread):
def __init__(self,args):
QtCore.QThread.__init__(self)
self.args = args
- '''
- #Not Required
+
def __del__(self):
self.wait()
@@ -35,10 +35,8 @@ class WorkerThread(QtCore.QThread):
def call_system(self,command):
print "System called"
- try:
- os.system(command)
- print "PID",os.getpid()
- except:
- print "Unable to run the command"
+ procThread = Appconfig()
+ proc = subprocess.Popen(command)
+ procThread.procThread_list.append(proc)
\ No newline at end of file
--
cgit