コード例 #1
0
    def set_item_display(self, item_widget, item_info, height, width):
        """Set item text & icons using the info available."""
        item_provider = item_info['provider']
        item_type = self.ITEM_TYPE_MAP.get(item_info['kind'], 'no_match')
        item_label = item_info['label']
        icon_provider = ("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0l"
                         "EQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=")
        img_height = height - 2
        img_width = img_height * 0.8

        if item_provider == KITE_COMPLETION:
            kite_height = img_height
            kite_width = (416.14 / 526.8) * kite_height
            icon_provider = ima.get_kite_icon()
            icon_provider = ima.base64_from_icon_obj(icon_provider, kite_width,
                                                     kite_height)

        item_text = self.get_html_item_representation(
            item_label,
            item_type,
            icon_provider=icon_provider,
            img_height=img_height,
            img_width=img_width,
            height=height,
            width=width)

        item_widget.setText(item_text)
        item_widget.setIcon(self._get_cached_icon(item_type))
コード例 #2
0
    def set_item_display(self, item_widget, item_info, height, width):
        """Set item text & icons using the info available."""
        item_provider = item_info['provider']
        item_type = self.ITEM_TYPE_MAP.get(item_info['kind'], 'no_match')
        item_label = item_info['label']
        icon_provider = ("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0l"
                         "EQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=")
        img_height = height - 2
        img_width = img_height * 0.8

        icon_provider, icon_scale = item_info.get('icon', (None, 1))
        if icon_provider is not None:
            icon_height = img_height
            icon_width = icon_scale * icon_height
            icon_provider = ima.get_icon(icon_provider,
                                         adjust_for_interface=True)
            icon_provider = ima.base64_from_icon_obj(icon_provider, icon_width,
                                                     icon_height)

        item_text = self.get_html_item_representation(
            item_label,
            item_type,
            icon_provider=icon_provider,
            img_height=img_height,
            img_width=img_width,
            height=height,
            width=width)

        item_widget.setText(item_text)
        item_widget.setIcon(self._get_cached_icon(item_type))