Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 from __future__ import division
00010 import os
00011
00012 from python_qt_binding import loadUi
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 from python_qt_binding.QtGui import QWidget, QPixmap
00028
00029
00030
00031 from qt_gui.plugin import Plugin
00032
00033 import rospkg
00034 import rocon_master_info
00035
00036
00037
00038
00039
00040
00041 class MasterInfo(Plugin):
00042
00043 def __init__(self, context):
00044 super(MasterInfo, self).__init__(context)
00045 self.initialised = False
00046 self.setObjectName('MasterInfo')
00047 self._current_dotcode = None
00048
00049 self._master_info = rocon_master_info.get_master_info(0.5)
00050
00051 self._widget = QWidget()
00052 self._widget.setObjectName('RoconMasterInfoUi')
00053 rospack = rospkg.RosPack()
00054 ui_file = os.path.join(rospack.get_path('rocon_qt_master_info'), 'ui', 'master_info.ui')
00055 loadUi(ui_file, self._widget)
00056 if context.serial_number() > 1:
00057 self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))
00058
00059 pixmap = QPixmap()
00060 pixmap.loadFromData(self._master_info.icon.data, format=self._master_info.icon.format)
00061 self._widget.icon_label.setPixmap(pixmap)
00062 self._widget.icon_label.resize(pixmap.width(), pixmap.height())
00063
00064 self._widget.info_label.resize(200, pixmap.height())
00065 self._widget.info_label.setText("<b>Name:</b> %s<br/><b>Rocon Version:</b> %s<br/><b>Description:</b> %s" % (self._master_info.name, self._master_info.version, self._master_info.description))
00066 self._widget.adjustSize()
00067
00068 context.add_widget(self._widget)
00069
00070 def shutdown_plugin(self):
00071 pass