Пример #1
0
 def process_pix(self, value):
     img = binaryzation(self.pix.img, threshold=value, alpha=FLAG)
     self.pix.load_img(QPixmap.fromImage(ImageQt(img)))
Пример #2
0
    def updateBase(self):
        if self.invalited == False:
            return
        self.invalited = False
        img = self.imgBase.copy()
        img_left = self.imgBase.crop(
            (0, 0, int(self.imgBase.size[0] / 2), self.imgBase.size[1]))
        img_right = self.imgBase.crop(
            (int(img.size[0] / 2), 0, self.imgBase.size[0],
             self.imgBase.size[1]))
        mask0_l = img_left.split()[-1].copy()
        mask0_r = img_right.split()[-1].copy()
        for layer in self.layers:
            img_base_l = img.crop((0, 0, int(img.size[0] / 2), img.size[1]))
            img_base_r = img.crop(
                (int(img.size[0] / 2), 0, img.size[0], img.size[1]))
            _, tag, mode, dir, values = layer.getValue()
            if layer.lastvalue == layer.getValue():
                img_new_l = layer.img_l
                img_new_r = layer.img_r
                draw = True
            else:
                img_new_l = Image.new("RGBA", img_base_l.size)
                img_new_r = Image.new("RGBA", img_base_r.size)
                draw = False
                if tag == "Fill":
                    draw = True
                    width, r, g, b, blur, xOffset, yOffset, rotate, cutoff = values
                    if width >= int(self.imgBase.size[0] / 4):
                        continue
                    cut_left = cut_right = None
                    if dir == "Left" or dir == "Both":
                        if width > 0:
                            mask_l = img_left.copy().resize(
                                (img_left.size[0] - width * 2,
                                 img_left.size[1] - width * 2),
                                Image.LANCZOS).split()[-1]
                        else:
                            mask_l = img_left.split()[-1]
                        if cutoff > 0:
                            cut_left = img_left.copy().resize(
                                (cutoff * 2, cutoff * 2),
                                Image.LANCZOS).split()[-1]
                        mask2_l = Image.new("L", img_new_l.size)
                        mask2_l.paste(mask_l.convert("L"), (width, width))
                        if cut_left != None:
                            mask2_l.paste((0),
                                          (int(mask2_l.size[0] / 2) - cutoff,
                                           int(mask2_l.size[1] / 2) - cutoff),
                                          cut_left)
                        mask2_l = mask2_l.rotate(rotate,
                                                 translate=(xOffset, yOffset))
                        if blur > 0:
                            mask2_l = mask2_l.filter(
                                ImageFilter.GaussianBlur(blur))
                        img_new_l.paste(
                            (r, g, b),
                            (0, 0, img_new_l.size[0], img_new_l.size[1]),
                            mask2_l)

                    if dir == "Right" or dir == "Both":
                        if width > 0:
                            mask_r = img_right.copy().resize(
                                (img_right.size[0] - width * 2,
                                 img_right.size[1] - width * 2),
                                Image.LANCZOS).split()[-1]
                        else:
                            mask_r = img_right.split()[-1]
                        if cutoff > 0:
                            cut_right = img_right.copy().resize(
                                (cutoff * 2, cutoff * 2),
                                Image.LANCZOS).split()[-1]
                        mask2_r = Image.new("L", img_new_r.size)
                        mask2_r.paste(mask_r.convert("L"), (width, width))
                        if cut_right != None:
                            mask2_r.paste((0),
                                          (int(mask2_r.size[0] / 2) - cutoff,
                                           int(mask2_r.size[1] / 2) - cutoff),
                                          cut_right)
                        mask2_r = mask2_r.rotate(0 - rotate,
                                                 translate=(0 - xOffset,
                                                            yOffset))
                        if blur > 0:
                            mask2_r = mask2_r.filter(
                                ImageFilter.GaussianBlur(blur))
                        img_new_r.paste(
                            (r, g, b),
                            (0, 0, img_new_r.size[0], img_new_r.size[1]),
                            mask2_r)

                if tag == "Linear":
                    draw = True
                    width, r, g, b, blur, xOffset, yOffset, rotate, cutoff = values
                    if dir == "Left" or dir == "Both":
                        mask2_l = Image.new("L", img_new_l.size)
                        d_l = ImageDraw.Draw(mask2_l)
                        d_l.polygon([(0, width + xOffset),
                                     (mask2_l.size[0], width + yOffset),
                                     (mask2_l.size[0],
                                      mask2_l.size[1] - cutoff + xOffset),
                                     (0, mask2_l.size[1] - cutoff + yOffset)],
                                    fill=255)
                        if blur > 0:
                            mask2_l = mask2_l.filter(
                                ImageFilter.GaussianBlur(blur))
                        img_new_l.paste(
                            (r, g, b),
                            (0, 0, img_new_l.size[0], img_new_l.size[1]),
                            mask2_l)

                    if dir == "Right" or dir == "Both":
                        mask2_r = Image.new("L", img_new_r.size)
                        d_r = ImageDraw.Draw(mask2_r)
                        d_r.polygon([(0, width + yOffset),
                                     (mask2_r.size[0], width + xOffset),
                                     (mask2_r.size[0],
                                      mask2_r.size[1] - cutoff + yOffset),
                                     (0, mask2_r.size[1] - cutoff + xOffset)],
                                    fill=255)
                        if blur > 0:
                            mask2_r = mask2_r.filter(
                                ImageFilter.GaussianBlur(blur))
                        img_new_r.paste(
                            (r, g, b),
                            (0, 0, img_new_r.size[0], img_new_r.size[1]),
                            mask2_r)

                layer.img_l = img_new_l
                layer.img_r = img_new_r
                layer.lastvalue = layer.getValue()

            if draw == True:
                if dir == "Left" or dir == "Both":
                    if mode == "Normal":
                        img_base_l = Image4Layer.normal(img_base_l, img_new_l)
                    elif mode == "Overlay":
                        img_base_l = Image4Layer.overlay(img_base_l, img_new_l)
                    elif mode == "SoftLight":
                        img_base_l = Image4Layer.soft_light(
                            img_base_l, img_new_l)
                    elif mode == "HardLight":
                        img_base_l = Image4Layer.hard_light(
                            img_base_l, img_new_l)
                    elif mode == "Screen":
                        img_base_l = Image4Layer.screen(img_base_l, img_new_l)
                    elif mode == "MultiPly":
                        img_base_l = Image4Layer.multiply(
                            img_base_l, img_new_l)
                    img.paste(img_base_l, (0, 0), mask0_l)
                if dir == "Right" or dir == "Both":
                    if mode == "Normal":
                        img_base_r = Image4Layer.normal(img_base_r, img_new_r)
                    elif mode == "Overlay":
                        img_base_r = Image4Layer.overlay(img_base_r, img_new_r)
                    elif mode == "SoftLight":
                        img_base_r = Image4Layer.soft_light(
                            img_base_r, img_new_r)
                    elif mode == "HardLight":
                        img_base_r = Image4Layer.hard_light(
                            img_base_r, img_new_r)
                    elif mode == "Screen":
                        img_base_r = Image4Layer.screen(img_base_r, img_new_r)
                    elif mode == "MultiPly":
                        img_base_r = Image4Layer.multiply(
                            img_base_r, img_new_r)
                    img.paste(img_base_r, (int(img.size[0] / 2), 0), mask0_r)

        self.imgExport = img.copy()
        qim = ImageQt(img)
        pix = QtGui.QPixmap.fromImage(qim).copy()
        self.items[0].setPixmap(pix)
