コード例 #1
0
ファイル: klustr_widget.py プロジェクト: Iterates/IA_PROJET_I
    def __init__(self, id, name, thumbnail):
        self._id = id
        self._name = name

        img = qimage_argb32_from_png_decoding(thumbnail)
        self._thumbnail_icon = QIcon() if img.is_null() else QIcon(
            QPixmap.from_image(img))

        super().__init__(self._thumbnail_icon, self._name)
コード例 #2
0
ファイル: klustr_widget.py プロジェクト: Iterates/IA_PROJET_I
    def __init__(self, label_id, image_id, name, width, height, image,
                 thumbnail, transformation):
        self._label_id = label_id
        self._image_id = image_id
        self._name = name
        self._width = width
        self._height = height
        self._translated = transformation[0] == '1'
        self._rotated = transformation[1] == '1'
        self._scaled = transformation[2] == '1'

        img = qimage_argb32_from_png_decoding(thumbnail)
        self._thumbnail_icon = QIcon() if img.is_null() else QIcon(
            QPixmap.from_image(img))

        img = qimage_argb32_from_png_decoding(image)
        self._image = QIcon() if img.is_null() else img

        super().__init__(self._thumbnail_icon, self._name)
コード例 #3
0
def build_gui(watcher):

    app = QApplication(title="title here")

    menu = QMenu()
    rebuild_menu(menu, app, watcher)

    with pkg_resources.path(assets, ICON_PATH) as icon_res_path:
        image = QImage(str(icon_res_path))
        print(icon_res_path, image)

    pixmap = QPixmap.from_image(image)
    icon = QIcon(pixmap)
    systray = QSystemTrayIcon(icon)
    systray.set_context_menu(menu)
    systray.show()

    # systray must be returned or it will be garbage collected
    return app, menu, systray
コード例 #4
0
ファイル: klustr_widget.py プロジェクト: Iterates/IA_PROJET_I
    def update_info(self, image_item):
        def str_info(t, info, length=60):
            title = t + ' ' + '-' * (length - len(t) - 1)
            info = '\n'.join(
                [f' - {k:<15} : {str(value)}' for k, value in info.items()])
            return title + '\n' + info + '\n'

        data_base_info = {
            'Image name': image_item.name,
            'Width': image_item.width,
            'Height': image_item.height,
            'Translated': image_item.translated,
            'Rotated': image_item.rotated,
            'Scaled': image_item.scaled
        }
        image_info = {
            'Width': image_item.image.width(),
            'Height': image_item.image.height(),
            'Format': image_item.image.format(),
            'Depth': image_item.image.depth(),
            'Bytes per line': image_item.image.bytes_per_line(),
            'Cache key': hex(image_item.image.cache_key())
        }

        metadata_info = {
            k: image_item.image.text(k)
            for k in image_item.image.text_keys()
        }

        self.info.plain_text = str_info('From database', data_base_info) \
                                + str_info('From image', image_info) \
                                + str_info('From meta data', metadata_info)
        self.view_label.pixmap = QPixmap.from_image(image_item.image)

        self.translated_widget.brush = QBrush(
            self.green_color) if image_item.translated else QBrush(
                self.red_color)
        self.rotated_widget.brush = QBrush(
            self.green_color) if image_item.rotated else QBrush(self.red_color)
        self.scaled_widget.brush = QBrush(
            self.green_color) if image_item.scaled else QBrush(self.red_color)