00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 PKG = 'life_test'
00036 import roslib
00037 roslib.load_manifest(PKG)
00038
00039 import wx
00040
00041 import rospy
00042
00043 import sys, os
00044
00045 from roslaunch_caller import roslaunch_caller
00046
00047 import traceback
00048
00049 class TestManagerApp(wx.App):
00050 def OnInit(self, debug = False):
00051
00052 args = rospy.myargv()
00053 debug = len(args) > 1 and args[1] == '--debug'
00054
00055 try:
00056 self._core_launcher = roslaunch_caller.launch_core()
00057 except Exception, e:
00058 print >> sys.stderr, 'Failed to launch core. Another core may already be running.\n\n'
00059 wx.MessageBox('A ROS core is still running and preventing the Test Manager system from starting. Shut down ROS processes by using the "Kill ROS" icon.','ROS Already Running', wx.OK|wx.ICON_ERROR, None)
00060 traceback.print_exc()
00061 sys.exit(1)
00062
00063 import life_test.result_dir
00064 if not life_test.result_dir.check_results_dir():
00065 print >> sys.stderr, "Unable to write to results directory. Permissions invalid"
00066 wx.MessageBox("Unable to write to the \"~/wg_hardware_test/test_manager\" directory. Open a terminal and type, \"sudo chmod +rwx -R ~/wg_hardware_test/test_manager\" to fix the offending directory. You will have to restart Test Manager",
00067 "Unable to Write Results", wx.OK|wx.ICON_ERROR, None)
00068 sys.exit(1)
00069
00070 img_path = os.path.join(roslib.packages.get_pkg_dir(PKG), 'xrc', 'splash.jpg')
00071
00072 bitmap = wx.Bitmap(img_path, type=wx.BITMAP_TYPE_JPEG)
00073 self._splash = wx.SplashScreen(bitmap, wx.SPLASH_CENTRE_ON_SCREEN, 30000, None, -1)
00074
00075 rospy.init_node("Test_Manager")
00076
00077 import life_test.manager
00078
00079 self._frame = life_test.manager.TestManagerFrame(None, debug)
00080 self._frame.SetSize(wx.Size(1600, 1100))
00081 self._frame.Layout()
00082 self._frame.Centre()
00083
00084 self._splash.Destroy()
00085 self._splash = None
00086
00087 self._frame.Show(True)
00088
00089 return True
00090
00091 def OnExit(self):
00092 self._core_launcher.stop()
00093
00094 if self._splash:
00095 self._splash.Destroy()
00096
00097 if __name__ == '__main__':
00098 try:
00099 app = TestManagerApp(0)
00100 app.MainLoop()
00101 except Exception, e:
00102 print >> sys.stderr, "Caught exception in TestManagerApp Main Loop"
00103 import traceback
00104 traceback.print_exc()