Пример #3
0
    def query(self):
        if self.lineEdit.text() != '' or self.lineEdit_2.text() != '':
            map_request = {
                'l': self.type_map[self.comboBox.currentIndex()],
                'z': str(self.zoom)
            }
            w, h = self.lineEdit.text(), self.lineEdit_2.text()
            if self.is_valid(w, h):
                if -180 <= self.w + float(w) <= 180 and -90 <= self.h + float(
                        h) <= 90:
                    map_request[
                        'll'] = f'{float(w) + self.w},{float(h) + self.h}'
                else:
                    return
            else:
                return
            url = 'http://static-maps.yandex.ru/1.x/'
            request = requests.get(url, params=map_request, stream=True).raw
            a = QPixmap.fromImage(ImageQt(Image.open(request).convert('RGBA')))
            self.label_3.setPixmap(a)
        elif self.lineEdit_3.text() != '':
            toponym_to_find = self.lineEdit_3.text()

            geocoder_api_server = "http://geocode-maps.yandex.ru/1.x/"

            geocoder_params = {
                "apikey": "40d1649f-0493-4b70-98ba-98533de7710b",
                "geocode": toponym_to_find,
                "format": "json"
            }

            response = requests.get(geocoder_api_server,
                                    params=geocoder_params)
            if not response:
                pass

            json_response = response.json()

            toponym = json_response["response"]["GeoObjectCollection"][
                "featureMember"][0]["GeoObject"]

            toponym_coodrinates = toponym["Point"]["pos"]
            toponym_longitude, toponym_lattitude = toponym_coodrinates.split(
                " ")
            if self.is_valid(toponym_longitude,
                             toponym_lattitude,
                             address=2,
                             coords=[toponym_longitude, toponym_lattitude]):
                toponym_longitude = float(toponym_longitude)
                toponym_lattitude = float(toponym_lattitude)
            else:
                return
            if toponym_longitude + self.w > 180 or toponym_longitude + self.w < -180 or toponym_lattitude + self.h > 90 or toponym_lattitude + self.h < -90:
                return
            print(1)
            map_params = {
                "ll":
                ",".join([
                    str(toponym_longitude + self.w),
                    str(toponym_lattitude + self.h)
                ]),
                "l":
                "map",
                "z":
                self.zoom,
                'pt':
                ','.join(toponym_coodrinates.split()) + ',pmwtm'
            }

            map_api_server = "http://static-maps.yandex.ru/1.x/"
            response = requests.get(map_api_server,
                                    params=map_params,
                                    stream=True).raw
            a = QPixmap.fromImage(ImageQt(
                Image.open(response).convert('RGBA')))
            self.label_3.setPixmap(a)
Пример #4
0
def PILimageToQImage(pilimage):
    """converts a PIL image to QImage"""
    imageq = ImageQt(pilimage)  #convert PIL image to a PIL.ImageQt object
    qimage = QImage(imageq)
    return qimage
Пример #5
0
def convertPIL2Pixmap(PIL_Image):
    return QPixmap(QImage(ImageQt(PIL_Image)))
Пример #6
0
 def img_update(self):
     self.qimage = ImageQt(Image.fromarray(self.draw))
     # self.qimage = ImageQt(self.draw)
     self.viewer.setPhoto(QPixmap().fromImage(self.qimage))
Пример #7
0
    def draw_timeline_segment(self, painter, topic, stamp_start, stamp_end, x,
                              y, width, height):
        """
        draws a stream of images for the topic
        :param painter: painter object, ''QPainter''
        :param topic: topic to draw, ''str''
        :param stamp_start: stamp to start drawing, ''rospy.Time''
        :param stamp_end: stamp to end drawing, ''rospy.Time''
        :param x: x to draw images at, ''int''
        :param y: y to draw images at, ''int''
        :param width: width in pixels of the timeline area, ''int''
        :param height: height in pixels of the timeline area, ''int''
        """
        if x < self.timeline._history_left:
            width += x - self.timeline._history_left
            x = self.timeline._history_left
        max_interval_thumbnail = self.timeline.map_dx_to_dstamp(
            self.thumbnail_combine_px)
        max_interval_thumbnail = max(0.1, max_interval_thumbnail)
        thumbnail_gap = 6
        thumbnail_x, thumbnail_y, thumbnail_height = x + 1, y + 1, height - 2 - thumbnail_gap  # leave 1px border

        # set color to white draw rectangle over messages
        painter.setBrush(QBrush(Qt.white))
        painter.drawRect(x, y, width, height - thumbnail_gap)
        thumbnail_width = None

        while True:
            available_width = (x + width) - thumbnail_x

            # Check for enough remaining to draw thumbnail
            if width > 1 and available_width < self.min_thumbnail_width:
                break

            # Try to display the thumbnail, if its right edge is to the right of the timeline's left side
            if not thumbnail_width or thumbnail_x + thumbnail_width >= self.timeline._history_left:
                stamp = self.timeline.map_x_to_stamp(thumbnail_x,
                                                     clamp_to_visible=False)
                thumbnail_bitmap = self.thumbnail_cache.get_item(
                    topic, stamp, max_interval_thumbnail)

                # Cache miss
                if not thumbnail_bitmap:
                    thumbnail_details = (thumbnail_height, )
                    self.thumbnail_cache.enqueue(
                        (topic, stamp, max_interval_thumbnail,
                         thumbnail_details))
                    if not thumbnail_width:
                        break
                else:
                    thumbnail_width, _ = thumbnail_bitmap.size

                    if width > 1:
                        if available_width < thumbnail_width:
                            thumbnail_width = available_width - 1
                    QtImage = ImageQt(thumbnail_bitmap)
                    pixmap = QPixmap.fromImage(QtImage)
                    painter.drawPixmap(thumbnail_x, thumbnail_y,
                                       thumbnail_width, thumbnail_height,
                                       pixmap)
            thumbnail_x += thumbnail_width

            if width == 1:
                break

        painter.setPen(QPen(Qt.black))
        painter.setBrush(QBrush(Qt.transparent))
        if width == 1:
            painter.drawRect(x, y, thumbnail_x - x, height - thumbnail_gap - 1)
        else:
            painter.drawRect(x, y, width, height - thumbnail_gap - 1)
        return True
