diff options
author | Sunil Shetye | 2019-06-13 13:11:14 +0530 |
---|---|---|
committer | GitHub | 2019-06-13 13:11:14 +0530 |
commit | cfc34bb19977e738582620802415ccde27a03039 (patch) | |
tree | daaace10133835956619b401aca9c252e3e789bc /src/projManagement/Worker.py | |
parent | 25c6eddcea3c8a62d9750a78435454544d8c7b14 (diff) | |
parent | 20b23a7934f7cf01cd5b4353ddd2e008b40e5ffd (diff) | |
download | eSim-cfc34bb19977e738582620802415ccde27a03039.tar.gz eSim-cfc34bb19977e738582620802415ccde27a03039.tar.bz2 eSim-cfc34bb19977e738582620802415ccde27a03039.zip |
Merge pull request #86 from nilshah98/documentation
Documentation added and minor fixes
Diffstat (limited to 'src/projManagement/Worker.py')
-rw-r--r-- | src/projManagement/Worker.py | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/src/projManagement/Worker.py b/src/projManagement/Worker.py index 65c67dde..f40fd724 100644 --- a/src/projManagement/Worker.py +++ b/src/projManagement/Worker.py @@ -19,23 +19,70 @@ from PyQt4 import QtCore import subprocess from configuration.Appconfig import Appconfig +""" +WorkerThread uses QThread to support threading operations for +other PyQT windows +This is a helper functions, used to create threads for various commands +""" + class WorkerThread(QtCore.QThread): """ - This is Thread class use to run the command + Initialise a QThread with the passed arguments + + @params + :args => takes a space separated string of comamnds to be execute + in different child processes (see subproces.Popen()) + + @return + None """ def __init__(self, args): QtCore.QThread.__init__(self) self.args = args + """ + __del__ is a called whenever garbage collection is initialised + Here, it waits (self.wait()) for the thread to finish executing + before garbage collecting it + + @params + + @return + None + """ + def __del__(self): self.wait() + """ + run is the function that is called, when we start the thread as + thisThread.start() + Here, it makes system calls for all args passed (self.args) + + @params + + @return + None + """ + def run(self): print("Worker Thread Calling Command :", self.args) self.call_system(self.args) + """ + call_system is used to create childprocess for the passed arguments + (self.args) and also pass the process created and its id to config file + Apponfig() object contains procThread and proc_dist used to + track processes called + + @params + :command => (self.args) takes space separated string of comamnds to + be executed in different child processes + (see subproces.Popen()) + """ + def call_system(self, command): procThread = Appconfig() proc = subprocess.Popen(command.split()) |