Go to the documentation of this file.00001
00002
00003
00004
00005 import sys
00006 sys.dont_write_bytecode = True
00007 import inspect
00008 import logging
00009
00010 def asciiview(args):
00011 from diarc import parser
00012 from ascii_view import ascii_view
00013 from diarc import base_adapter
00014 topology = parser.parseFile(args[0])
00015 view = ascii_view.AsciiView()
00016 adapter = base_adapter.BaseAdapter(topology, view)
00017 adapter._update_view()
00018
00019 def qtview(args):
00020 try:
00021 import python_qt_binding.QtGui
00022 except:
00023 print "Error: python_qt_binding not installed."
00024 print "Please install using `sudo pip install python_qt_binding`"
00025 exit(-1)
00026 from diarc import parser
00027 from qt_view import qt_view
00028 from diarc import base_adapter
00029 topology = parser.parseFile(args[0])
00030 app = python_qt_binding.QtGui.QApplication(sys.argv)
00031 view = qt_view.QtView()
00032 adapter = base_adapter.BaseAdapter(topology, view)
00033 adapter._update_view()
00034 view.activateWindow()
00035 view.raise_()
00036 sys.exit(app.exec_())
00037
00038 def rosview():
00039 try:
00040 import python_qt_binding.QtGui
00041 except:
00042 print "Error: python_qt_binding not installed."
00043 print "Please install using `sudo pip install python_qt_binding`"
00044 exit(-1)
00045 import qt_view
00046 import ros.ros_adapter
00047 app = python_qt_binding.QtGui.QApplication([])
00048 view = qt_view.QtView()
00049 adapter = ros.ros_adapter.RosAdapter(view)
00050 adapter.update_model()
00051 view.activateWindow()
00052 view.raise_()
00053 sys.exit(app.exec_())
00054
00055
00056
00057
00058 if __name__=="__main__":
00059 available_tests = dict(inspect.getmembers(sys.modules[__name__],inspect.isfunction))
00060
00061
00062
00063
00064 logging.basicConfig(level=logging.DEBUG)
00065 log = logging.getLogger('main')
00066
00067 if len(sys.argv) < 2 or sys.argv[1] not in available_tests:
00068 print "Usage:\n ./test.py <test> [parameters]\n"
00069 print "Tests available:",available_tests.keys()
00070 exit(0)
00071 elif len(sys.argv)>2:
00072 available_tests[sys.argv[1]](sys.argv[2:])
00073 else:
00074 available_tests[sys.argv[1]]()
00075