Пример #8
0
    def __arr_to_QImage(self, arr_img):
        img = PIL.Image.fromarray(arr_img)
        img = img.convert("L")
        result = ImageQt(img)

        return result
Пример #9
0
 def circle(self, ev):
     try:
         self.draw.ellipse((ev.pos().x() - 30 - 31, ev.pos().y() - 30 - 10, ev.pos().x() + 30 - 31, ev.pos().y() + 30 - 10), fill = "red")
     except:
         pass
     self.label.setPixmap(QPixmap.fromImage(ImageQt(self.image)))
Пример #10
0
def inspect_PngImageFile(value):

    label = QLabel()
    label.setPixmap(QPixmap.fromImage(ImageQt(value)))
    return label
Пример #11
0
 def set_image(self, img):
     self.line = img.copy()
     img = Img.fromarray(img)
     return self.painter_init(ImageQt(img))
Пример #12
0
 def ShowImage(self):
     qim = ImageQt(self.image)
     pix = QtGui.QPixmap.fromImage(qim)
     self.pic.setPixmap(pix)
Пример #13
0
    def __init__(self, main_window):
        self.dialog = QDialog(main_window.window)
        self.ui = qt_appearance.Ui_Dialog()
        self.ui.setupUi(self.dialog)
        self.main_window = main_window

        assets_db_file = Config().read("assets_db")
        starbound_folder = Config().read("starbound_folder")
        self.assets = assets.Assets(assets_db_file, starbound_folder)
        self.species = self.assets.species()
        # need to think of a new approach here. player rendering on the fly
        # will not work if we also want to maintain the save/cancel functions
        # it will probably be easier to ditch that entirely across all dialogs
        self.player = main_window.player

        race = main_window.ui.race.currentText()
        self.player.set_race(race)
        self.player.set_gender(main_window.get_gender())

        # Current player stats
        race = self.player.get_race()
        gender = self.player.get_gender()
        personality = self.player.get_personality()

        self.colors = {
            "body": self.player.get_body_directives(),
            "emote": self.player.get_emote_directives(),
            "hair": self.player.get_hair_directives(),
            "facial_hair": self.player.get_facial_hair_directives(),
            "facial_mask": self.player.get_facial_mask_directives()
        }
        color_values = ("body", "hair", "facial_hair", "facial_mask")

        current_appearance = {
            "hair": self.player.get_hair(),
            "facial_hair": self.player.get_facial_hair(),
            "facial_mask": self.player.get_facial_mask()
        }
        appearance_values = ("hair", "facial_hair", "facial_mask")

        # appearance groups/types
        for value in appearance_values:
            group_data = getattr(self.species, "get_%s_groups" % value)(race, gender)
            type_data = getattr(self.species, "get_%s_types" % value)(race, gender,
                                                                      current_appearance[value][0])
            group_widget = getattr(self.ui, value+"_group")
            for option in group_data:
                group_widget.addItem(option)
            group_widget.setCurrentText(current_appearance[value][0])
            if len(group_data) < 2: group_widget.setEnabled(False)

            type_widget = getattr(self.ui, value+"_type")
            for option in type_data:
                type_widget.addItem(option)
            type_widget.setCurrentText(current_appearance[value][1])
            if len(type_data) < 2: type_widget.setEnabled(False)

            group_widget.currentTextChanged.connect(self.write_appearance_values)
            type_widget.currentTextChanged.connect(self.write_appearance_values)

        # personality
        for option in self.species.get_personality():
            self.ui.personality.addItem(option[0])
        self.ui.personality.setCurrentText(personality)

        # set up color picker buttons
        for value in color_values:
            getattr(self.ui, value+"_color").clicked.connect(getattr(self, "new_%s_color_edit" % value))
            if len(self.colors[value]) == 0:
                getattr(self.ui, value+"_color").setEnabled(False)

        # player image
        image = self.assets.species().render_player(self.player)
        pixmap = QPixmap.fromImage(ImageQt(image)).scaled(86, 86)
        self.ui.player_preview.setPixmap(pixmap)
Пример #14
0
 def hair_icon(self, species, hair_type, hair_group):
     image_data = self.assets.species().get_hair_image(species, hair_type, hair_group)
     return QPixmap.fromImage(ImageQt(image_data))
