예제 #1
0
 def _set_icon(self):
     pixmap = QPixmap()
     pixmap.loadFromData(
         self.qt_rapp_manager_info._get_icon().data,
         format=self.qt_rapp_manager_info._get_icon().format)
     self._widget.icon_label.setPixmap(pixmap)
     self._widget.icon_label.resize(pixmap.width(), pixmap.height())
예제 #2
0
    def __init__(self, context):
        super(MasterInfo, self).__init__(context)
        self.initialised = False
        self.setObjectName('MasterInfo')
        self._current_dotcode = None

        self._master_info = rocon_master_info.get_master_info(0.5)  # at worst a small timeout here, but perhaps should be run in a thread.

        self._widget = QWidget()
        self._widget.setObjectName('RoconMasterInfoUi')
        rospack = rospkg.RosPack()
        ui_file = os.path.join(rospack.get_path('rocon_qt_master_info'), 'ui', 'master_info.ui')
        loadUi(ui_file, self._widget)
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))

        pixmap = QPixmap()
        pixmap.loadFromData(self._master_info.icon.data, format=self._master_info.icon.format)
        self._widget.icon_label.setPixmap(pixmap)
        self._widget.icon_label.resize(pixmap.width(), pixmap.height())

        self._widget.info_label.resize(200, pixmap.height())
        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))
        self._widget.adjustSize()

        context.add_widget(self._widget)
예제 #3
0
def rocon_icon_to_qicon(icon):
    """
    :param rocon_std_msgs.Icon icon: icon to use for the pixmap
    """
    pixmap = QPixmap()
    pixmap.loadFromData(icon.data, format=icon.format)
    return QIcon(pixmap)
예제 #4
0
    def __init__(self, context):
        super(ServiceInfo, self).__init__(context)
        self.initialised = False
        self.setObjectName('ServiceInfo')
        self._current_dotcode = None
        counter = 0
        service_info = concert_service_utilities.service_information.get_services_info()
        dict = service_info[1] #dict = {}
        nameList = service_info[0] #nameList = []

        # Create Widget 
        self._widget = QWidget()
        self._widget.setObjectName('ConcertServiceInfoUi')
        rospack = rospkg.RosPack()
        ui_file = os.path.join(rospack.get_path('concert_qt_service_info'), 'ui', 'concert_service_info.ui')
        loadUi(ui_file, self._widget)
        if context.serial_number() > 1:
            self._widget.setWindowTitle(self._widget.windowTitle() + (' (%d)' % context.serial_number()))

        for value in nameList:
            info_text = "<html>"
            info_text += "<p><b>Resource Name: </b>" + dict[value].resource_name + "</p>"
            info_text += "<p><b>Name: </b>" + dict[value].name + "</p>"
            info_text += "<p><b>Description: </b>" + dict[value].description + "</p>"
            info_text += "<p><b>Author: </b>" + dict[value].author + "</p>"
            info_text += "<p><b>Priority: </b>" + str(dict[value].priority) + "</p>"
            info_text += "<p><b>Launcher: </b>" + dict[value].launcher_type + "</p>"
            info_text += "<p><b>Status: </b>" + str(dict[value].status) + "</p>"
            info_text += "<p><b>Enabled: </b>" + str(dict[value].enabled) + "</p>"
            info_text += "<p><b>Icon: </b>" + str(dict[value].icon.resource_name) + "</p>"
            info_text += "</html>"

            if counter == 0:
                self._widget.app_info.appendHtml(info_text)
                pixmap2 = QPixmap()
                pixmap2.loadFromData(dict[value].icon.data, format=dict[value].icon.format)
                if QPixmap.isNull(pixmap2):
                    icon_file2 = os.path.join(rospack.get_path('concert_qt_service_info'), 'resources', 'images', 'unknown.png')
                    pixmap2 = QPixmap(icon_file2, format="png")
                    self._widget.app_icon2.setPixmap(pixmap2)
                    self._widget.app_icon2.resize(pixmap2.width(), pixmap2.height())
                if not QPixmap.isNull(pixmap2):
                    self._widget.app_icon2.setPixmap(pixmap2)
                    self._widget.app_icon2.resize(pixmap2.width(), pixmap2.height())
            if counter == 1:
                self._widget.app_info2.appendHtml(info_text)
                pixmap = QPixmap()
                pixmap.loadFromData(dict[value].icon.data, format=dict[value].icon.format)
                if QPixmap.isNull(pixmap):
                    icon_file = os.path.join(rospack.get_path('concert_qt_service_info'), 'resources', 'images', 'unknown.png')
                    pixmap = QPixmap(icon_file, format="png")
                    self._widget.app_icon.setPixmap(pixmap)
                    self._widget.app_icon.resize(pixmap.width(), pixmap.height())   
                if not QPixmap.isNull(pixmap):
                    self._widget.app_icon.setPixmap(pixmap)
                    self._widget.app_icon.resize(pixmap.width(), pixmap.height())
            counter = counter + 1 

        context.add_widget(self._widget)
예제 #5
0
 def on_compressed_image_received(self, image):
     '''
     :param sensor_msgs.CompressedImage image: convert and display this in the QGraphicsView.
     '''
     if len(self.scene.items()) > 1:
         self.scene.removeItem(self.scene.items()[0])
     pixmap = QPixmap()
     pixmap.loadFromData(image.data, format=image.format)
     self.scene.addPixmap(pixmap)
     self.scene.update()
     # setting fitInvView seems sensitive to here or prior to scene update
     self.fitInView(QRectF(0, 0, self.scene.width(), self.scene.height()),
                    Qt.KeepAspectRatio)
예제 #6
0
    def _display_image(self):
        image = self.teleop_app_info.image_data
        if image:
            if len(self.scene.items()) > 1:
                self.scene.removeItem(self.scene.items()[0])

            image_data = self.teleop_app_info.image_data.data
            pixmap = QPixmap()
            pixmap.loadFromData(
                image_data,
                format="PNG",
            )
            self._widget.camera_view.fitInView(
                QRectF(0, 0, pixmap.width(), pixmap.height()),
                Qt.KeepAspectRatio)
            self.scene.addPixmap(pixmap)
            self.scene.update()
        else:
            self.scene.clear()
예제 #7
0
def get_qpixmap(icon):
    pixmap = QPixmap()
    pixmap.loadFromData(icon.data, format=icon.format)
    return pixmap