Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import rospy
00019 import sys
00020 import os
00021 import signal
00022
00023 from roslib.packages import get_pkg_dir
00024 from xml.etree import ElementTree
00025
00026 from python_qt_binding.QtGui import *
00027 from python_qt_binding.QtCore import *
00028
00029 from airbus_pyqt_extend.QtAgiCore import get_pkg_dir_from_prefix
00030
00031 from airbus_cobot_gui.airbus_cobot_gui_main import CobotGuiSplash, \
00032 CobotGuiMain
00033
00034 from airbus_pyqt_extend import QtAgiCore
00035
00036
00037 from airbus_cobot_gui.res import R
00038 from PyQt4.Qt import QApplication
00039 from PyQt4.uic.Compiler.qtproxies import QtGui
00040
00041 FULL_SCREEN_ARGS = ["full-screen" ,"full" ,"f",
00042 "-full-screen" ,"-full" ,"-f",
00043 "--full-screen" ,"--full" ,"--f"]
00044
00045 class GuiApplication(QApplication):
00046
00047 def __init__(self, args):
00048 QApplication.__init__(self, args)
00049 self.gui = None
00050
00051 def cleanGui(self):
00052 self.gui.shutdown()
00053
00054 def run():
00055
00056 name = 'rqt_gui_py_node_%d' % os.getpid()
00057 rospy.init_node(name, disable_signals=True)
00058 app = GuiApplication(sys.argv)
00059
00060 splash = CobotGuiSplash()
00061 splash.start()
00062
00063 window = QMainWindow()
00064
00065 gui = CobotGuiMain(splash)
00066 config = rospy.get_param("~config", "${airbus_cobot_gui}/config/default.conf")
00067 config = get_pkg_dir_from_prefix(config)
00068 gui.setupUserConfig(config)
00069
00070 window.setCentralWidget(gui)
00071 window.setGeometry(gui.geometry())
00072 window.setWindowIcon(R.getIconById('airbus_cobot_gui'))
00073
00074 if gui.getDisplayMode() in FULL_SCREEN_ARGS:
00075 window.showFullScreen()
00076 else:
00077 window.show()
00078
00079 splash.close()
00080
00081 app.gui = gui
00082 app.connect(app, SIGNAL("aboutToQuit()"), app.cleanGui)
00083
00084
00085 def signal_handler(signal, frame):
00086 app.quit()
00087
00088 signal.signal(signal.SIGINT, signal_handler)
00089
00090
00091 rospy.on_shutdown(app.quit)
00092
00093
00094 sys.exit(app.exec_())
00095
00096
00097 if __name__ == "__main__":
00098 run()
00099
00100