Пример #15
0
    def __init__(self, x_size=550, y_size=450, title='Chat'):
        super().__init__()

        self._mainWidget = QWidget()
        self.setCentralWidget(self._mainWidget)

        self.chatView = QTextEdit()
        self.chatView.setReadOnly(True)

        self.messageEdit = QTextEdit()
        #self.messageEdit.returnPressed.connect(self.enterPressed)

        self.btnSendMess = QPushButton('Send', self)
        self.btnSendMess.clicked.connect(lambda: self._do_action('button', 'Send'))

        action_textBold = self._connect_action(QIcon(chat_config.text_bold_icon),
                                               'Bold',
                                               '',
                                               'Bold text',
                                               lambda: self._do_action('text', 'b'))

        action_textBias = self._connect_action(QIcon(chat_config.text_bias_icon),
                                               'Bias',
                                               '',
                                               'Bias text',
                                               lambda: self._do_action('text', 'i'))

        action_textUnder = self._connect_action(QIcon(chat_config.text_underline_icon),
                                                'Under',
                                                '',
                                                'Under text',
                                               lambda: self._do_action('text', 'u'))

        action_smileSimple = self._connect_action(QIcon(chat_config.smile_simple_icon),
                                               '',
                                               '',
                                               'Simple smile',
                                               lambda: self._do_action('smile', chat_config.smile_simple_icon))

        action_smileSaint = self._connect_action(QIcon(chat_config.smile_saint_icon),
                                               '',
                                               '',
                                               'Saint smile',
                                               lambda: self._do_action('smile', chat_config.smile_saint_icon))

        action_iconHappyMac = self._connect_action(QIcon(chat_config.happy_Mac_icon),
                                               '',
                                               '',
                                               'Happy Mac',
                                               lambda: self._do_action('smile', chat_config.happy_Mac_icon))

        action_openFile = self._connect_action(QIcon(chat_config.file_open_icon),
                                               '&Open',
                                               'Ctrl+O',
                                               'File open',
                                                lambda: self._do_action('db',''))

        action_exit = self._connect_action(QIcon(chat_config.app_exit_icon),
                                               '&Exit',
                                               'Ctrl+Q',
                                               'Exit app',
                                                self.close)

        # В macOS, почему-то, при добавлении меню, окно приложения перестает центрироваться(
        # В Windows же все Ok
        menubar = self.menuBar()
        fileMenu = menubar.addMenu('&Open')
        fileMenu.addAction(action_openFile)

        self.toolbar = self.addToolBar('Main')
        self.toolbar.addAction(action_textBold)
        self.toolbar.addAction(action_textBias)
        self.toolbar.addAction(action_textUnder)
        self.toolbar.addSeparator()
        self.toolbar.addAction(action_smileSimple)
        self.toolbar.addAction(action_smileSaint)
        self.toolbar.addAction(action_iconHappyMac)
        self.toolbar.addSeparator()
        self.toolbar.addAction(action_exit)

        self.lblAvatar = QLabel(self)

        imgData = image_from_db('girl2.jpg')
        if imgData != -1:
            pixmap = QPixmap()
            pixmap.loadFromData(imgData, format='JPEG')
            self.lblAvatar.setPixmap(pixmap)
        else:
            try:
                imgAvatar = Image.open('girl.jpeg')
                imgAvatar = imgAvatar.resize((120, 100), Image.NEAREST)
                pixmap = QPixmap.fromImage(ImageQt(imgAvatar.convert('RGBA')))
            except FileNotFoundError:
                self.lblAvatar.setText('No image')
            else:
                self.lblAvatar.setPixmap(pixmap)


        grid = QGridLayout(self._mainWidget)
        grid.setSpacing(10)
        grid.addWidget(self.chatView, 1, 1)
        grid.addWidget(self.messageEdit, 2, 1)
        grid.addWidget(self.btnSendMess, 3, 1)
        grid.addWidget(self.lblAvatar, 1, 0)

        self.resize(x_size, y_size)
        self.setWindowTitle(title)
        self.statusBar().showMessage('Ready')
        self.show()
Пример #16
0
 def rectangle(self, ev):
     try:
         self.draw.rectangle((ev.pos().x() - 30 - 31, ev.pos().y() - 30, ev.pos().x() + 30 - 31, ev.pos().y() + 30), fill = "black")
     except:
         pass
     self.label.setPixmap(QPixmap.fromImage(ImageQt(self.image)))
Пример #17
0
    def __monitorCli(self):
        while True:  # 开始监听
            if self.__isBusy == True : # 如果有任务 等待
                # time.sleep(30)
                continue

            self.__isBusy = True # 设置监听
            try:
                conn = self.__sock.recv(1024)
                head = conn.decode() # 假设流程正常 conn 应该为一个 header
                if head[0] != 'H':
                    # header 错误
                    pass
                else :
                    kind = head.split('-')[1]

                    if kind == 'TEXT' :
                        length = conn.split('-')[2]
                        self.__sock.send(conn) # 回发 conn 确认

                        while True:
                            try:
                                conn = self.__sock.recv(length)
                                text = conn.decode()
                                if len(text) == length:
                                    self.__sock.send(str(length).encode())
                                    self.__text = text
                                    self.textDisp.setText(self.__text)
                                    print(text, '\n')
                                    break
                                else :
                                    # 未接到正确信息
                                    pass
                            except:
                                # 未接到信息
                                pass

                    elif kind == 'IMAGE' :
                        mode = head.split('-')[1]
                        size = (int(head.split('-')[2]), int(head.split('-')[3]))
                        length = head.split('-')[-1]
                        self.__sock.send(conn) # 回发 conn 确认

                        while True :
                            try:
                                conn = self.__sock.recv(length)
                                image = conn.decode()
                                if len(image) == length :
                                    self.__sock.send(str(length))
                                    self.__image = Image.frombytes(mode, size, image)
                                    qim = ImageQt(self.__image)
                                    self.graphDisp.setPixmap(QPixmap.fromImage(qim))
                                else:
                                    # 未收到正确信息
                                    pass
                            except:
                                pass
                    else :
                        # header 错误
                        pass
                self.__isBusy = False
                time.sleep(30)
            except:
                # 对方未发送 进行一次心跳
                self.__heartBeats()
                self.__isBusy = False
                time.sleep(30)
