Esempio n. 1
0
 def stop(self):
     self.timer.stop()
     try:
         self.searchThread.raise_exception()
         self.searchThread.join()
         self.filePreview.append("**** Sucessfully Killed thread **** \n")
     except:
         self.filePreview.append("**** No thread to kill! **** \n")
     pixmap = QPixmap('pictures/sadkitten.jpg')
     w = 440
     h = 200
     pixmap = pixmap.scaled(w,
                            h,
                            aspectMode=Qt.IgnoreAspectRatio,
                            mode=Qt.FastTransformation)
     self.label.setPixmap(pixmap)
     self.loadingBar.setValue(0)
Esempio n. 2
0
    def __init__(self):
        super(MainWindow, self).__init__()
        # Título da janela.
        self.setWindowTitle('QGridLayout com QMainWindow.')

        # Ícone da janela principal
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))
        self.setWindowIcon(icon)

        # Tamanho inicial da janela.
        screen_size = app.desktop().geometry()
        # screen_size = app.primaryScreen().geometry()
        width = screen_size.width()
        height = screen_size.height()
        self.resize(width / 2, height / 2)

        # Tamanho mínimo da janela.
        self.setMinimumSize(width / 2, height / 2)

        # Tamanho maximo da janela.
        self.setMaximumSize(width - 200, height - 200)

        # Layout.
        grid_layout = QGridLayout()

        # Widget central.
        widget = QWidget()
        widget.setLayout(grid_layout)
        self.setCentralWidget(widget)

        button1 = QPushButton('Button 1')
        grid_layout.addWidget(button1, 0, 0)

        button2 = QPushButton('Button 2')
        grid_layout.addWidget(button2, 0, 1)

        button3 = QPushButton('Button 3')
        # addWidget(arg__1, row, column, rowSpan, columnSpan, alignment)
        grid_layout.addWidget(button3, 1, 0, 1, 2)

        button4 = QPushButton('Button 4')
        grid_layout.addWidget(button4, 2, 0)

        button5 = QPushButton('Button 5')
        grid_layout.addWidget(button5, 2, 1)
Esempio n. 3
0
    def __init__(self, groups_list, parent: QObject = None):
        super().__init__(parent)
        self.model = QtCore.QStringListModel(groups_list)

        self.setWindowTitle(self.tr("Set discount value for group"))
        icon = QIcon()
        icon.addFile(u":/discount")
        self.setWindowIcon(icon)

        top_level_layout = QtWidgets.QHBoxLayout(self)
        icon_label = QtWidgets.QLabel(self)
        pixmap = QPixmap(":/discount").scaled(128, 128, Qt.KeepAspectRatio)
        icon_label.setPixmap(pixmap)
        top_level_layout.addWidget(icon_label)

        vertical_layout = QtWidgets.QVBoxLayout(self)
        self.label = QtWidgets.QLabel(self)
        self.label.setText(
            self.tr("Please choose discount group and discount value"))
        vertical_layout.addWidget(self.label)

        self.list_view = QtWidgets.QListView()
        self.list_view.setModel(self.model)
        self.list_view.setSelectionMode(
            QtWidgets.QAbstractItemView.SingleSelection)
        self.list_view.clicked.connect(self._list_item_clicked)
        vertical_layout.addWidget(self.list_view)

        spin_layout = QtWidgets.QHBoxLayout(self)
        spin_layout.addStretch()
        spin_layout.addWidget(QtWidgets.QLabel(self.tr("Discount:"), self))
        self.spinbox_discount = QtWidgets.QDoubleSpinBox(self)
        self.spinbox_discount.setDecimals(1)
        self.spinbox_discount.setMinimum(0)
        self.spinbox_discount.setSingleStep(5)
        self.spinbox_discount.setMaximum(100)
        spin_layout.addWidget(self.spinbox_discount)
        vertical_layout.addLayout(spin_layout)

        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject)
        vertical_layout.addWidget(self.buttons)

        top_level_layout.addLayout(vertical_layout)
