Python PyQt5.QtGui 模块,QPixmap() 实例源码

我们从Python开源项目中,提取了以下48个代码示例,用于说明如何使用PyQt5.QtGui.QPixmap()

项目:Milis-Yukleyici    作者:sonakinci41    | 项目源码 | 文件源码
def __init__(self, ebeveyn=None):
        super(Son, self).__init__(ebeveyn)
        self.e = ebeveyn
        self.kapanacak_mi =False

        kutu = QGridLayout()
        self.setLayout(kutu)

        milis_logo = QLabel()
        milis_logo.setAlignment(Qt.AlignCenter)
        milis_logo.setPixmap(QPixmap("./resimler/milis-logo.svg"))
        kutu.addWidget(milis_logo,0,0,1,2)

        self.veda_label = QLabel()
        self.veda_label.setAlignment(Qt.AlignCenter)
        self.veda_label.setWordWrap(True)
        kutu.addWidget(self.veda_label,1,0,1,2)

        self.denemeye_devam = QRadioButton()
        self.denemeye_devam.setIcon(QIcon("./resimler/cik.svg"))
        self.denemeye_devam.setIconSize(QSize(50,50))
        self.denemeye_devam.toggled.connect(self.degisti)
        kutu.addWidget(self.denemeye_devam,2,0,1,1)
        self.kapat = QRadioButton()
        self.kapat.setIcon(QIcon("./resimler/yeniden-baslat.svg"))
        self.kapat.setIconSize(QSize(50,50))
        self.kapat.toggled.connect(self.degisti)
        kutu.addWidget(self.kapat,2,1,1,1)

        self.denemeye_devam.setChecked(True)