Пример #18
0
    def makeOAMImage(self, imgData, oam):
        u''' OAM情報から画像を生成する

            入力:スプライトのグラフィックデータ,開始タイル,横サイズ,縦サイズ,垂直反転フラグ,水平反転フラグ
            出力:画像データ(QPixmap形式)

            グラフィックデータは4bitで1pxを表現する.アクセス可能な最小単位は8*8pxのタイルでサイズは32byteとなる
        '''

        TILE_WIDTH = 8
        TILE_HEIGHT = 8
        TILE_DATA_SIZE = TILE_WIDTH * TILE_HEIGHT // 2  # python3で整数値の除算結果を得るには//を使う

        logger.debug("Image Width:\t" + str(oam.sizeX))
        logger.debug("Image Height:\t" + str(oam.sizeY))
        logger.debug("Flip V:\t" + str(oam.flipV))
        logger.debug("Flip H:\t" + str(oam.flipH))

        startAddr = oam.startTile * TILE_DATA_SIZE  # 開始タイルから開始アドレスを算出(1タイル8*8px = 32バイト)
        imgData = imgData[startAddr:]  # 使う部分を切り出し
        imgData = (
            imgData.hex()).upper()  # バイナリ値をそのまま文字列にしたデータに変換(0xFF -> "FF")
        imgData = list(imgData)  # 1文字ずつのリストに変換
        # ドットの描画順(0x01 0x23 0x45 0x67 -> 10325476)に合わせて入れ替え
        for i in range(0, len(imgData))[0::2]:  # 偶数だけ取り出す(0から+2ずつ)
            imgData[i], imgData[i + 1] = imgData[i +
                                                 1], imgData[i]  # これで値を入れ替えられる

        width = oam.sizeX // TILE_WIDTH  # サイズからタイルの枚数に変換
        height = oam.sizeY // TILE_HEIGHT

        totalSize = len(imgData)  # 全ドット数
        imgArray = []

        # 色情報に変換する
        readPos = 0
        while readPos < totalSize:
            currentPixel = int(imgData[readPos], 16)  # 1ドット分読み込み
            imgArray.append(self.palData[currentPixel]["color"])  # 対応する色に変換
            readPos += 1

        imgArray = np.array(imgArray)  # ndarrayに変換
        imgArray = imgArray.reshape(
            (-1, TILE_WIDTH, 4))  # 横8ドットのタイルに並べ替える(-1を設定すると自動で縦の値を算出してくれる)
        u""" 現在の状態

            □
            □
            ︙
            □
            □
        """

        tileNum = width * height  # 合計タイル数

        # タイルの切り出し
        tile = []  # pythonのリストとして先に宣言する(ndarrayとごっちゃになりやすい)
        for i in range(0, tileNum):
            tile.append(imgArray[TILE_HEIGHT * i:TILE_HEIGHT * (i + 1),
                                 0:TILE_WIDTH, :])  # 8x8のタイルを切り出していく

        # タイルの並び替え
        h = []  # 水平方向に結合したタイルを格納するリスト
        for i in range(0, height):
            h.append(np.zeros_like(tile[0]))  # タイルを詰めるダミー
            for j in range(0, width):
                h[i] = np.hstack((h[i], tile[i * width + j]))
            if i != 0:
                h[0] = np.vstack((h[0], h[i]))
        img = h[0][:, 8:, :]  # ダミー部分を切り取る(ださい)

        dataImg = Image.fromarray(np.uint8(img))  # 色情報の行列から画像を生成(PILのImage形式)
        if oam.flipH == 1:
            dataImg = dataImg.transpose(Image.FLIP_LEFT_RIGHT)  # PILの機能で水平反転
        if oam.flipV == 1:
            dataImg = dataImg.transpose(Image.FLIP_TOP_BOTTOM)
        qImg = ImageQt(dataImg)  # QImage形式に変換
        pixmap = QtGui.QPixmap.fromImage(qImg)  # QPixmap形式に変換
        return pixmap
    def btnLoadPicture4bpp_triggered(self):
        self.labelShowOutput.setText("Load an image!")

        file_path_4bpp = self.file_path_4bpp
        # print("file_path_4bpp: {}".format(file_path_4bpp))
        self.labelShowOutput.setText(str(self.labelShowOutput.text())+
            "\nfile_path_4bpp: {}".format(file_path_4bpp))
        
        if not os.path.exists(file_path_4bpp):
            print("No path defined!")
            return

        print("Passed!")

        try:
            with open(file_path_4bpp, "rb") as fin:
                self.pix_bin = np.fromfile(fin, dtype=np.uint8)
            if self.pix_bin.shape[0] % 0x40 != 0:
                self.labelShowOutput.setText(str(self.labelShowOutput.text())+
                    "\nself.pix_bin is not % 0x40!!! self.pix_bin.shape[0]: 0x{:0X}".format(self.pix_bin.shape[0]))
        
                raise Exception

            self.pix_idx = utils_4bpp.bin_to_bpp4_idx(self.pix_bin)
            self.idx_orig_size = self.pix_idx.shape[0]

            if self.pix_idx.shape[0] % 0x10 != 0:
                self.pix_idx = np.vstack((self.pix_idx, np.zeros((16-self.pix_idx.shape[0]%16, 8, 8), dtype=np.uint8)))

            self.pix_idx_row = (self.pix_idx
                .transpose(0, 2, 1)
                .reshape((-1, 128, 16))
                .transpose(0, 2, 1)
                .reshape((-1, 128)))

            self.pix_4bpp_rows = self.pix_pal_choosen[self.pix_idx_row]

            # add black lines between the 8x8 tiles!
            # set the width of the seperator line too!
            
            height, width, depth = self.pix_4bpp_rows.shape

            rows = height // 8
            cols = width // 8

            lw = self.seperator_line_width
            pix_4bpp_rows_new = np.zeros((rows*8+(rows+1)*lw,
                                          cols*8+(cols+1)*lw, depth), dtype=np.uint8)
            yh = 8+lw
            xw = 8+lw
            for y in range(0, rows):
                for x in range(0, cols):
                    j = lw+yh*y
                    i = lw+xw*x
                    pix_4bpp_rows_new[j:j+8, i:i+8] = self.pix_4bpp_rows[8*y:8*(y+1), 8*x:8*(x+1)]
            
            if lw > 0:
                for y in range(0, rows+1):
                    pix_4bpp_rows_new[yh*y:yh*y+lw] = self.seperator_color
                for x in range(0, cols+1):
                    pix_4bpp_rows_new[:, xw*x:xw*x+lw] = self.seperator_color

            self.pix_4bpp_rows = pix_4bpp_rows_new

            self.img_2 = Image.fromarray(self.pix_4bpp_rows)
            self.pixmap = Qt.QPixmap.fromImage(ImageQt(self.img_2.resize((self.img_2.width*2, self.img_2.height*2))))
            self.labelPictureTiles.setPixmap(self.pixmap)
            print("Image loaded!")
        except Exception as e:
            traceback.print_exc()
            # e.stack_trace()
            print("Not an Image!")
Пример #20
0
    def OnCreate(self, form):
        self.parent = self.FormToPyQtWidget(form)
        self.pe = pefile.PE(GetInputFilePath())
        self.EntryPoint = self.pe.OPTIONAL_HEADER.AddressOfEntryPoint
        self.ImageBase = self.pe.OPTIONAL_HEADER.ImageBase
        self.section_list = {}
        self.img = []
        self.img_label = []
        self.LineEdit_list = []
        self.PushButton_list = []
        self.label1 = QLabel("Start Offset : ")
        self.label2 = QLabel("Length : ")
        self.label3 = QLabel("Variable name : ")
        self.label4 = QLabel("Icon Size")
        icon1 = QLabel("Icon")
        icon1.setAlignment(Qt.AlignCenter)
        icon2 = QLabel("Icon Size")
        icon2.setAlignment(Qt.AlignCenter)
        icon3 = QLabel("Rule")
        icon3.setAlignment(Qt.AlignCenter)
        icon4 = QLabel("Save Rule")
        icon4.setAlignment(Qt.AlignCenter)

        self.LineEdit1 = QLineEdit()
        self.LineEdit2 = QLineEdit()
        self.LineEdit3 = QLineEdit()
        self.PushButton1 = QPushButton("Enter")
        self.PushButton1.clicked.connect(self.YaraMaker)

        for section in self.pe.sections:
            self.section_list[section.Name.decode("utf-8").replace(
                "\x00", "")] = [
                    hex(section.VirtualAddress),
                    hex(section.SizeOfRawData),
                    hex(section.PointerToRawData)
                ]

        for entry in self.pe.DIRECTORY_ENTRY_RESOURCE.entries:
            resource_type = entry.name
            if resource_type is None:
                resource_type = pefile.RESOURCE_TYPE.get(entry.struct.Id)

            for directory in entry.directory.entries:
                for resource in directory.directory.entries:
                    name = str(resource_type)
                    if name in "RT_ICON":
                        name = str(resource_type)
                        offset = resource.data.struct.OffsetToData
                        size = resource.data.struct.Size
                        RVA_ = int(self.section_list['.rsrc'][0], 16) - int(
                            self.section_list['.rsrc'][2], 16)
                        real_offset = offset - RVA_
                        img_size = hex(size)[2:]
                        if len(img_size) % 2 == 1:
                            img_size = "0" + img_size

                        img_ = "\x00\x00\x01\x00\x01\x00\x30\x30\x00\x00\x01\x00\x08\x00" + bytearray.fromhex(
                            img_size)[::-1] + "\x00\x00\x16\x00\x00\x00"
                        f = open(GetInputFilePath(), "rb")
                        f.seek(real_offset)
                        img_ += f.read(size)
                        f.close()
                        self.img.append(img_)
                        # print(hex(offset), real_offset)

        self.layout = QVBoxLayout()
        GL0 = QGridLayout()
        GL0.addWidget(self.label3, 0, 0)
        GL0.addWidget(self.LineEdit3, 0, 1)
        GL0.addWidget(self.label1, 0, 2)
        GL0.addWidget(self.LineEdit1, 0, 3)
        GL0.addWidget(self.label2, 0, 4)
        GL0.addWidget(self.LineEdit2, 0, 5)
        GL0.addWidget(self.PushButton1, 0, 6)
        self.layout.addLayout(GL0)

        GL1 = QGridLayout()
        GL1.addWidget(icon1, 0, 0)
        GL1.addWidget(icon2, 0, 1)
        GL1.addWidget(icon3, 0, 2)
        GL1.addWidget(icon4, 0, 3)
        for idx, i in enumerate(self.img):
            ## https://stackoverflow.com/questions/35655755/qpixmap-argument-1-has-unexpected-type-pngimagefile?rq=1
            ## https://stackoverflow.com/questions/32908639/open-pil-image-from-byte-file
            image2 = Image.open(io.BytesIO(i))
            qimage = ImageQt(image2)
            pixmap = QPixmap.fromImage(qimage)

            self.img_label.append(QLabel())
            self.img_label[idx].setPixmap(pixmap)
            GL1.addWidget(self.img_label[idx], idx + 1, 0)
            GL1.addWidget(QLabel(hex(len(i))), idx + 1, 1)

            self.LineEdit_list.append(QLineEdit())
            GL1.addWidget(self.LineEdit_list[idx], idx + 1, 2)

            self.PushButton_list.append(QPushButton("Enter"))
            self.PushButton_list[idx].clicked.connect(
                partial(self.SaveIcon, idx))
            GL1.addWidget(self.PushButton_list[idx], idx + 1, 3)

        self.layout.addLayout(GL1)
        self.parent.setLayout(self.layout)
Пример #21
0
 def create_qr(self):
     text = self.textEntry.text()
     img = qrcode.make(text)
     qr = ImageQt(img)
     pix = QPixmap.fromImage(qr)
     self.imageLabel.setPixmap(pix)
Пример #22
0
    def add_images(self, n_param, param, content):
        prev_x = 0
        curr_x = 0

        for i in range(len(self.data)):
            if (n_param == 2):
                #two parameter visualization
                if (param == 0):
                    if i == 0:
                        curr_x = self.values[i, 0] * (2000 / 11)
                    else:
                        curr_x = prev_x + scaled_dim + (
                            self.values[i, 0] - self.values[i - 1, 0]) * (
                                2000 / 11)  #Avoid overlapping
                    curr_y = float(self.values[i, 1]) * (
                        self.height / self.values[:, 1].max())

                    pic = ImageButton(content)
                    labelx = "x=" + str(self.values[i, 0])
                    labely = "y=" + str(self.values[i, 1])
                    pred_x = QtGui.QLabel(
                        labelx, content)  #To show the numerical prediction
                    pred_y = QtGui.QLabel(labely, content)
                    img = Image.open(os.path.join('Images', self.images[i]))
                    img = ImageQt(img)
                    img = QtGui.QPixmap.fromImage(img)
                    pic.setIcon(QtGui.QIcon(img))
                    pic.setIconSize(QtCore.QSize(scaled_dim, scaled_dim))

                    pic.move(curr_x, self.height - curr_y)
                    pred_x.move(curr_x, self.height - curr_y - 24)
                    pred_y.move(curr_x, self.height - curr_y - 12)
                    pic.setStyleSheet('border: none')

                    prev_x = curr_x  #remember the preivous image's coordiante

                #single parameter visualization
                elif (param == 1 or param == 2):  #first parameter
                    if i == 0:
                        curr_x = self.values[i] * (2000 / 11)
                    else:
                        curr_x = prev_x + scaled_dim + (
                            self.values[i] - self.values[i - 1]) * (
                                2000 / 11)  #Avoid overlapping
                    pic = ImageButton(content)
                    pred = QtGui.QLabel(
                        str(self.values[i]),
                        content)  #To show the numerical prediction
                    img = Image.open(os.path.join('Images', self.images[i]))
                    img = ImageQt(img)
                    img = QtGui.QPixmap.fromImage(img)
                    pic.setIcon(QtGui.QIcon(img))
                    pic.setIconSize(QtCore.QSize(scaled_dim, scaled_dim))
                    pic.move(curr_x, 50)
                    pred.move(curr_x, 38)
                    pic.setStyleSheet('border: none')
                    prev_x = curr_x

            #single parameter visualization
            elif (n_param == 1):
                if i == 0:
                    curr_x = 10  #self.values[i]*(2000/11)
                else:
                    curr_x = prev_x + scaled_dim + (
                        self.values[i] - self.values[i - 1]) * (
                            2000 / 11)  #Avoid overlapping
                pic = ImageButton(content)
                pred = QtGui.QLabel(str(self.values[i]),
                                    content)  #To show the numerical prediction
                img = Image.open(os.path.join('Images', self.images[i]))
                img = ImageQt(img)
                img = QtGui.QPixmap.fromImage(img)
                pic.setIcon(QtGui.QIcon(img))
                pic.setIconSize(QtCore.QSize(scaled_dim, scaled_dim))
                pic.move(curr_x, 50)
                pic.setStyleSheet('border: none')
                pred.move(curr_x, 38)
                prev_x = curr_x

            self.width = prev_x  #set the scrollable widget width to be the x-coordinate of the last-added image, i.e. the image with the max parameter value