Esempio n. 4
0
    def draw(self, qp):
        qp.setWindow(0, 0, self.width(), self.height())  # 设置窗口
        qp.setRenderHint(QPainter.SmoothPixmapTransform)
        # 画框架背景
        qp.setBrush(QColor('#cecece'))  # 框架背景色
        qp.setPen(Qt.NoPen)
        rect = QRect(0, 0, self.width(), self.height())
        qp.drawRect(rect)

        sw, sh = self.width(), self.height()  # 图像窗口宽高

        if not self.opened:
            qp.drawPixmap(sw / 2 - 100, sh / 2 - 100, 200, 200, QPixmap('img/video.svg'))

        # 画图
        if self.opened and self.image is not None:
            ih, iw, _ = self.image.shape
            self.scale = sw / iw if sw / iw < sh / ih else sh / ih  # 缩放比例
            px = round((sw - iw * self.scale) / 2)
            py = round((sh - ih * self.scale) / 2)
            qimage = QImage(self.image.data, iw, ih, 3 * iw, QImage.Format_BGR888)  # 转QImage
            qpixmap = QPixmap.fromImage(qimage.scaled(sw, sh, Qt.KeepAspectRatio))  # 转QPixmap
            pw, ph = qpixmap.width(), qpixmap.height()  # 缩放后的QPixmap大小
            qp.drawPixmap(px, py, qpixmap)

            # 画目标框
            font = QFont()
            font.setFamily('Microsoft YaHei')
            font.setPointSize(10)
            qp.setFont(font)
            brush1 = QBrush(Qt.NoBrush)  # 内部不填充
            qp.setBrush(brush1)
            pen = QPen()
            pen.setWidth(2)  # 边框宽度
            for obj in self.objects:
                rgb = [round(c) for c in obj['color']]
                pen.setColor(QColor(rgb[0], rgb[1], rgb[2]))  # 边框颜色
                qp.setPen(pen)
                # 坐标 宽高
                ox, oy = px + round(pw * obj['x']), py + round(ph * obj['y'])
                ow, oh = round(pw * obj['w']), round(ph * obj['h'])
                obj_rect = QRect(ox, oy, ow, oh)
                qp.drawRect(obj_rect)  # 画矩形框

                # 画 类别 和 置信度
                qp.drawText(ox, oy - 5, str(obj['class']) + str(round(obj['confidence'], 2)))
Esempio n. 5
0
 def loadTestFile(self):
     self.__testFilepath = QFileDialog.getOpenFileName(
         self, "Testing image loading", "/home",
         "Image Files (*.png *.jpg .bmp)")[0]
     if self.__testFilepath and self.__testFilepath[-3:] != "txt":
         self.__image = QLabel(self)
         self.__imagetext = QLabel("Image overview", self)
         self.__imagetext.setFont(QFont("BebasNeue", 20, QFont.Bold))
         self.__imagetext.setAlignment(Qt.AlignCenter)
         self.__image.setAlignment(Qt.AlignCenter)
         self.__image.setObjectName("image")
         self.__image.setGeometry(800, 100, 350, 330)
         self.__imagetext.setGeometry(800, 400, 350, 100)
         self.__image.setPixmap(
             QPixmap(self.__testFilepath[:-4]).scaled(335, 315))
         self.__imagetext.show()
         self.__image.show()
Esempio n. 6
0
    def __init__(self, parent_node_instance):
        super(ShowPoints_NodeInstance_MainWidget, self).__init__()

        # leave these lines ------------------------------
        self.parent_node_instance = parent_node_instance
        # ------------------------------------------------

        self.setStyleSheet('''
            background-color: #333333;
        ''')

        self.setLayout(QVBoxLayout())
        self.label = QLabel()
        pix = QPixmap(200,200)
        self.label.setPixmap(pix)
        self.layout().addWidget(self.label)
        self.resize(200, 200)
Esempio n. 7
0
    def about(self):
        icon = QIcon()
        icon.addPixmap(QPixmap('../../../images/icons/icon.png'))

        message_box = QMessageBox(parent=self)
        message_box.setWindowTitle('Título da caixa de texto')
        message_box.setWindowIcon(icon)
        message_box.setText(
            'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do '
            'eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim '
            'ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut '
            'aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit '
            'in voluptate velit esse cillum dolore eu fugiat nulla pariatur. '
            'Excepteur sint occaecat cupidatat non proident, sunt in culpa '
            'qui officia deserunt mollit anim id est laborum.')
        response = message_box.exec()
        message_box.close()