项目:specton    作者:somesortoferror    | 项目源码 | 文件源码
def setupUi(self, FileInfoDialog):
        FileInfoDialog.setObjectName("FileInfoDialog")
        FileInfoDialog.resize(579, 472)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("icons/157-stats-bars.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        FileInfoDialog.setWindowIcon(icon)
        self.gridLayout = QtWidgets.QGridLayout(FileInfoDialog)
        self.gridLayout.setObjectName("gridLayout")
        self.gridLayout_2 = QtWidgets.QGridLayout()
        self.gridLayout_2.setObjectName("gridLayout_2")
        self.tabWidget = QtWidgets.QTabWidget(FileInfoDialog)
        self.tabWidget.setObjectName("tabWidget")
        self.gridLayout_2.addWidget(self.tabWidget, 0, 0, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(FileInfoDialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Close)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout_2.addWidget(self.buttonBox, 1, 0, 1, 1)
        self.gridLayout.addLayout(self.gridLayout_2, 0, 0, 1, 1)

        self.retranslateUi(FileInfoDialog)
        self.tabWidget.setCurrentIndex(-1)
        self.buttonBox.accepted.connect(FileInfoDialog.accept)
        self.buttonBox.rejected.connect(FileInfoDialog.reject)
        QtCore.QMetaObject.connectSlotsByName(FileInfoDialog)
项目:kawaii-player    作者:kanishka-linux    | 项目源码 | 文件源码
def set_mainwindow_palette(fanart, first_time=None):
    logger.info('\n{0}:  mainwindow background\n'.format(fanart))
    if fanart.endswith('default.jpg'):
        default_dir, default_img = os.path.split(fanart)
        default_fit = os.path.join(default_dir, 'default_fit.jpg')
        if not os.path.exists(default_fit):
            ui.image_fit_option(fanart, default_fit, fit_size=1)
        fanart = default_fit

    if not os.path.isfile(fanart) or ui.keep_background_constant:
        fanart = ui.default_background
    if os.path.isfile(fanart):
        if not ui.keep_background_constant or first_time:
            palette = QtGui.QPalette()
            palette.setBrush(QtGui.QPalette.Background, 
                            QtGui.QBrush(QtGui.QPixmap(fanart)))
            MainWindow.setPalette(palette)
            ui.current_background = fanart
项目:FuME    作者:fupadev    | 项目源码 | 文件源码
def __init__(self, data, parent=None):
        super(UpdateDialog, self).__init__(parent)
        self.setupUi(self)
        self.setModal(True)
        self.data = data

        self.label.setPixmap(QtGui.QPixmap(data['logo']))
        self.settings = QtCore.QSettings('fume', 'Match-Explorer')

        self.wouldYouLikeToDownloadLabel.setText(
            "FuME {latest} ist verfügbar (Du verwendest Version {current}). "
            "Möchtest du die neue Version jetzt herunterladen?".format(current=data['current'], latest=data['latest']))

        self.textEdit.setText(data['changelog'])

        # restore check state
        self.checkBox.setChecked(self.settings.value('updates/noautoupdate', False, bool))

        # Connections
        self.skipThisVersionButton.clicked.connect(self.skipThisVersion)
        self.remindMeLaterButton.clicked.connect(self.close)
        self.installUpdateButton.clicked.connect(self.installUpdates)
        self.checkBox.stateChanged.connect(self.noAutoUpdates)
项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def drawUI(self, song_name="blank", song_artist="blank"):
        self.art = QLabel(self)
        self.art.resize(50, 50)
        #self.art.setPixmap(QPixmap("".join([song_name,'.jpg'])).scaled(50, 50, Qt.KeepAspectRatio, Qt.SmoothTransformation))

        self.song_label = QLabel(self)
        self.song_label.setText(song_name)
        self.song_label.setStyleSheet("border-image: rgba(0, 0, 0, 0); color: rgba(255, 255, 255); font-size: 12pt; font-weight: 600;")
        self.song_label.move(60, 10)
        self.song_label.resize(180, 15)

        self.artist_label = QLabel(self)
        self.artist_label.setText(song_artist)
        self.artist_label.setStyleSheet("border-image: rgba(0, 0, 0, 0); color: rgba(255, 255, 255); font-size: 12pt; font-weight: 200;")
        self.artist_label.move(60, 25)
        self.artist_label.resize(180, 15)
项目:Dolphin-Updater    作者:nbear3    | 项目源码 | 文件源码
def __init__(self, user_data_control):
        super().__init__()
        sys.excepthook = self._displayError
        self._udc = user_data_control

        self.check = QPixmap("res/check.png")
        self.cancel = QPixmap("res/cancel.png")

        self.setGeometry(500, 500, 500, 465)
        self.init_ui()
        self.init_window()
        self.init_user_data()

        self.setWindowTitle(self.APP_TITLE)
        self.setWindowIcon(QIcon('res/rabbit.png'))
        center(self)
        self.show()

    # PyQt Error Handling
项目:Dolphin-Updater    作者:nbear3    | 项目源码 | 文件源码
def download_new(self):
        dolphin_dir = self.dolphin_dir.text()
        version = self.version.text()

        if self.current.text() == version:
            self.show_warning('You already have the most recent version.')
            return
        elif not os.path.isdir(dolphin_dir):
            self.show_warning('Your dolphin folder path is invalid.')
            self.dolphin_dir_status.setPixmap(QPixmap("res/cancel.png"))
            return

        if not self.download_thread.isRunning():
            if dir == 'Please Select a Dolphin Directory':
                self.show_warning('Please select a dolphin folder.')

            self.version.setText('')
            self.download_thread.update(dolphin_dir, version)
            self.download_thread.start()
项目:Computer-graphics    作者:Panda-Lewandowski    | 项目源码 | 文件源码
def get_pixel(point):
    global w, point_zat, circle
    pix = QPixmap()
    if circle:
        r = w.rad.value()
        draw_circle(w.image, r, point)
        circle = False
    if point_zat:
        w.p_x.setValue(point.x())
        w.p_y.setValue(point.y())
        draw_edges(w.image, w.edges)
        point_zat = False
    pix.convertFromImage(w.image)
    w.scene.addPixmap(pix)
    w.lock.setDisabled(False)
    w.erase.setDisabled(False)
    w.paint.setDisabled(False)
    w.addpoint.setDisabled(False)
    w.addcircle.setDisabled(False)
    w.pixel.setDisabled(False)
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def __init__(self):
        self.scene = QGraphicsScene()
        super().__init__(self.scene)

        self.sheethandler = None    # Will be set externally

        self.setDragMode(QGraphicsView.RubberBandDrag)

        self.emptySheet = True  # Don't allow any modifications until a new sheet is created or loaded

        self.backgroundPixmap = QPixmap("resources/grid.jpg")
        self.bgBrush = QBrush(self.backgroundPixmap)
        self.scene.setBackgroundBrush(self.bgBrush)

        self.modman = ModuleManager()

        self.initnode = None
        self.loopnode = None

        #self.newSheet()
        #self.loadSheet(json.loads("""{"loopnode":"85a1abbd6d86462bbdad9639086b503e","85a1abbd6d86462bbdad9639086b503e":{"inputs":[],"nodename":"drluke.builtin.Loop","pos":[0,144],"outputs":[[]]},"52667c109d734f8883c74cf1a659b675":{"inputs":[],"nodename":"drluke.builtin.Init","pos":[0,0],"outputs":[[]]},"initnode":"52667c109d734f8883c74cf1a659b675"}"""))
        #self.loadRelationship(json.loads("""{"loopnode":"4e742e8ccb554213a9efe10431400637","c1e809fe45f340bfa1e68ed0a5429fb0":{"outputs":[[],[]],"pos":[431,108],"inputs":[[["dbb2a2812a4d42209e6b7aa635fca477",0]],[]],"nodename":"drluke.testmodule.TestNode"},"dbb2a2812a4d42209e6b7aa635fca477":{"outputs":[[["c1e809fe45f340bfa1e68ed0a5429fb0",0]],[]],"pos":[187,85],"inputs":[[["d7e6f0fe49fd4c598fdd4503bcffbd9c",0],["4e742e8ccb554213a9efe10431400637",0]],[]],"nodename":"drluke.testmodule.TestNode"},"d7e6f0fe49fd4c598fdd4503bcffbd9c":{"outputs":[[["dbb2a2812a4d42209e6b7aa635fca477",0]]],"pos":[0,0],"inputs":[],"nodename":"drluke.builtin.Init"},"4e742e8ccb554213a9efe10431400637":{"outputs":[[["dbb2a2812a4d42209e6b7aa635fca477",0]]],"pos":[0,200],"inputs":[],"nodename":"drluke.builtin.Loop"},"initnode":"d7e6f0fe49fd4c598fdd4503bcffbd9c"}"""))
项目:networkzero    作者:tjguk    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(Adventure, self).__init__(parent)

        #
        # Top-half of the
        #
        self.image_panel = QtWidgets.QLabel()
        self.image_panel.setAlignment(QtCore.Qt.AlignCenter)
        self.image = QtGui.QPixmap("image.jpg")
        self.image_panel.setPixmap(self.image)

        self.text_panel = QtWidgets.QTextEdit()
        self.text_panel.setReadOnly(True)
        self.text_panel.setTextBackgroundColor(QtGui.QColor("blue"))
        self.text_panel.setHtml("""<h1>Hello, World!</h1>

        <p>You are in a spacious ballroom with the sound of music playing all around you.</p>
        """)

        self.data_panel = QtWidgets.QTextEdit()
        self.data_panel.setReadOnly(True)

        self.input = QtWidgets.QLineEdit()

        layout = QtWidgets.QVBoxLayout()
        layout.addWidget(self.image_panel, 1)
        hlayout = QtWidgets.QHBoxLayout()
        hlayout.addWidget(self.text_panel, 3)
        hlayout.addWidget(self.data_panel, 1)
        layout.addLayout(hlayout, 1)
        layout.addWidget(self.input)

        self.setLayout(layout)
        self.setWindowTitle("Westpark Adventure")
项目:Flashlapse_NEO    作者:flashlapsedev    | 项目源码 | 文件源码
def half_color_change_left(self):
        temp = self.Left_Select.currentIndex()
        if temp == 1:
            ASD.write(bytes('y', 'UTF-8'))
            self.Half_Left.setPixmap(QtGui.QPixmap("../_image/Color_None_Left.png"))
        elif temp == 2:
            ASD.write(bytes('d', 'UTF-8'))
            self.Half_Left.setPixmap(QtGui.QPixmap("../_image/Color_Red_left.png"))
        elif temp == 3:
            ASD.write(bytes('e', 'UTF-8'))
            self.Half_Left.setPixmap(QtGui.QPixmap("../_image/Color_Red_left.png"))
        elif temp == 4:
            ASD.write(bytes('f', 'UTF-8'))
            self.Half_Left.setPixmap(QtGui.QPixmap("../_image/Color_Red_left.png"))
        elif temp == 0:
            ASD.write(bytes('B', 'UTF-8'))
            self.Half_Left.setPixmap(QtGui.QPixmap("../_image/Color_None_Left.png"))

            self.Color_Frame.setPixmap(QtGui.QPixmap("../_image/Color_None.png"))
项目:Flashlapse_NEO    作者:flashlapsedev    | 项目源码 | 文件源码
def half_color_change_right(self):
        temp = self.Right_Select.currentIndex()
        if temp == 1:
            ASD.write(bytes('x', 'UTF-8'))
            self.Half_Right.setPixmap(QtGui.QPixmap("../_image/Color_None_Right.png"))
        elif temp == 2:
            ASD.write(bytes('a', 'UTF-8'))
            self.Half_Right.setPixmap(QtGui.QPixmap("../_image/Color_Red_Right.png"))
        elif temp == 3:
            ASD.write(bytes('b', 'UTF-8'))
            self.Half_Right.setPixmap(QtGui.QPixmap("../_image/Color_Green_Right.png"))
        elif temp == 4:
            ASD.write(bytes('c', 'UTF-8'))
            self.Half_Right.setPixmap(QtGui.QPixmap("../_image/Color_Blue_Right.png"))
        elif temp == 0:
            ASD.write(bytes('A', 'UTF-8'))
            self.Half_Right.setPixmap(QtGui.QPixmap("../_image/Color_None_Right.png"))

        self.Color_Frame.setPixmap(QtGui.QPixmap("../_image/Color_None.png"))
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def __init__(self, parent, slider: VideoSlider):
        super(VideoSliderWidget, self).__init__(parent)
        self.parent = parent
        self.slider = slider
        self.loaderEffect = OpacityEffect()
        self.loaderEffect.setEnabled(False)
        self.setGraphicsEffect(self.loaderEffect)
        self.setContentsMargins(0, 0, 0, 0)
        self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.layout().setStackingMode(QStackedLayout.StackAll)
        self.genlabel = QLabel(self.parent)
        self.genlabel.setContentsMargins(0, 0, 0, 14)
        self.genlabel.setPixmap(QPixmap(':/images/generating-thumbs.png'))
        self.genlabel.setAlignment(Qt.AlignCenter)
        self.genlabel.hide()
        sliderLayout = QGridLayout()
        sliderLayout.setContentsMargins(0, 0, 0, 0)
        sliderLayout.setSpacing(0)
        sliderLayout.addWidget(self.slider, 0, 0)
        sliderLayout.addWidget(self.genlabel, 0, 0)
        sliderWidget = QWidget(self.parent)
        sliderWidget.setLayout(sliderLayout)
        self.addWidget(sliderWidget)
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def showKeyRef(self) -> None:
        shortcuts = QWidget(self)
        shortcuts.setWindowFlags(Qt.Dialog | Qt.WindowCloseButtonHint)
        shortcuts.setObjectName('shortcuts')
        shortcuts.setAttribute(Qt.WA_DeleteOnClose, True)
        buttons = QDialogButtonBox(QDialogButtonBox.Ok)
        buttons.accepted.connect(shortcuts.close)
        layout = QVBoxLayout()
        # noinspection PyArgumentList
        layout.addWidget(QLabel(pixmap=QPixmap(':/images/{}/shortcuts.png'.format(self.theme))))
        layout.addWidget(buttons)
        shortcuts.setLayout(layout)
        shortcuts.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred)
        shortcuts.setContentsMargins(10, 10, 10, 10)
        shortcuts.setWindowModality(Qt.NonModal)
        shortcuts.setWindowTitle('Keyboard shortcuts')
        shortcuts.setMinimumWidth(400 if self.parent.scale == 'LOW' else 600)
        shortcuts.show()
项目:TrezorSymmetricFileEncryption    作者:8go    | 项目源码 | 文件源码
def printAbout(self):
        """
        Show window with about and version information.
        """
        msgBox = QMessageBox(QMessageBox.Information, "About",
            "About <b>" + basics.NAME + "</b>: <br><br>" + basics.NAME + " " +
            "is a file encryption and decryption tool using a Trezor hardware "
            "device for safety and security. Symmetric AES cryptography is used "
            "at its core. <br><br>" +
            "<b>" + basics.NAME + " Version: </b>" + basics.VERSION_STR +
            " from " + basics.VERSION_DATE_STR +
            "<br><br><b>Python Version: </b>" + sys.version.replace(" \n", "; ") +
            "<br><br><b>Qt Version: </b>" + QT_VERSION_STR +
            "<br><br><b>PyQt Version: </b>" + PYQT_VERSION_STR)
        msgBox.setIconPixmap(QPixmap(basics.LOGO_IMAGE))
        msgBox.exec_()
项目:kawaii-player    作者:kanishka-linux    | 项目源码 | 文件源码
def __init__(self, parent=None, ui_widget=None, home=None, window=None, logr=None):
        global ui, MainWindow, logger
        QtWidgets.QSystemTrayIcon.__init__(self, parent)
        ui = parent
        MainWindow = window
        logger = logr
        icon_img = os.path.join(home, 'src', 'tray.png')
        self.right_menu = RightClickMenuIndicator(ui_widget=ui_widget,
                                                  window=window, logr=logr)
        self.setContextMenu(self.right_menu)

        self.activated.connect(self.onTrayIconActivated)
        self.p = QtGui.QPixmap(24, 24)
        self.p.fill(QtGui.QColor("transparent"))
        painter = QtGui.QPainter(self.p)
        if os.path.exists(icon_img):
            self.setIcon(QtGui.QIcon(icon_img))
        else:
            self.setIcon(QtGui.QIcon(""))
        self.full_scr = 1
        del painter
项目:kawaii-player    作者:kanishka-linux    | 项目源码 | 文件源码
def epn_highlight(self):
        global home, site
        num = self.list2.currentRow()
        move_ahead = True
        if num < 0:
            move_ahead = False
        if self.list2.currentItem() and num < len(self.epn_arr_list) and move_ahead:
            epn_h = self.list2.currentItem().text()
            picn = self.get_thumbnail_image_path(num, self.epn_arr_list[num])
            label_name = 'label.'+os.path.basename(picn)
            path_thumb, new_title = os.path.split(picn)
            new_picn = os.path.join(path_thumb, label_name)
            if os.path.exists(picn):
                if not picn.endswith('default.jpg'):
                    if not os.path.exists(new_picn):
                        self.image_fit_option(picn, new_picn, fit_size=6, widget=self.label)
                    if os.path.isfile(new_picn):
                        self.label.setPixmap(QtGui.QPixmap(new_picn, "1"))
            txt_file = new_title.replace('.jpg', '.txt', 1)
            txt_path = os.path.join(path_thumb, txt_file)
            if os.path.isfile(txt_path):
                #logger.debug(txt_path)
                summary = open_files(txt_path, False)
                self.text.setText(summary)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def AddShapeRowLayer(self, shape, parent_item):
        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/shape.png"))
        item_col_0 = QStandardItem(icon, "")
        item_col_0.setData(QVariantShape(shape), SHAPE_OBJECT)  # store a ref in our treeView element
        item_col_1 = QStandardItem(shape.type)
        item_col_2 = QStandardItem(str(shape.nr))
        item_col_3 = QStandardItem()
        parent_item.appendRow([item_col_0, item_col_1, item_col_2, item_col_3])

        # Deal with the checkboxes (shape enabled or disabled / send shape to TSP optimizer)
        item_col_0.setCheckState(QtCore.Qt.Unchecked if shape.isDisabled() else QtCore.Qt.Checked)
        item_col_3.setCheckState(QtCore.Qt.Checked if shape.isToolPathOptimized() else QtCore.Qt.Unchecked)

        flags = QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsSelectable
        if shape.allowedToChange:
            flags |= QtCore.Qt.ItemIsEnabled
        item_col_0.setFlags(flags | QtCore.Qt.ItemIsUserCheckable)
        item_col_1.setFlags(flags)
        item_col_2.setFlags(flags)
        item_col_3.setFlags(flags | QtCore.Qt.ItemIsUserCheckable)
项目:dxf2gcode    作者:cnc-club    | 项目源码 | 文件源码
def AddCustomGCodeRowLayer(self, custom_gcode, parent_item, push_row=None):
        icon = QIcon()
        icon.addPixmap(QPixmap(":/images/custom.png"))
        item_col_0 = QStandardItem(icon, "")  # will only display a checkbox + an icon that will never be disabled
        item_col_0.setData(QtCore.QVariant(custom_gcode), CUSTOM_GCODE_OBJECT)  # store a ref to the custom gcode in our treeView element
        item_col_1 = QStandardItem(custom_gcode.name)
        item_col_2 = QStandardItem(str(custom_gcode.nr))
        item_col_3 = QStandardItem()
        if push_row:
            parent_item.insertRow(push_row, [item_col_0, item_col_1, item_col_2, item_col_3])
        else:
            parent_item.appendRow([item_col_0, item_col_1, item_col_2, item_col_3])

        # Deal with the checkboxes (shape enabled or disabled / send shape to TSP optimizer)
        item_col_0.setCheckState(QtCore.Qt.Unchecked if custom_gcode.isDisabled() else QtCore.Qt.Checked)

        flags = QtCore.Qt.ItemIsDragEnabled | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
        item_col_0.setFlags(flags | QtCore.Qt.ItemIsUserCheckable)
        item_col_1.setFlags(flags)
        item_col_2.setFlags(flags)
        item_col_3.setFlags(flags)
项目:defconQt    作者:trufont    | 项目源码 | 文件源码
def QPixmapFactory(image):
    font = image.font
    if font is None:
        return None
    layer = image.layer
    images = font.images
    if image.fileName not in images:
        return None
    imageColor = image.color
    data = images[image.fileName]
    pixmap = QPixmap()
    pixmap.loadFromData(data)
    if imageColor is not None:
        colorEffect = QGraphicsColorizeEffect()
        colorEffect.setColor(colorToQColor(imageColor))
        colorEffect.setStrength(.8)
        return applyEffectToPixmap(pixmap, colorEffect)
    return pixmap
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def init_btn_icon(self):
        """
        init button icon, including: save button?run button?show/hide console button
        :return:
        """
        save_icon = QIcon()
        save_icon.addPixmap(QPixmap(self.config.images + '/save.png'), QIcon.Normal, QIcon.Off)  # save icon
        self.save_btn.setIcon(save_icon)

        run_icon = QIcon()
        run_icon.addPixmap(QPixmap(self.config.images + '/run.png'), QIcon.Normal, QIcon.Off)  # run icon
        self.run_btn.setIcon(run_icon)

        console_icon = QIcon()
        console_icon.addPixmap(QPixmap(self.config.images + '/console.png'), QIcon.Normal, QIcon.Off)  # console icon
        self.console_btn.setIcon(console_icon)

        edit_data_icon = QIcon()
        edit_data_icon.addPixmap(QPixmap(self.config.images + '/edit.png'), QIcon.Normal, QIcon.Off)  # console icon
        self.edit_data_btn.setIcon(edit_data_icon)
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def set_tag_name_completer(self):
        """
        set completer to tag_names_line_edit
        :return:
        """
        # change button icon
        add_icon = QIcon()
        add_icon.addPixmap(QPixmap(self.config.images + '/add.png'), QIcon.Normal, QIcon.Off)
        self.add_tag_button.setIcon(add_icon)
        self.add_tag_button.setToolTip("add tag")

        self.tag_names_line_edit.setPlaceholderText("Tag Names")
        self.tag_layout.insertWidget(0, self.tag_names_line_edit)

        self.tag_list = self.dBCommandLineHelper.query_tag_all()  # get all tags
        tag_name_list = []
        for tag in self.tag_list:
            tag_name_list.append(tag.name)
        cmp = TagCompleter(tag_name_list)
        self.tag_names_line_edit.setCompleter(cmp)
项目:lilii    作者:LimeLinux    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__()
        self.parent = parent
        self.setFixedHeight(100)
        self.setLayout(QHBoxLayout())
        self.layout().addSpacing(0)

        self.logo = QLabel()
        self.logo.setFixedSize(72, 72)
        self.logo.setScaledContents(True)
        self.logo.setPixmap(QPixmap(":/images/lime-logo.svg"))
        self.layout().addWidget(self.logo)

        self.layout().addSpacerItem(QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Expanding))

        self.lprogressBar = LProgressBar(self.parent)
        self.layout().addWidget(self.lprogressBar)

        self.parent.currentChanged.connect(self.lprogressBar.setIndex)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self):
        super(StickMan, self).__init__()

        self.m_sticks = True
        self.m_isDead = False
        self.m_pixmap = QPixmap('images/head.png')
        self.m_penColor = QColor(Qt.white)
        self.m_fillColor = QColor(Qt.black)

        # Set up start position of limbs.
        self.m_nodes = []
        for x, y in Coords:
            node = Node(QPointF(x, y), self)
            node.positionChanged.connect(self.childPositionChanged)
            self.m_nodes.append(node)

        self.m_perfectBoneLengths = []
        for n1, n2 in Bones:
            node1 = self.m_nodes[n1]
            node2 = self.m_nodes[n2]

            dist = node1.pos() - node2.pos()
            self.m_perfectBoneLengths.append(math.hypot(dist.x(), dist.y()))

        self.startTimer(10)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def updateColor(self, item):
        pixmap = QPixmap(16, 16)
        color = QColor()
        if item:
            color = item.backgroundColor()
        if not color.isValid():
            color = self.palette().base().color()
        painter = QPainter(pixmap)
        painter.fillRect(0, 0, 16, 16, color)
        lighter = color.lighter()
        painter.setPen(lighter)
        # light frame
        painter.drawPolyline(QPoint(0, 15), QPoint(0, 0), QPoint(15, 0))
        painter.setPen(color.darker())
        # dark frame
        painter.drawPolyline(QPoint(1, 15), QPoint(15, 15), QPoint(15, 1))
        painter.end()
        self.colorAction.setIcon(QIcon(pixmap))
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(IntroPage, self).__init__(parent)

        self.setTitle("Introduction")
        self.setPixmap(QWizard.WatermarkPixmap,
                QPixmap(':/images/watermark1.png'))

        label = QLabel("This wizard will generate a skeleton C++ class "
                "definition, including a few functions. You simply need to "
                "specify the class name and set a few options to produce a "
                "header file and an implementation file for your new C++ "
                "class.")
        label.setWordWrap(True)

        layout = QVBoxLayout()
        layout.addWidget(label)
        self.setLayout(layout)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def showNextPiece(self):
        if self.nextPieceLabel is None:
            return

        dx = self.nextPiece.maxX() - self.nextPiece.minX() + 1
        dy = self.nextPiece.maxY() - self.nextPiece.minY() + 1

        pixmap = QPixmap(dx * self.squareWidth(), dy * self.squareHeight())
        painter = QPainter(pixmap)
        painter.fillRect(pixmap.rect(), self.nextPieceLabel.palette().window())

        for i in range(4):
            x = self.nextPiece.x(i) - self.nextPiece.minX()
            y = self.nextPiece.y(i) - self.nextPiece.minY()
            self.drawSquare(painter, x * self.squareWidth(),
                    y * self.squareHeight(), self.nextPiece.shape())

        painter.end()

        self.nextPieceLabel.setPixmap(pixmap)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def mousePressEvent(self, event):
        hotSpot = event.pos()

        mimeData = QMimeData()
        mimeData.setText(self.text())
        mimeData.setData('application/x-hotspot',
                '%d %d' % (hotSpot.x(), hotSpot.y()))

        pixmap = QPixmap(self.size())
        self.render(pixmap)

        drag = QDrag(self)
        drag.setMimeData(mimeData)
        drag.setPixmap(pixmap)
        drag.setHotSpot(hotSpot)

        dropAction = drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction)

        if dropAction == Qt.MoveAction:
            self.close()
            self.update()
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def startDrag(self, supportedActions):
        item = self.currentItem()

        itemData = QByteArray()
        dataStream = QDataStream(itemData, QIODevice.WriteOnly)
        pixmap = QPixmap(item.data(Qt.UserRole))
        location = item.data(Qt.UserRole+1)

        dataStream << pixmap << location

        mimeData = QMimeData()
        mimeData.setData('image/x-puzzle-piece', itemData)

        drag = QDrag(self)
        drag.setMimeData(mimeData)
        drag.setHotSpot(QPoint(pixmap.width()/2, pixmap.height()/2))
        drag.setPixmap(pixmap)

        if drag.exec_(Qt.MoveAction) == Qt.MoveAction:
            if self.currentItem() is not None:
                self.takeItem(self.row(item))
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def dropEvent(self, event):
        mimeData = event.mimeData()
        if mimeData.hasImage():
            self.setPixmap(QPixmap(mimeData.imageData()))
        elif mimeData.hasHtml():
            self.setText(mimeData.html())
            self.setTextFormat(Qt.RichText)
        elif mimeData.hasText():
            self.setText(mimeData.text())
            self.setTextFormat(Qt.PlainText)
        elif mimeData.hasUrls():
            self.setText("\n".join([url.path() for url in mimeData.urls()]))
        else:
            self.setText("Cannot display data")

        self.setBackgroundRole(QPalette.Dark)
        event.acceptProposedAction()
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(DragWidget, self).__init__(parent)

        self.setMinimumSize(200, 200)
        self.setFrameStyle(QFrame.Sunken | QFrame.StyledPanel)
        self.setAcceptDrops(True)

        boatIcon = QLabel(self)
        boatIcon.setPixmap(QPixmap(':/images/boat.png'))
        boatIcon.move(20, 20)
        boatIcon.show()
        boatIcon.setAttribute(Qt.WA_DeleteOnClose)

        carIcon = QLabel(self)
        carIcon.setPixmap(QPixmap(':/images/car.png'))
        carIcon.move(120, 20)
        carIcon.show()
        carIcon.setAttribute(Qt.WA_DeleteOnClose)

        houseIcon = QLabel(self)
        houseIcon.setPixmap(QPixmap(':/images/house.png'))
        houseIcon.move(20, 120)
        houseIcon.show()
        houseIcon.setAttribute(Qt.WA_DeleteOnClose)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def dropEvent(self, event):
        if event.mimeData().hasFormat('application/x-dnditemdata'):
            itemData = event.mimeData().data('application/x-dnditemdata')
            dataStream = QDataStream(itemData, QIODevice.ReadOnly)

            pixmap = QPixmap()
            offset = QPoint()
            dataStream >> pixmap >> offset

            newIcon = QLabel(self)
            newIcon.setPixmap(pixmap)
            newIcon.move(event.pos() - offset)
            newIcon.show()
            newIcon.setAttribute(Qt.WA_DeleteOnClose)

            if event.source() == self:
                event.setDropAction(Qt.MoveAction)
                event.accept()
            else:
                event.acceptProposedAction()
        else:
            event.ignore()
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self):
        super(StickMan, self).__init__()

        self.m_sticks = True
        self.m_isDead = False
        self.m_pixmap = QPixmap('images/head.png')
        self.m_penColor = QColor(Qt.white)
        self.m_fillColor = QColor(Qt.black)

        # Set up start position of limbs.
        self.m_nodes = []
        for x, y in Coords:
            node = Node(QPointF(x, y), self)
            node.positionChanged.connect(self.childPositionChanged)
            self.m_nodes.append(node)

        self.m_perfectBoneLengths = []
        for n1, n2 in Bones:
            node1 = self.m_nodes[n1]
            node2 = self.m_nodes[n2]

            dist = node1.pos() - node2.pos()
            self.m_perfectBoneLengths.append(math.hypot(dist.x(), dist.y()))

        self.startTimer(10)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def updateColor(self, item):
        pixmap = QPixmap(16, 16)
        color = QColor()
        if item:
            color = item.backgroundColor()
        if not color.isValid():
            color = self.palette().base().color()
        painter = QPainter(pixmap)
        painter.fillRect(0, 0, 16, 16, color)
        lighter = color.lighter()
        painter.setPen(lighter)
        # light frame
        painter.drawPolyline(QPoint(0, 15), QPoint(0, 0), QPoint(15, 0))
        painter.setPen(color.darker())
        # dark frame
        painter.drawPolyline(QPoint(1, 15), QPoint(15, 15), QPoint(15, 1))
        painter.end()
        self.colorAction.setIcon(QIcon(pixmap))
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(IntroPage, self).__init__(parent)

        self.setTitle("Introduction")
        self.setPixmap(QWizard.WatermarkPixmap,
                QPixmap(':/images/watermark1.png'))

        label = QLabel("This wizard will generate a skeleton C++ class "
                "definition, including a few functions. You simply need to "
                "specify the class name and set a few options to produce a "
                "header file and an implementation file for your new C++ "
                "class.")
        label.setWordWrap(True)

        layout = QVBoxLayout()
        layout.addWidget(label)
        self.setLayout(layout)
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def showNextPiece(self):
        if self.nextPieceLabel is None:
            return

        dx = self.nextPiece.maxX() - self.nextPiece.minX() + 1
        dy = self.nextPiece.maxY() - self.nextPiece.minY() + 1

        pixmap = QPixmap(dx * self.squareWidth(), dy * self.squareHeight())
        painter = QPainter(pixmap)
        painter.fillRect(pixmap.rect(), self.nextPieceLabel.palette().window())

        for i in range(4):
            x = self.nextPiece.x(i) - self.nextPiece.minX()
            y = self.nextPiece.y(i) - self.nextPiece.minY()
            self.drawSquare(painter, x * self.squareWidth(),
                    y * self.squareHeight(), self.nextPiece.shape())

        painter.end()

        self.nextPieceLabel.setPixmap(pixmap)
项目:satellite-tracker    作者:lofaldli    | 项目源码 | 文件源码
def __init__(self, background='images/world_map.jpg'):
        super().__init__(QGraphicsScene())
        self.background = QGraphicsPixmapItem(QPixmap(background))
        self.addItem(self.background)
        self.satellites = []
        self.groundStations = []
项目:grid-control    作者:akej74    | 项目源码 | 文件源码
def reset_data(self):
        """Reset fan rpm and voltage to "---" and activate the red status icon.
        Reset CPU and GPU temperature to "0"."""

        # Reset fan rpm
        self.ui.labelRPMFan1.setText('<b><font color="red">---</font></b>')
        self.ui.labelRPMFan2.setText('<b><font color="red">---</font></b>')
        self.ui.labelRPMFan3.setText('<b><font color="red">---</font></b>')
        self.ui.labelRPMFan4.setText('<b><font color="red">---</font></b>')
        self.ui.labelRPMFan5.setText('<b><font color="red">---</font></b>')
        self.ui.labelRPMFan6.setText('<b><font color="red">---</font></b>')

        # Reset fan voltage
        self.ui.labelVFan1.setText('<b><font color="red">---</font></b>')
        self.ui.labelVFan2.setText('<b><font color="red">---</font></b>')
        self.ui.labelVFan3.setText('<b><font color="red">---</font></b>')
        self.ui.labelVFan4.setText('<b><font color="red">---</font></b>')
        self.ui.labelVFan5.setText('<b><font color="red">---</font></b>')
        self.ui.labelVFan6.setText('<b><font color="red">---</font></b>')

        # Activate the red led icon
        self.ui.labelStatusFan1.setPixmap(QtGui.QPixmap(ICON_RED_LED))
        self.ui.labelStatusFan2.setPixmap(QtGui.QPixmap(ICON_RED_LED))
        self.ui.labelStatusFan3.setPixmap(QtGui.QPixmap(ICON_RED_LED))
        self.ui.labelStatusFan4.setPixmap(QtGui.QPixmap(ICON_RED_LED))
        self.ui.labelStatusFan5.setPixmap(QtGui.QPixmap(ICON_RED_LED))
        self.ui.labelStatusFan6.setPixmap(QtGui.QPixmap(ICON_RED_LED))

        # Reset temperatures
        self.ui.lcdNumberCurrentCPU.display(0)
        self.ui.lcdNumberCurrentGPU.display(0)

        # Update status in UI
        self.ui.labelPollingStatus.setText('<b><font color="red">Stopped</font></b>')
        self.ui.labelHWMonStatus.setText('<b><font color="red">---</font></b>')
项目:grid-control    作者:akej74    | 项目源码 | 文件源码
def change_fan_icon(self, icon, fan):
        """Update the fan status icon."""

        if fan == 1:
            self.ui.labelStatusFan1.setPixmap(QtGui.QPixmap(icon))
        if fan == 2:
            self.ui.labelStatusFan2.setPixmap(QtGui.QPixmap(icon))
        if fan == 3:
            self.ui.labelStatusFan3.setPixmap(QtGui.QPixmap(icon))
        if fan == 4:
            self.ui.labelStatusFan4.setPixmap(QtGui.QPixmap(icon))
        if fan == 5:
            self.ui.labelStatusFan5.setPixmap(QtGui.QPixmap(icon))
        if fan == 6:
            self.ui.labelStatusFan6.setPixmap(QtGui.QPixmap(icon))
项目:rockthetaskbar    作者:jamesabel    | 项目源码 | 文件源码
def __init__(self):

        import icons
        icon = QIcon(QPixmap(':icon.png'))
        super().__init__(icon)

        menu = QMenu()
        menu.addAction("About").triggered.connect(self.about)
        menu.addAction("Exit").triggered.connect(self.exit)
        self.setContextMenu(menu)
项目:rockthetaskbar    作者:jamesabel    | 项目源码 | 文件源码
def __init__(self):

        from rockthetaskbar import icons
        icon = QIcon(QPixmap(':icon.png'))
        super().__init__(icon)

        menu = QMenu()
        menu.addAction("CPU").triggered.connect(self.cpu)
        menu.addAction("About").triggered.connect(self.about)
        menu.addAction("Exit").triggered.connect(self.exit)
        self.setContextMenu(menu)

        self.cpu_monitor = CPUMonitor()
        self.cpu_monitor.start()
项目:tvlinker    作者:ozmartian    | 项目源码 | 文件源码
def init_form(self) -> QHBoxLayout:
        self.search_field = QLineEdit(self, clearButtonEnabled=True, placeholderText='Enter search criteria')
        self.search_field.setObjectName('searchInput')
        self.search_field.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.search_field.setFocus()
        self.search_field.textChanged.connect(self.clear_filters)
        self.search_field.returnPressed.connect(lambda: self.filter_table(self.search_field.text()))
        self.favorites_button = QPushButton(parent=self, flat=True, cursor=Qt.PointingHandCursor,
                                            objectName='favesButton', toolTip='Favorites', checkable=True,
                                            toggled=self.filter_faves,
                                            checked=self.settings.value('faves_filter', False, bool))
        self.refresh_button = QPushButton(parent=self, flat=True, cursor=Qt.PointingHandCursor,
                                          objectName='refreshButton', toolTip='Refresh', clicked=self.start_scraping)
        self.dlpages_field = QComboBox(self, toolTip='Pages', editable=False, cursor=Qt.PointingHandCursor)
        self.dlpages_field.addItems(('10', '20', '30', '40', '50'))
        self.dlpages_field.setCurrentIndex(self.dlpages_field.findText(str(self.dl_pagecount), Qt.MatchFixedString))
        self.dlpages_field.currentIndexChanged.connect(self.update_pagecount)
        self.settings_button = QPushButton(parent=self, flat=True, toolTip='Menu',
                                           objectName='menuButton', cursor=Qt.PointingHandCursor)
        self.settings_button.setMenu(self.settings_menu())
        layout = QHBoxLayout(spacing=10)
        logo = QLabel(self)
        logo.setPixmap(QPixmap(':assets/images/logo.png'))
        layout.addWidget(logo)
        layout.addWidget(self.search_field)
        layout.addWidget(self.favorites_button)
        layout.addWidget(self.refresh_button)
        layout.addWidget(QLabel('Pages:'))
        layout.addWidget(self.dlpages_field)
        layout.addWidget(self.settings_button)
        return layout
项目:tvlinker    作者:ozmartian    | 项目源码 | 文件源码
def _init_notification_icons(self):
        for icon in self.NotifyIcon:
            icon_file = QPixmap(icon.value, 'PNG')
            icon_file.save(os.path.join(FixedSettings.config_path, os.path.basename(icon.value)), 'PNG', 100)
项目:kaptan    作者:KaOSx    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        self.setSubTitle(self.tr("<h2>Welcome to KaOS</h2>"))

        vlayout = QVBoxLayout(self)
        vlayout.addItem(QSpacerItem(20, 30, QSizePolicy.Preferred, QSizePolicy.Minimum))

        hlayout = QHBoxLayout(self)
        label = QLabel(self)
        label.setText(self.tr("""<h1>What is KaOS?</h1>
        <p>The idea behind KaOS is to create a tightly integrated rolling and<br />
        transparent distribution for the modern desktop, build from scratch with<br />
        a very specific focus. Focus on one DE (KDE), one toolkit (Qt) & one architecture (x86_64).<br />
        Plus a focus on evaluating and selecting the most suitable tools and applications.</p>
        <p>This wizard will help you personalize your KaOS workspace easily and quickly.</p>
        <p>Please click <code style=color:#3498DB>Next</code> in order to begin. Click <code style=color:#3498DB>Cancel</code> anytime and changes won't be saved.</p>"""))
        label.setWordWrap(True)
        label.setAlignment(Qt.AlignLeft)
        hlayout.addWidget(label)

        kaptan_logo = QLabel(self)
        kaptan_logo.setPixmap(QPixmap(":/data/images/welcome.png"))
        kaptan_logo.setAlignment(Qt.AlignRight)
        kaptan_logo.setMaximumSize(157, 181)
        hlayout.addWidget(kaptan_logo)
        vlayout.addLayout(hlayout)

        vlayout.addItem(QSpacerItem(20, 40, QSizePolicy.Preferred, QSizePolicy.Preferred))

        desktop_file = os.path.join(os.environ["HOME"], ".config", "autostart", "kaptan.desktop")
        if os.path.exists(desktop_file):
            self.checkBox = QCheckBox()
            self.checkBox.setText(self.tr("Run on system startup"))
            self.checkBox.setChecked(True)
            self.checkBox.clicked.connect(self.autoRemove)
            vlayout.addWidget(self.checkBox)