Пример #23
0
def getQPixmap(dataset):
    imgQt = ImageQt(DatasetTools.get_PIL_image(dataset))
    qImg = QImage(imgQt)
    return QPixmap(qImg)
Пример #24
0
        def render_cell(self):
            self.log.info('render_cell')
            self.log.debug('self.current_sample_id: %d' %
                           self.current_sample_id)
            if len(self.samples) == 0:
                raise Exception('no samples to show!')

            sample = [
                s for s in self.samples if s['id'] == self.current_sample_id
            ][0]
            cell = sample['cell']
            nucleus = sample['nucleus']

            self.renderingMutex.lock()
            if self.renderingThread.isRunning():
                self.log.debug('terminating rendering thread')
                self.renderingThread.quit()
            else:
                self.renderingThread.setIndividual(self.current_sample_id,
                                                   sample)
                self.trigger_render()
            self.renderingMutex.unlock()

            c, r = nucleus.boundary.xy
            r_n, c_n = draw.polygon(r, c)
            self.log.debug('feat id: %d' % sample['id'])

            self.mplEduHist.hide()
            self.imgEdu.clear()
            self.imgCell.clear()
            self.imgPericentrin.clear()
            self.imgTubulin.clear()

            self.lblEduMin.setText('min ' + m.eng_string(
                self.edu[r_n, c_n].min(), format='%0.1f', si=True))
            self.lblEduMax.setText('max ' + m.eng_string(
                self.edu[r_n, c_n].max(), format='%0.1f', si=True))
            self.lblEduAvg.setText('avg ' + m.eng_string(
                self.edu[r_n, c_n].mean(), format='%0.1f', si=True))
            self.lblTubMin.setText('min ' + m.eng_string(
                self.tubulin[r_n, c_n].min(), format='%0.1f', si=True))
            self.lblTubMax.setText('max ' + m.eng_string(
                self.tubulin[r_n, c_n].max(), format='%0.1f', si=True))
            self.lblTubAvg.setText('avg ' + m.eng_string(
                self.tubulin[r_n, c_n].mean(), format='%0.1f', si=True))
            self.lblCentr_n.setText(
                '%d' % len([s
                            for s in sample['centrosomes'] if s is not None]))
            self.lblId.setText('id %d' % sample['id'])
            # self.lblOK.setText('OK' if valid else 'no OK')

            fig = Figure((self.imgCentrCloseup.width() / mydpi,
                          self.imgCentrCloseup.height() / mydpi),
                         subplotpars=sp,
                         dpi=mydpi)
            canvas = FigureCanvas(fig)
            ax = fig.gca()
            ax.set_aspect('equal')
            ax.set_axis_off()
            l, b, w, h = fig.bbox.bounds

            c1 = sample['centrosomes'][0]['pt']
            c2 = sample['centrosomes'][1]['pt']
            self.lblDist_nc.setText('%0.2f' % nucleus.centroid.distance(c1))
            self.lblDist_nb.setText('%0.2f' % nucleus.exterior.distance(c1))
            self.lblDist_cc.setText('%0.2f' % cell.centroid.distance(c1))
            self.lblDist_cb.setText('%0.2f' % cell.exterior.distance(c1))

            ax.imshow(self.pericentrin, cmap='gray')
            if c1 is not None:
                c = plt.Circle((c1.x, c1.y),
                               radius=5,
                               facecolor='none',
                               edgecolor='r',
                               linestyle='--',
                               linewidth=1,
                               zorder=5)
                ax.add_artist(c)
            if c2 is not None:
                c = plt.Circle((c2.x, c2.y),
                               radius=5,
                               facecolor='none',
                               edgecolor='b',
                               linestyle='--',
                               linewidth=1,
                               zorder=5)
                ax.add_artist(c)

            ax.set_xlim(c1.x - w / 8, c1.x + w / 8)
            ax.set_ylim(c1.y - h / 8, c1.y + h / 8)

            qimg_closeup = ImageQt(utils.canvas_to_pil(canvas))
            self.imgCentrCloseup.setPixmap(QPixmap.fromImage(qimg_closeup))
            self.update()
Пример #25
0
    def __init__(self, parent=None):
        super(MainUI, self).__init__()

        self.layers = []
        self.invalited = False
        self.auto_update = True

        self.setWindowTitle("VRoid Eye Generator")
        self.imgBase = Image.open(
            os.path.join(os.path.dirname(sys.argv[0]), "data", "base.png"))
        hbox = QtWidgets.QHBoxLayout()
        self.vbox = QtWidgets.QVBoxLayout()
        hbox2 = QtWidgets.QHBoxLayout()
        self.btnNew = QtWidgets.QPushButton("New")
        hbox2.addWidget(self.btnNew)
        self.btnNew.clicked.connect(self.newEye)
        self.btnOpen = QtWidgets.QPushButton("Open")
        self.btnOpen.clicked.connect(self.openEye)
        hbox2.addWidget(self.btnOpen)
        self.btnSave = QtWidgets.QPushButton("Save As")
        self.btnSave.clicked.connect(self.saveEye)
        hbox2.addWidget(self.btnSave)
        self.vbox.addLayout(hbox2)

        self.lstLayer = QtWidgets.QListWidget()
        self.lstLayer.currentRowChanged[int].connect(self.layerChanged)
        self.lstLayer.setFixedHeight(400)
        self.vbox.addWidget(self.lstLayer)

        self.cmbPane = QtWidgets.QComboBox()
        self.cmbPane.addItem("Fill")
        self.cmbPane.addItem("Linear")
        hbox2 = QtWidgets.QHBoxLayout()
        hbox2.addWidget(self.cmbPane)
        self.btnAdd = QtWidgets.QPushButton("Add")
        self.btnAdd.clicked.connect(self.addLayer)
        hbox2.addWidget(self.btnAdd)
        self.vbox.addLayout(hbox2)

        self.btnRem = QtWidgets.QPushButton("Remove")
        self.btnRem.clicked.connect(self.removeLayer)
        self.vbox.addWidget(self.btnRem)

        self.btnDup = QtWidgets.QPushButton("Duplicate")
        self.btnDup.clicked.connect(self.dupeLayer)
        self.vbox.addWidget(self.btnDup)

        self.btnUp = QtWidgets.QPushButton("move Up")
        self.btnUp.clicked.connect(self.upLayer)
        self.vbox.addWidget(self.btnUp)

        self.btnDown = QtWidgets.QPushButton("move Down")
        self.btnDown.clicked.connect(self.downLayer)
        self.vbox.addWidget(self.btnDown)

        self.btnExport = QtWidgets.QPushButton("Export")
        self.vbox.addWidget(self.btnExport)
        self.btnExport.clicked.connect(self.exportEye)

        hbox.addLayout(self.vbox)

        self.gvMain = QtWidgets.QGraphicsView()
        hbox.addWidget(self.gvMain)
        self.gvScene = QtWidgets.QGraphicsScene()
        self.gvMain.setScene(self.gvScene)
        self.items = []
        self.items.append(QtWidgets.QGraphicsPixmapItem())
        self.gvScene.addItem(self.items[0])
        qim = ImageQt(self.imgBase)
        pix = QtGui.QPixmap.fromImage(qim).copy()
        self.items[0].setPixmap(pix)
        self.setLayout(hbox)

        self.vbox = QtWidgets.QVBoxLayout()
        hbox.addLayout(self.vbox)

        self.addLayer()

        self.imgExport = None
        self.invalited = True
        self.updateBase()