Esempio n. 8
0
    def initUI(self):
        """
        Initialize the UI of this view.
        Does a lot of stuff.
        """
        self.mainframe.setWindowTitle("Story Creator")

        self.grid = QGridLayout()
        self.setLayout(self.grid)

        imageLabel = QLabel(self)
        logo = QPixmap(json_reader.buildPath("creator_logo.png"))
        imageLabel.setPixmap(logo)
        self.grid.addWidget(imageLabel, 0, 0)

        intframe = QWidget()
        self.grid.addWidget(intframe, 0, 1)

        bGrid = QGridLayout()
        intframe.setLayout(bGrid)

        createSL = QPushButton(intframe, text="Create Social Link")
        createSL.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        createSL.clicked.connect(self.actionS)
        bGrid.addWidget(createSL, 0, 0)

        createPersona = QPushButton(intframe, text="Create Persona")
        createPersona.setSizePolicy(QSizePolicy.Preferred,
                                    QSizePolicy.Expanding)
        createPersona.clicked.connect(self.actionP)
        bGrid.addWidget(createPersona, 1, 0)

        createChar = QPushButton(intframe, text="Create Character")
        createChar.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        createChar.clicked.connect(self.actionC)
        bGrid.addWidget(createChar, 2, 0)

        support = QPushButton(intframe, text="Support/Contact")
        support.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        support.clicked.connect(self.actionE)
        bGrid.addWidget(support, 3, 0)

        quitbutt = QPushButton(intframe, text="Quit")
        quitbutt.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        quitbutt.clicked.connect(self.quit)
        bGrid.addWidget(quitbutt, 4, 0)
Esempio n. 9
0
 def __init__(self):
     super().__init__()
     self.setAttribute(Qt.WA_DeleteOnClose, True)
     ui = self.ui = Ui_MainWindow()
     ui.setupUi(self)
     self.plot_canvas = PlotCanvas(ui.centralwidget)
     ui.plot_history_page.layout().addWidget(self.plot_canvas, 1, 0, 1, 2)
     ui.cancel.clicked.connect(self.on_cancel)
     ui.start.clicked.connect(self.on_start)
     ui.action_game.triggered.connect(self.on_new_game)
     ui.action_new_db.triggered.connect(self.on_new_db)
     ui.action_open_db.triggered.connect(self.on_open_db)
     ui.action_plot.triggered.connect(self.on_plot)
     ui.action_coordinates.triggered.connect(self.on_view_coordinates)
     ui.action_about.triggered.connect(self.on_about)
     ui.toggle_review.clicked.connect(self.on_toggle_review)
     ui.resume_here.clicked.connect(self.on_resume_here)
     ui.rules_close.clicked.connect(self.on_close_rules)
     ui.move_history.currentIndexChanged.connect(self.on_move_history)
     ui.player1.currentIndexChanged.connect(
         lambda new_index: self.on_player_changed(ui.player1, new_index))
     ui.player2.currentIndexChanged.connect(
         lambda new_index: self.on_player_changed(ui.player2, new_index))
     ui.searches1.valueChanged.connect(self.on_searches_changed)
     ui.searches_lock1.stateChanged.connect(self.on_lock_changed)
     ui.searches_lock2.stateChanged.connect(self.on_lock_changed)
     self.cpu_count = cpu_count()
     self.is_history_dirty = False  # Has current game been rewound?
     self.all_displays = []
     self.load_game_list(ui.game_page.layout())
     icon_pixmap = QPixmap(self.icon_path)  # After displays load resources!
     icon = QIcon(icon_pixmap)
     self.setWindowIcon(icon)
     self.start_state: typing.Optional[GameState] = None
     self.display: typing.Optional[GameDisplay] = None
     self.on_new_game()
     self.board_to_resume: typing.Optional[np.ndarray] = None
     self.review_names = [
         name.strip() for name in ui.toggle_review.text().split('/')
     ]
     self.are_coordinates_always_visible = False
     self.game_start_time = datetime.now()
     ui.start_stop_plot.clicked.connect(self.requery_plot)
     ui.history_game.currentIndexChanged.connect(self.requery_plot)
     self._db_session = None
     self.on_toggle_review()
