aboutsummaryrefslogtreecommitdiff
path: root/inputs
diff options
context:
space:
mode:
authorGravatar rcoh <rcoh@mit.edu>2010-12-20 14:50:08 -0500
committerGravatar rcoh <rcoh@mit.edu>2010-12-20 14:50:08 -0500
commit2736307c1d6d67868ca54a3df951f9e959efedd0 (patch)
tree50a61c798d52987f8fe575f678aaff5b5b9455b9 /inputs
parent7386cbc7ce48e3996d92d84cff3d1a4dab8f538d (diff)
Util cleanup is done! Util.py is now refactored into the util module. Woo! RCOH
Diffstat (limited to 'inputs')
-rw-r--r--inputs/PygameInput.py7
-rw-r--r--inputs/TCPInput.py3
2 files changed, 6 insertions, 4 deletions
diff --git a/inputs/PygameInput.py b/inputs/PygameInput.py
index 1f438d6..f69d0f5 100644
--- a/inputs/PygameInput.py
+++ b/inputs/PygameInput.py
@@ -1,4 +1,5 @@
import time, Util
+import util.Strings as Strings
from operationscore.Input import *
import pygame
from pygame.locals import *
@@ -8,13 +9,13 @@ class PygameInput(Input):
def sensingLoop(self):
#try:
if self['FollowMouse']:
- self.respond({Util.location: pygame.mouse.get_pos()})
+ self.respond({Strings.LOCATION: pygame.mouse.get_pos()})
return
for event in pygame.event.get():
if event.type is KEYDOWN:
- self.respond({Util.location: (5,5),'Key': event.key})
+ self.respond({Strings.LOCATION: (5,5),'Key': event.key})
if event.type is MOUSEBUTTONDOWN:
- self.respond({Util.location: pygame.mouse.get_pos()})
+ self.respond({Strings.LOCATION: pygame.mouse.get_pos()})
#except:
#raise Exception('Pygame not initialized. Pygame must be \
#initialized.')
diff --git a/inputs/TCPInput.py b/inputs/TCPInput.py
index acd6243..9f62825 100644
--- a/inputs/TCPInput.py
+++ b/inputs/TCPInput.py
@@ -1,4 +1,5 @@
import Util
+import util.Strings as Strings
from operationscore.Input import *
import socket, json, time
class TCPInput(Input):
@@ -25,7 +26,7 @@ class TCPInput(Input):
if self.IS_RESPONDING == 1: # if 'responding', respond to the received data
dataDict = json.loads(data)
# socketDict = {'data':dataDict, 'address':self.address}
- socketDict = {Util.location: (100 * (1 - dataDict['x'] / 10), 25 * (1 + dataDict['y'] / 10))} # like PygameInput
+ socketDict = {Strings.LOCATION: (100 * (1 - dataDict['x'] / 10), 25 * (1 + dataDict['y'] / 10))} # like PygameInput
self.respond(socketDict)
else: