commit d2dedb178d5d23dde64a73fb8db6121b9b039f79
Author: Alex <azirbel@andrew.cmu.edu>
Date:   Sun Feb 3 15:53:01 2013 -0500

    Bugfix to BehaviorGUI causing crashes.

diff --git a/scout/scoutsim/BehaviorGUI.py b/scout/scoutsim/BehaviorGUI.py
index 7135d05..6c5151a 100755
--- a/scout/scoutsim/BehaviorGUI.py
+++ b/scout/scoutsim/BehaviorGUI.py
@@ -7,6 +7,7 @@ import string
 import subprocess
 import signal
 from collections import defaultdict
+
 # ROS imports
 import roslib; roslib.load_manifest("scoutsim")
 import rospy
@@ -37,54 +38,55 @@ def GetBehaviors():
         "Scheduler", "Warehouse", "Line Follow", "WL Test"]
 
 def SetBehavior(name, behaviorLabel, behaviorButton=False, behavior="Pause", selectedBehavior="Pause"):
-	if behavior == "Pause":
-		if name not in processes:
-			return False
-		if not behaviorButton.GetValue():
-			processes[name] = subprocess.Popen("rosrun libscout libscout " 
-					+ name + " " + str(GetBehaviors().index(selectedBehavior) + 1) 
-					+ "", shell=True)
-			print "Scout " + name + " was resumed."
-			behaviorButton.SetLabel("Pause")
-			behaviorLabel.SetLabel("  |  Current Behavior: " + scouts[name])
-			return True
+    if behavior == "Pause":
+        if name not in processes:
+            return False
+        if not behaviorButton.GetValue():
+            processes[name] = subprocess.Popen("rosrun libscout libscout " 
+                    + name + " " + str(GetBehaviors().index(selectedBehavior) + 1) 
+                    + "", shell=True)
+            print "Scout " + name + " was resumed."
+            behaviorButton.SetLabel("Pause")
+            behaviorLabel.SetLabel("  |  Current Behavior: " + scouts[name])
+            return True
         else:
-			processes[name].terminate()
-			del processes[name]
-			subprocess.Popen("rosrun libscout libscout " + name + " 0", shell=True) 
-			print "Scout "+name+" was paused."
-			behaviorButton.SetLabel("Resume")
-			behaviorLabel.SetLabel("  |  Current Behavior: Paused")
-			return True
-	if name in processes:
-		processes[name].terminate()
+            if name in processes:
+                processes[name].terminate()
+                del processes[name]
+            subprocess.Popen("rosrun libscout libscout " + name + " 0", shell=True) 
+            print "Scout "+name+" was paused."
+            behaviorButton.SetLabel("Resume")
+            behaviorLabel.SetLabel("  |  Current Behavior: Paused")
+            return True
+    if name in processes:
+        processes[name].terminate()
         # TODO Running a new behavior while paused does not do anything and
         # Gives lots of errors.
-	#
-	# -- Matt 11/30 --
-	# Might be fixed, can't run it to tell.
-	processes[name] = subprocess.Popen("rosrun libscout libscout " + name + " "
-			+ str(GetBehaviors().index(behavior) + 1) + "",
-		shell=True) 
-	behaviorButton.SetValue(False)
-	behaviorButton.SetLabel("Pause")
-	print "Scout " + name + " was set to behavior: " + behavior
-	behaviorLabel.SetLabel("  |  Current Behavior: " + behavior)
-	scouts[name] = behavior
+    #
+    # -- Matt 11/30 --
+    # Might be fixed, can't run it to tell.
+    processes[name] = subprocess.Popen("rosrun libscout libscout " + name + " "
+            + str(GetBehaviors().index(behavior) + 1) + "",
+        shell=True) 
+    behaviorButton.SetValue(False)
+    behaviorButton.SetLabel("Pause")
+    print "Scout " + name + " was set to behavior: " + behavior
+    behaviorLabel.SetLabel("  |  Current Behavior: " + behavior)
+    scouts[name] = behavior
 
 def KillScout(name):
-	try:
-		rospy.wait_for_service('/kill')
-		service = rospy.ServiceProxy('/kill', Kill)
-		if name in processes:
-			processes[name].kill()
-			del processes[name]
-		resp = service(name)
-		if name in scouts:
-			del scouts[name]
-		return True
-	except rospy.ServiceException, e:
-		return False
+    try:
+        rospy.wait_for_service('/kill')
+        service = rospy.ServiceProxy('/kill', Kill)
+        if name in processes:
+            processes[name].kill()
+            del processes[name]
+        resp = service(name)
+        if name in scouts:
+            del scouts[name]
+        return True
+    except rospy.ServiceException, e:
+        return False
 
 def PauseScout(name, behaviorLabel, behaviorButton, selectedBehavior):
     return SetBehavior(name, behaviorLabel, behaviorButton,
@@ -222,13 +224,13 @@ class GUI(wx.Frame):
         return
 
 if __name__ == '__main__':
-	ScoutSimGui = subprocess.Popen("rosrun scoutsim scoutsim_node race", shell=True)
-	rospy.wait_for_service('/spawn')
-	#subprocess.Popen("rosservice call /spawn 1.4 0.275 0 scout1", shell=True)  # why was this here?
-	app = wx.App()
-	GUI(None, title='Colony Scout Manager')
-	app.MainLoop()
-	# This doesn't run.  I'm sure there is a reason why.
-	for process in processes:
-		process.kill()
-	ScoutSimGui.kill()
+    ScoutSimGui = subprocess.Popen("rosrun scoutsim scoutsim_node race", shell=True)
+    rospy.wait_for_service('/spawn')
+    #subprocess.Popen("rosservice call /spawn 1.4 0.275 0 scout1", shell=True)  # why was this here?
+    app = wx.App()
+    GUI(None, title='Colony Scout Manager')
+    app.MainLoop()
+    # This doesn't run.  I'm sure there is a reason why.
+    for process in processes:
+        process.kill()
+    ScoutSimGui.kill()