Пример #26
0
 def update(self):
     # Отображаем содержимое QPixmap в объекте QLabel
     # переходим из PIL в Qt
     self.qt_pic = ImageQt(self.curr_pic)
     self.pixmap = QPixmap.fromImage(self.qt_pic).scaled(*self.pic_size)
     self.img.setPixmap(self.pixmap)
Пример #27
0
def qt_img_from_url(url):
    response = requests.get(url)
    img = Image.open(BytesIO(response.content))
    return ImageQt(img)
Пример #28
0
 def screenshot(self):
     im = screenshot()
     qim = ImageQt(im)
     pix = QtGui.QPixmap.fromImage(qim)
     self.pix = pix
Пример #29
0
    def __init__(self):
        image = Reader.readfile('/home/abdul/Comics/images.rar')
        QMainWindow.__init__(self)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)

        ## PRINT ==> SYSTEM
        print('System: ' + platform.system())
        print('Version: ' + platform.release())

        ########################################################################
        ## START - WINDOW ATTRIBUTES
        ########################################################################

        ## REMOVE ==> STANDARD TITLE BAR
        UIFunctions.removeTitleBar(True)
        ## ==> END ##

        ## SET ==> WINDOW TITLE
        self.setWindowTitle('Comic Reader')
        UIFunctions.labelTitle(self, '')
        UIFunctions.labelDescription(self, 'current comic path')
        ## ==> END ##

        ## WINDOW SIZE ==> DEFAULT SIZE
        startSize = QSize(1000, 720)
        self.resize(startSize)
        self.setMinimumSize(startSize)
        # UIFunctions.enableMaximumSize(self, 500, 720)
        ## ==> END ##

        ## ==> CREATE MENUS
        ########################################################################

        ## ==> TOGGLE MENU SIZE
        self.ui.btn_toggle_menu.clicked.connect(
            lambda: UIFunctions.toggleMenu(self, 220, True))
        ## ==> END ##

        ## ==> ADD CUSTOM MENUS
        self.ui.stackedWidget.setMinimumWidth(20)
        UIFunctions.addNewMenu(self, "HOME", "btn_home",
                               "url(:/16x16/icons/16x16/cil-home.png)", True)
        UIFunctions.addNewMenu(self, "THUMBNAILS", "btn_thumbnails",
                               "url(:/16x16/icons/16x16/cil-view-module.png)",
                               True)
        UIFunctions.addNewMenu(self, "SETTINGS", "btn_widgets",
                               "url(:/16x16/icons/16x16/cil-equalizer.png)",
                               False)
        ## ==> END ##

        # START MENU => SELECTION
        UIFunctions.selectStandardMenu(self, "btn_home")
        ## ==> END ##

        ## ==> START PAGE
        self.ui.stackedWidget.setCurrentWidget(self.ui.page_home)

        ## ==> END ##

        ## USER ICON ==> SHOW HIDE
        #UIFunctions.userIcon(self, "WM", "", True)
        ## ==> END ##

        ## ==> MOVE WINDOW / MAXIMIZE / RESTORE
        ########################################################################
        def moveWindow(event):
            # IF MAXIMIZED CHANGE TO NORMAL
            if UIFunctions.returStatus() == 1:
                UIFunctions.maximize_restore(self)

            # MOVE WINDOW
            if event.buttons() == Qt.LeftButton:
                self.move(self.pos() + event.globalPos() - self.dragPos)
                self.dragPos = event.globalPos()
                event.accept()

        # WIDGET TO MOVE
        self.ui.frame_label_top_btns.mouseMoveEvent = moveWindow
        ## ==> END ##

        ## ==> LOAD DEFINITIONS
        ########################################################################
        UIFunctions.uiDefinitions(self)
        ## ==> END ##

        ########################################################################
        ## END - WINDOW ATTRIBUTES
        ############################## ---/--/--- ##############################

        ########################################################################
        #                                                                      #
        ## START -------------- WIDGETS FUNCTIONS/PARAMETERS ---------------- ##
        #                                                                      #
        ## ==> USER CODES BELLOW                                              ##
        ########################################################################
        qim = ImageQt(image)
        pixmap = QPixmap('modified.png')
        self.ui.scroll_label.setPixmap(pixmap)

        ## ==> QTableWidget RARAMETERS
        ########################################################################
        #self.ui.verticalScrollBar().setSectionResizeMode(QtWidgets.QHeaderView.Stretch)

        ## ==> END ##

        ########################################################################
        #                                                                      #
        ## END --------------- WIDGETS FUNCTIONS/PARAMETERS ----------------- ##
        #                                                                      #
        ############################## ---/--/--- ##############################

        ## SHOW ==> MAIN WINDOW
        ########################################################################
        self.show()
Пример #30
0
 def __init__(self, user_name):
     self.user_image = ImageQt(
         image_create.user_image(user_name, "darkblue"))