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
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 import os
00032 import platform
00033 import sys
00034
00035 from python_qt_binding import QT_BINDING, QT_BINDING_MODULES, QT_BINDING_VERSION
00036 from python_qt_binding.QtCore import QObject, qVersion
00037 from python_qt_binding.QtGui import QMessageBox
00038
00039 from .ros_package_helper import get_package_path
00040
00041
00042 class AboutHandler(QObject):
00043
00044 """Handler for the about action in the menu bar showing a message box with details on the used libraries and their versions."""
00045
00046 def __init__(self, qtgui_path, parent=None):
00047 super(AboutHandler, self).__init__(parent)
00048 self._qtgui_path = qtgui_path
00049
00050 def show(self):
00051
00052 qt_gui_cpp_path = os.path.realpath(get_package_path('qt_gui_cpp'))
00053 sys.path.append(os.path.join(qt_gui_cpp_path, 'lib'))
00054 sys.path.append(os.path.join(qt_gui_cpp_path, 'src'))
00055 from qt_gui_cpp.cpp_binding_helper import qt_gui_cpp
00056
00057 import rospkg
00058 _rospkg_version = getattr(rospkg, '__version__', '< 0.2.4')
00059
00060 logo = os.path.join(self._qtgui_path, 'resource', 'ros_org_vertical.png')
00061 text = '<img src="%s" width="56" height="200" style="float: left;"/>' % logo
00062
00063 text += '<h3 style="margin-top: 1px;">%s</h3>' % self.tr('rqt')
00064
00065 text += '<p>%s %s</p>' % (self.tr('rqt is a framework for graphical user interfaces.'), self.tr('It is extensible with plugins which can be written in either Python or C++.'))
00066 text += '<p>%s</p>' % (self.tr('Please see the <a href="%s">Wiki</a> for more information on rqt and available plugins.' % 'http://wiki.ros.org/rqt'))
00067
00068 text += '<p>%s: ' % self.tr('Utilized libraries:')
00069
00070 text += 'Python %s, ' % platform.python_version()
00071
00072 text += 'rospkg %s, ' % _rospkg_version
00073
00074 if QT_BINDING == 'pyside':
00075 text += 'PySide'
00076 elif QT_BINDING == 'pyqt':
00077 text += 'PyQt'
00078 text += ' %s (%s), ' % (QT_BINDING_VERSION, ', '.join(sorted(QT_BINDING_MODULES)))
00079
00080 text += 'Qt %s, ' % qVersion()
00081
00082 if qt_gui_cpp is not None:
00083 if QT_BINDING == 'pyside':
00084 text += '%s' % (self.tr('%s C++ bindings available') % 'Shiboken')
00085 elif QT_BINDING == 'pyqt':
00086 text += '%s' % (self.tr('%s C++ bindings available') % 'SIP')
00087 else:
00088 text += '%s' % self.tr('C++ bindings available')
00089 else:
00090 text += '%s' % self.tr('no C++ bindings found - no C++ plugins available')
00091
00092 text += '.</p>'
00093
00094 mb = QMessageBox(QMessageBox.NoIcon, self.tr('About rqt'), text, QMessageBox.Ok, self.parent())
00095 mb.exec_()