Esempio n. 10
0
 def __init__(self, parent=None):
     super().__init__(parent)
     self.setWindowTitle("My Form")
     self.identifier = QLineEdit('Your login')
     self.pwd = QLineEdit("Put you password")
     self.pwd.setEchoMode(QLineEdit.Password)
     self.button = QPushButton("show Greetings")
     image = QPixmap("toto.jpg")
     label = QLabel(self)
     label.setPixmap(image)
     layout = QVBoxLayout()
     layout.addWidget(label)
     layout.addWidget(self.identifier)
     layout.addWidget(self.pwd)
     layout.addWidget(self.button)
     self.setLayout(layout)
     self.button.clicked.connect(self.greetings)
Esempio n. 11
0
 def __init__(self):
     super(PySet, self).__init__()
     layout = QVBoxLayout(self)
     welcomeLbl = QLabel("Welcome")
     welcomeLbl.setAlignment(Qt.AlignCenter)
     layout.addWidget(welcomeLbl)
     installBtn = QPushButton("Install")
     layout.addWidget(installBtn)
     yamlCfg = self.yamlCfg = yaml.safe_load(open("pyset.yml", "r"))
     self.setWindowTitle(yamlCfg["name"] + " Installation")
     welcomeLbl.setText("Welcome to the installation of " + yamlCfg["name"])
     try:
         if (yamlCfg["pixmap"]):
             welcomeLbl.setPixmap(QPixmap(yamlCfg["pixmap"]))
     except KeyError:
         print("No pixmap")
     installBtn.clicked.connect(self.install)
Esempio n. 12
0
def image_from_path_to_zip(path: str) -> QPixmap:
    """
    Open an archive file at path and return a QPixmap containing the first image found in the archive.
    If no supported images found, returns None.

    :param path: Path to the comic book archive including file name and extension.
    :return: QPixmap
    """

    with ZipFile(path, "r") as my_zip:
        for x in my_zip.filelist:
            if suffix(x.filename) in IMAGE_TYPES:
                image = my_zip.read(x)
                qp = QPixmap()
                qp.loadFromData(image)
                image = qp
                return image
Esempio n. 13
0
    def _get_application_icon() -> QIcon:
        """
        This finds the running blender process, extracts the blender icon from the blender.exe file on disk and saves it to the user's temp folder.
        It then creates a QIcon with that data and returns it.

        Returns QIcon: Application Icon
        """

        icon_filepath = Path(__file__).parent / ".." / "blender_icon_16.png"
        icon = QIcon()

        if icon_filepath.exists():
            image = QImage(str(icon_filepath))
            if not image.isNull():
                icon = QIcon(QPixmap().fromImage(image))

        return icon
Esempio n. 14
0
 def newStart(self):
     pixmap = QPixmap('pictures/roaringKitten.jpg')
     w = 440
     h = 200
     pixmap = pixmap.scaled(w,
                            h,
                            aspectMode=Qt.IgnoreAspectRatio,
                            mode=Qt.FastTransformation)
     self.label.setPixmap(pixmap)
     self.timerBool = True
     global stepper
     stepper = 0
     self.loadingBar.setValue(0)
     self.loadingBar.setStyleSheet(
         "QProgressBar::chunk {background-color: red;} QProgressBar {text-align: center}"
     )
     self.startTracking()
Esempio n. 15
0
    def __init__(self, toolbox, project, logger, name, description, x, y):
        """
        View class.

        Args:
            toolbox (ToolboxUI): a toolbox instance
            project (SpineToolboxProject): the project this item belongs to
            logger (LoggerInterface): a logger instance
            name (str): Object name
            description (str): Object description
            x (float): Initial X coordinate of item icon
            y (float): Initial Y coordinate of item icon
        """
        super().__init__(name, description, x, y, project, logger)
        self._references = dict()
        self.reference_model = QStandardItemModel()  # References to databases
        self._spine_ref_icon = QIcon(QPixmap(":/icons/Spine_db_ref_icon.png"))
Esempio n. 16
0
def to_q_pixmap(image: QPixmap):
    """
    Converts a OpenCV / NumPy array to a QPixmap.
    Expects the image to be 8 bit.
    Is able to convert Grayscale, BGR and ARGG images.

    Parameters
    ----------
    image : np.ndarray
        Input Image

    Returns
    -------
    QPixmap
        The converted QPixmap. If image is None, returns an empty QPixmap.
    """
    return QPixmap(to_q_image(image))
 def init_content(self):
     """initialise new process with empty inputs"""
     self._ui.process_name.setText("Process Name")
     icon = QIcon()
     icon.addPixmap(QPixmap(":/icons/img/[email protected]"),
                    QIcon.Normal, QIcon.Off)
     self._ui.button_icon.setIcon(icon)
     self._section_popup_model.value = OverviewSelection.ENERGY
     self._category_popup_model.value = ProcessCategory.SUPPLY
     self._ui.variables_list.setModel(ListModel([]))
     self._ui.data_list.setModel(ListModel([]))
     self._ui.properties_list.setModel(ListModel([]))
     self._ui.inputs_list.setModel(ListModel([]))
     self._ui.outputs_list.setModel(ListModel([]))
     self._ui.objective_value.setText("Process Objective Function")
     self._ui.constraints_value.setText("Process Constraints")
     self._new_process = True
Esempio n. 18
0
    def initUI(self):

        hbox = QHBoxLayout(self)  # setLayout(hbox) 已经将此对象指向self,
        # 故此处可以省略self

        filePath = 'D:\Documents\Python\Git\Learn-PyQt5-with-ZetCode\\6_subassembly\\'
        pixmap = QPixmap(filePath + 'monkey.png')

        lbl = QLabel()
        lbl.setPixmap(pixmap)
        hbox.addWidget(lbl)

        self.setLayout(hbox)

        self.setGeometry(300, 300, 600, 400)
        self.setWindowTitle('monkey')
        self.show()
def test_decode_image(pixmap_differ):
    # To see an image dumped in the Travis CI log, replace
    # ENCODED_BLUE_GREEN_RECT with "TheEncodedText==" from the log.
    text = ENCODED_BLUE_GREEN_RECT
    image = decode_image(text)

    expected_pixmap = create_blue_green_rect()
    width = max(4, image.width())
    height = max(2, image.height())

    actual: QPainter
    expected: QPainter
    with pixmap_differ.create_painters(width, height,
                                       'decode_image') as (actual, expected):
        actual.drawPixmap(0, 0, QPixmap(image))

        expected.drawPixmap(0, 0, expected_pixmap)
Esempio n. 20
0
def on_response_received(gui, response_value, response_type):
    if response_type == "Average":
        values = response_value.split(',')
        gui.median_val = values[0]
        gui.mean_val = values[1]
        gui.min_val = values[2]
        gui.max_val = values[3]
        gui.widgets["Go"].setEnabled(
            True)  # The worker is done, give the hand back to the user

    elif response_type == "ImageEffect":
        # Fetch image from bucket
        bucket.download_file(response_value, "img_with_effect.jpg")
        # Display it
        gui.widgets["img2"].setPixmap(QPixmap("./img_with_effect.jpg"))
        gui.widgets["Effect1"].setEnabled(True)
        gui.widgets["Effect2"].setEnabled(True)
Esempio n. 21
0
    def __init__(self):
        super().__init__()
        self.mainLayout = QVBoxLayout()
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setMargin(0)
        self.titleFrame = QtWidgets.QFrame()
        self.titleFrame.setObjectName("titleFrame")
        self.titleFrame.setContentsMargins(0, 0, 0, 0)
        self.titleBoxLayout = QtWidgets.QHBoxLayout()
        self.titleBoxLayout.setMargin(0)
        self.titleBoxLayout.setContentsMargins(0, 0, 0, 0)

        self.leftSpaceItem = QtWidgets.QSpacerItem(3, 20, QSizePolicy.Fixed)
        self.middleSpaceItem = QtWidgets.QSpacerItem(5, 20,
                                                     QSizePolicy.Expanding)
        self.minButton = QtWidgets.QToolButton()
        self.minButton.setObjectName("minButton")
        self.maxButton = QtWidgets.QToolButton()
        self.maxButton.setObjectName("maxButton")
        self.closeButton = QtWidgets.QToolButton()
        self.closeButton.setObjectName("closeButton")
        self.appIconLabel = QtWidgets.QLabel()
        self.appIconLabel.setFixedSize(QSize(25, 25))
        self.appIconLabel.setScaledContents(True)
        self.appIconLabel.setPixmap(
            QPixmap(':/icon/Resources/icon/icon-music.png'))
        self.titleContextLabel = QtWidgets.QLabel("网络音乐播放器")
        self.titleContextLabel.setObjectName('titleContextLabel')
        self.contextFont = QFont('微软雅黑', 11)
        self.titleContextLabel.setFont(self.contextFont)
        self.rightSpaceItem = QtWidgets.QSpacerItem(5, 20, QSizePolicy.Fixed)
        self.titleBoxLayout.addItem(self.leftSpaceItem)
        self.titleBoxLayout.addWidget(self.appIconLabel)
        self.titleBoxLayout.addWidget(self.titleContextLabel)
        self.titleBoxLayout.addItem(self.middleSpaceItem)
        self.titleBoxLayout.addWidget(self.minButton)
        self.titleBoxLayout.addWidget(self.maxButton)
        self.titleBoxLayout.addWidget(self.closeButton)
        self.titleBoxLayout.addItem(self.rightSpaceItem)
        self.titleBoxLayout.setSpacing(10)
        self.titleFrame.setLayout(self.titleBoxLayout)
        self.mainLayout.addWidget(self.titleFrame)
        self.setLayout(self.mainLayout)

        self.__connectSignalsAndSlots()