项目:FuME    作者:fupadev    | 项目源码 | 文件源码
def __init__(self, path, version, parent=None):
        super(AboutDialog, self).__init__(parent)
        self.setupUi(self)
        self.label.setPixmap(QtGui.QPixmap(path))
        self.label_3.setText('Version %s' % version)
项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def drawUI(self):
        self.play = QPushButton(self)
        self.play.setIconSize(QSize(40, 40))
        self.play.setIcon(QIcon(QPixmap("play.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
        self.play.setStyleSheet("background-color: rgba(0, 0, 0, 0);")
        self.play.clicked.connect(lambda:self.playpause(self.play))
        self.resize(50, 50)
项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def playpause(self, btn):
        if self.playing:
            os.system("""osascript -e 'tell application "iTunes" to pause'""")
            self.playing = False
            btn.setIcon(QIcon(QPixmap("play.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
        else:
            os.system("""osascript -e 'tell application "iTunes" to play'""")
            self.playing = True
            btn.setIcon(QIcon(QPixmap("pause.png").scaled(40, 40, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
项目:MusicNet    作者:vidursatija    | 项目源码 | 文件源码
def drawUI(self):
        self.play = QPushButton(self)
        self.play.setIconSize(QSize(40, 20))
        self.play.setIcon(QIcon(QPixmap("fastforward.png").scaled(40, 20, Qt.KeepAspectRatio, Qt.SmoothTransformation)))
        self.play.setStyleSheet("background-color: rgba(0, 0, 0, 0);")
        self.play.clicked.connect(lambda:self.forward())
        self.resize(80, 40)