aboutsummaryrefslogtreecommitdiff
path: root/operationscore/Input.py
diff options
context:
space:
mode:
authorGravatar Thomas B Thompson <tbent@spice.(none)>2011-01-10 22:23:49 -0500
committerGravatar Thomas B Thompson <tbent@spice.(none)>2011-01-10 22:23:49 -0500
commitbb1d982669c44a990ffc926f4666b6aa72237619 (patch)
treeb3d3e3e48423d89658cc11608d17bbee5d92a8d8 /operationscore/Input.py
parent21e961d8074570cca27b2661582d728be85b18b9 (diff)
Worked on getting the threading stuff consolidated in ThreadedSmootCoreObject. Also set up a decent system for SmootCoreObjects to kill the whole application in a managed fashion.
Diffstat (limited to 'operationscore/Input.py')
-rw-r--r--operationscore/Input.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/operationscore/Input.py b/operationscore/Input.py
index 3dd74cf..2ee3c3c 100644
--- a/operationscore/Input.py
+++ b/operationscore/Input.py
@@ -11,28 +11,28 @@ import pdb
class Input(ThreadedSmootCoreObject):
#Event scope is a function pointer the function that will get called when
#an Parent is raised.
- def __init__(self, argDict):
+ def init(self):
self.eventQueue = []
- self.parentScope = argDict['parentScope']
- self.argDict = argDict
- if not 'RefreshInterval' in argDict:
+ if not 'RefreshInterval' in self.argDict:
print 'RefreshInterval not defined. Defaulting to .5s.'
self.argDict['RefreshInterval'] = 500
+ self.parentScope = self.argDict['parentScope']
self.inputInit()
- threading.Thread.__init__(self)
- self.daemon = True #This kills this thread when the main thread stops
+
def respond(self, eventDict):
#if eventDict != []:
self.parentScope.lock.acquire()
self.parentScope.processResponse(self.argDict, eventDict)
self.parentScope.lock.release()
time.sleep(.001)
+
def parentAlive(self):
try:
parentAlive = self.parentScope.alive()
return parentAlive
except:
return False
+
def run(self):
while 1:
try:
@@ -43,8 +43,10 @@ class Input(ThreadedSmootCoreObject):
self.acquireLock()
self.sensingLoop()
self.releaseLock()
+
def sensingLoop(self):
pass
+
def inputInit(self):
pass