Esempio n. 22
0
    def widget_init(self):
        '''
        Initialize Main widget shape
        '''
        self.widget = QWidget()
        self.setCentralWidget(
            self.widget)  # Add Widget as central window widget

        # Buttons create for navigation bar
        buttonAddTask = QPushButton("Add")
        buttonSave = QPushButton("Save")
        buttonImport = QPushButton("Import")
        buttonExport = QPushButton("Export")
        buttonEdit = QPushButton("Edit")

        # Labels
        whenEmpty = QLabel("List is empty. Add some tasks.")
        # Logo
        logo = QLabel("Pittodo")
        logo.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
        logo.resize(80, 60)
        pixmap = QPixmap('images/logo.png')
        logo.setPixmap(pixmap)

        # QWidget Layouts
        main = QHBoxLayout()
        navigation = QVBoxLayout()
        self.content = QVBoxLayout()

        # Widgets place in layout
        navigation.addWidget(logo)
        navigation.addWidget(buttonAddTask)
        navigation.addWidget(buttonSave)
        navigation.addWidget(buttonImport)
        navigation.addWidget(buttonExport)

        self.content.addWidget(whenEmpty)

        main.addLayout(navigation)
        main.addLayout(self.content)
        #
        self.widget.setLayout(main)

        # Signals and Slots Connections
        buttonAddTask.clicked.connect(self.add_task_clicked)
    def __init__(self, parent=None, imagePath="", scribbleImagePath=""):
        QMainWindow.__init__(self, parent)
        pyside_dynamic.loadUi('mainWindow.ui', self)
        self.show()
        self.setWindowTitle("BaBa - Scribble")

        # connections
        self.bodenBtn.clicked.connect(lambda: self.changedPen('boden'))
        self.baumBtn.clicked.connect(lambda: self.changedPen('baum'))
        self.radiergummiBtn.clicked.connect(
            lambda: self.changedPen('radiergummi'))
        self.bodenSlider.valueChanged.connect(self.refreshSliderValues)
        self.baumSlider.valueChanged.connect(self.refreshSliderValues)
        self.radiergummiSlider.valueChanged.connect(self.refreshSliderValues)

        self.okBtn.clicked.connect(self.okAction)

        # menu
        self.penType = 'boden'
        self.sliderValues = {
            "boden": self.bodenSlider.value(),
            "baum": self.baumSlider.value(),
            "radiergummi": self.radiergummiSlider.value()
        }

        # dimensions
        self.imageAreaWidth = 0
        self.imageAreaHeight = 0

        # Image
        self.imagePath = imagePath
        self.imagePixmap = QPixmap(self.imagePath)
        self.imageLabel = QLabel(self.pictureArea)
        self.imageLabel.setAlignment(Qt.AlignTop)
        self.imageLabel.show()

        # Scribble
        self.scribble = Scribble(self.pictureArea, scribbleImagePath)
        self.scribble.setupScribble(self.imagePixmap.width(),
                                    self.imagePixmap.height())
        self.scribbleMat = None

        # refreshes and reloads: initial trigger
        self.refreshSliderValues()
        self.refreshDimensions()
Esempio n. 24
0
    def initUI(self):
        label1 = QLabel(self)
        label2 = QLabel(self)
        label3 = QLabel(self)
        label4 = QLabel(self)

        label1.setText("这是一个文本标签")
        label1.setAutoFillBackground(True)
        palette = QPalette()
        palette.setColor(QPalette.Window, Qt.blue)
        label1.setPalette(palette)
        label1.setAlignment(Qt.AlignCenter)

        label2.setText("<a href='#'>欢迎使用</a>")

        label3.setAlignment(Qt.AlignCenter)
        label3.setToolTip("这是一个图片标签")
        label3.setPixmap(QPixmap('picture.jpeg'))

        label4.setText("<A href='https://github.com/wangcoolc/'>欢迎</a>")
        label4.setAlignment(Qt.AlignRight)
        label4.setToolTip('这是一个超链接标签')

        vbox = QVBoxLayout()
        vbox.addWidget(label1)
        vbox.addStretch()
        vbox.addWidget(label2)
        vbox.addStretch()
        vbox.addWidget(label3)
        vbox.addStretch()
        vbox.addWidget(label4)

        label2.setOpenExternalLinks(True)

        label4.setOpenExternalLinks(True)

        label4.linkActivated.connect(self.link_clicked)

        label2.linkHovered.connect(self.link_hovered)
        label1.setTextInteractionFlags(Qt.TextSelectableByMouse)

        self.setLayout(vbox)
        self.setWindowTitle('label例子')

        self.show()
Esempio n. 25
0
    def __init__(self, parent):
        super(AboutDialog, self).__init__(parent, title="About SMB3Foundry")

        main_layout = QBoxLayout(QBoxLayout.LeftToRight, self)

        image = QPixmap(str(data_dir.joinpath("foundry.ico"))).scaled(200, 200)

        icon = QLabel(self)
        icon.setPixmap(image)

        main_layout.addWidget(icon)

        text_layout = QBoxLayout(QBoxLayout.TopToBottom)

        text_layout.addWidget(
            QLabel(f"SMB3 Foundry v{get_current_version_name()}", self))
        text_layout.addWidget(HorizontalLine())
        text_layout.addWidget(
            LinkLabel(self, f'By <a href="{LINK_SMB3F}">Michael</a>'))
        text_layout.addWidget((QLabel("", self)))
        text_layout.addWidget(QLabel("With thanks to:", self))
        text_layout.addWidget(
            LinkLabel(
                self,
                f'<a href="{LINK_HUKKA}">Hukka</a> for <a href="{LINK_SMB3WS}">SMB3 Workshop</a>'
            ))
        text_layout.addWidget(
            LinkLabel(
                self,
                f'<a href="{LINK_SOUTHBIRD}">Captain Southbird</a> '
                f'for the <a href="{LINK_DISASM}">SMB3 Disassembly</a>',
            ))
        text_layout.addWidget(
            LinkLabel(
                self,
                f'<a href="{LINK_PIJOKRA}">PiJoKra</a> for helping to parse the disassembly'
            ))
        text_layout.addWidget(
            LinkLabel(
                self,
                f'<a href="{LINK_BLUEFINCH}">BlueFinch</a>, ZacMario and '
                f'<a href="{LINK_SKY}">SKJyannick</a> for testing and sanity checking',
            ))

        main_layout.addLayout(text_layout)
    def __init__(self):
        QWidget.__init__(self)

        #Paths
        self.folderPath = "../Crop_Reports/Bengal Crop Reports PNG/"
        self.index = 0
        self.page_index = 0
        self.crop_report = ""
        self.pixmap = QPixmap()

        self.data = pd.read_csv("../Crop_Reports/Manual Check Crop Reports/crop_reports_verified.csv")

        #choices
        self.choices = listdir(self.folderPath)




        self.scene = QGraphicsScene()
        self.image = QGraphicsView(self.scene)
        self.image.show()
        self.submitButton = QPushButton("Submit")
        self.dateText = QLineEdit("")



        self.middle = QVBoxLayout()
        self.middle.setMargin(10)
        self.middle.addWidget(self.image)

        self.middle.addWidget(self.dateText)
        self.middle.addWidget(self.submitButton)


        # QWidget Layout
        self.layout = QHBoxLayout()
        self.layout.addLayout(self.middle)



        # Set the layout to the QWidget
        self.setLayout(self.layout)

        # Here we connect widgets to functions
        self.submitButton.clicked.connect(self.submit)
Esempio n. 27
0
    def openFileDialog(self):
        if self.mainWindow.ui.Pages.currentIndex() == 0:
            self.mainWindow.ui.plainTextEditFilePathImage.clear()
            self.mainWindow.ui.plainTextEditOutputImage.clear()
            self.mainWindow.whichImage = 0

            filters = "Obrazy (*.bmp *.png *.jpeg *.tiff)"
            self.dialog = QFileDialog.getOpenFileNames(self.mainWindow,
                                                       "/home", "", filters)

            if len(self.dialog[0]) > 0:
                self.mainWindow.listOfElementsToRecognize.clear()
                uiFunction = UiFunction(self.mainWindow)
                progressDialog = uiFunction.progressBarDialog(
                    "Ładowanie obrazów", len(self.dialog[0]))

                for i in range(0, len(self.dialog[0])):
                    self.mainWindow.ui.plainTextEditFilePathImage.appendPlainText(
                        str(self.dialog[0][i]) + "\n")
                    self.mainWindow.listOfElementsToRecognize.append(
                        str(self.dialog[0][i]))
                    progressDialog.setValue(i)
                    if progressDialog.wasCanceled():
                        break
                progressDialog.setValue(len(self.dialog[0]))

                try:
                    #to preview in QLabel image before must be change to QPixmap
                    pixmap = QPixmap(str(self.dialog[0][0])).scaled(
                        self.mainWindow.ui.previewImage.maximumHeight(),
                        self.mainWindow.ui.previewImage.maximumWidth(),
                        QtCore.Qt.KeepAspectRatio,
                        QtCore.Qt.SmoothTransformation)
                    self.mainWindow.ui.previewImage.setPixmap(pixmap)
                    self.mainWindow.ui.previewImage.setScaledContents(True)
                    self.mainWindow.whichImage = 0

                    self.mainWindow.ui.labelCurrentImageNumber.setText(
                        str(self.mainWindow.whichImage + 1))
                    self.mainWindow.ui.labelAllImageCountImage.setText(
                        str(len(self.mainWindow.listOfElementsToRecognize)))
                except Exception as inst:
                    UiFunction.showErrorDialog(inst)
            else:
                return
Esempio n. 28
0
    def SetPicture(self, data):
        if not data:
            return
        pic = QPixmap()
        pic.loadFromData(data)
        # maxW = self.picIcon.width()
        # maxH = self.picIcon.height()
        # picW = pic.width()
        # picH = pic.height()
        # if maxW / picW < maxH / picH:
        #     toW = maxW
        #     toH = (picH/(picW/maxW))
        # else:
        #     toH = maxH
        #     toW = (picW / (picH / maxH))
        newPic = pic.scaled(self.picIcon.width(), self.picIcon.height(), Qt.KeepAspectRatio, Qt.SmoothTransformation)

        self.picIcon.setPixmap(newPic)
Esempio n. 29
0
    def __init__(self, params):
        MWB.__init__(self, params)
        QWidget.__init__(self)

        

        self.setStyleSheet('''
background-color: #0C1C23;
border: none;
        ''')

        self.setLayout(QVBoxLayout())
        self.label = QLabel()
        pix = QPixmap(200, 200)
        self.label.setPixmap(pix)
        #self.setContentMargins(0)
        self.layout().addWidget(self.label)
        self.resize(200, 200)
Esempio n. 30
0
    def setupUi(self, widget):
        super().setupUi(widget)

        self.label_nfc = QLabel(self.frame_main)
        self.label_nfc.setGeometry(QRect(200, 70, 400, 40))
        self.label_nfc.setText("등록할 NFC가 있다면 지금 태그해주세요")
        self.label_nfc.setAlignment(Qt.AlignCenter)

        pix_nfc = QPixmap(str(PATH_IMG / "NFC.jpg"))
        self.img_nfc = QLabel(self.frame_main)
        self.img_nfc.setGeometry(QRect(360, 140, 80, 80))
        self.img_nfc.setStyleSheet("border: none;")
        self.img_nfc.setPixmap(pix_nfc)

        self.label_nfc_status = QLabel(self.frame_main)
        self.label_nfc_status.setGeometry(QRect(200, 250, 400, 40))
        self.label_nfc_status.setText("Not Tagged Yet")
        self.label_nfc_status.setAlignment(Qt.AlignCenter)