Python PyQt5.QtGui.QPixmap() Examples

The following are code examples for showing how to use PyQt5.QtGui.QPixmap(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: examples   Author: pyqt   File: spreadsheet.py    (license) View Source Project 25 votes vote down vote up
def createActions(self):
        self.cell_sumAction = QAction("Sum", self)
        self.cell_sumAction.triggered.connect(self.actionSum)

        self.cell_addAction = QAction("&Add", self)
        self.cell_addAction.setShortcut(Qt.CTRL | Qt.Key_Plus)
        self.cell_addAction.triggered.connect(self.actionAdd)

        self.cell_subAction = QAction("&Subtract", self)
        self.cell_subAction.setShortcut(Qt.CTRL | Qt.Key_Minus)
        self.cell_subAction.triggered.connect(self.actionSubtract)

        self.cell_mulAction = QAction("&Multiply", self)
        self.cell_mulAction.setShortcut(Qt.CTRL | Qt.Key_multiply)
        self.cell_mulAction.triggered.connect(self.actionMultiply)

        self.cell_divAction = QAction("&Divide", self)
        self.cell_divAction.setShortcut(Qt.CTRL | Qt.Key_division)
        self.cell_divAction.triggered.connect(self.actionDivide)

        self.fontAction = QAction("Font...", self)
        self.fontAction.setShortcut(Qt.CTRL | Qt.Key_F)
        self.fontAction.triggered.connect(self.selectFont)

        self.colorAction = QAction(QIcon(QPixmap(16, 16)), "Background &Color...", self)
        self.colorAction.triggered.connect(self.selectColor)

        self.clearAction = QAction("Clear", self)
        self.clearAction.setShortcut(Qt.Key_Delete)
        self.clearAction.triggered.connect(self.clear)

        self.aboutSpreadSheet = QAction("About Spreadsheet", self)
        self.aboutSpreadSheet.triggered.connect(self.showAbout)

        self.exitAction = QAction("E&xit", self)
        self.exitAction.setShortcut(QKeySequence.Quit)
        self.exitAction.triggered.connect(QApplication.instance().quit)

        self.printAction = QAction("&Print", self)
        self.printAction.setShortcut(QKeySequence.Print)
        self.printAction.triggered.connect(self.print_)

        self.firstSeparator = QAction(self)
        self.firstSeparator.setSeparator(True)

        self.secondSeparator = QAction(self)
        self.secondSeparator.setSeparator(True) 
Example 2
Project: examples   Author: pyqt   File: spreadsheet.py    (license) View Source Project 18 votes vote down vote up
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)) 
Example 3
Project: examples   Author: pyqt   File: stickman.py    (license) View Source Project 13 votes vote down vote up
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) 
Example 4
Project: Milis-Yukleyici   Author: sonakinci41   File: son.py    (license) View Source Project 9 votes vote down vote up
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) 
Example 5
Project: specton   Author: somesortoferror   File: dlg_info.py    (license) View Source Project 8 votes vote down vote up
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) 
Example 6
Project: VIRTUAL-PHONE   Author: SumanKanrar-IEM   File: addcontact_app.py    (license) View Source Project 7 votes vote down vote up
def openFileNameDialog(self):
        print("set icon clicked")
        options = QFileDialog.Options()
        options |= QFileDialog.DontUseNativeDialog
        fileName, _ = QFileDialog.getOpenFileName(self, "Choose Contact Icon", "", "Image Files (*.jpg *.png)", options=options)
        if fileName:
            print(fileName)
            pixmap = QtGui.QPixmap(fileName)
            self.contact_icon.setPixmap(pixmap)
            self.contact_icon.setScaledContents(True)
            # pixmap2 = self.contact_icon.pixmap()
            # print(pixmap2) 
Example 7
Project: kawaii-player   Author: kanishka-linux   File: kawaii_player.py    (license) View Source Project 7 votes vote down vote up
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 
Example 8
Project: Enibar   Author: ENIB   File: notes_management_window.py    (license) View Source Project 7 votes vote down vote up
def add_photo(self):
        """ Function called to add a photo. Open a QFileDialog and fill
            self.photo with the selected image
        """
        self.photo_selected = QtWidgets.QFileDialog(self).getOpenFileUrl(
            self, "Selectionnez une image", settings.IMG_BASE_DIR,
            "Image Files (*.png *.jpg *.bmp)")[0].path()

        if self.photo_selected:
            image = QtGui.QPixmap(self.photo_selected)

            if not image.isNull():
                self.photo.setPixmap(image.scaled(QtCore.QSize(120, 160)))
                self.on_change() 
Example 9
Project: FuME   Author: fupadev   File: UpdateDialog.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 10
Project: MusicNet   Author: vidursatija   File: window.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 11
Project: Dolphin-Updater   Author: nbear3   File: dolphinapp.py    (license) View Source Project 6 votes vote down vote up
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 
Example 12
Project: Dolphin-Updater   Author: nbear3   File: dolphinapp.py    (license) View Source Project 6 votes vote down vote up
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() 
Example 13
Project: Computer-graphics   Author: Panda-Lewandowski   File: lab6.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 14
Project: pyree-old   Author: DrLuke   File: sheetview.py    (license) View Source Project 6 votes vote down vote up
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"}""")) 
Example 15
Project: networkzero   Author: tjguk   File: adventure.py    (license) View Source Project 6 votes vote down vote up
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") 
Example 16
Project: Flashlapse_NEO   Author: flashlapsedev   File: Main.py    (license) View Source Project 6 votes vote down vote up
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")) 
Example 17
Project: Flashlapse_NEO   Author: flashlapsedev   File: Main.py    (license) View Source Project 6 votes vote down vote up
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")) 
Example 18
Project: vidcutter   Author: ozmartian   File: videosliderwidget.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 19
Project: vidcutter   Author: ozmartian   File: videocutter.py    (license) View Source Project 6 votes vote down vote up
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() 
Example 20
Project: TrezorSymmetricFileEncryption   Author: 8go   File: dialogs.py    (license) View Source Project 6 votes vote down vote up
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_() 
Example 21
Project: kawaii-player   Author: kanishka-linux   File: traywidget.py    (license) View Source Project 6 votes vote down vote up
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 
Example 22
Project: kawaii-player   Author: kanishka-linux   File: kawaii_player.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 23
Project: dxf2gcode   Author: cnc-club   File: treehandling.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 24
Project: dxf2gcode   Author: cnc-club   File: treehandling.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 25
Project: Enibar   Author: ENIB   File: main_window.py    (license) View Source Project 6 votes vote down vote up
def reset_note_box(self):
        """ Reset the note box to default
        """
        self.note_name.setText("Surnom - Prénom nom")
        self.note_mail.setText("[email protected]")
        self.note_promo.setText("Promo")
        self.note_phone.setText("+336 00 00 00 00")
        self.note_solde.setText("0.00 €")
        self.total_cons.setText("0.00 €")
        self.total_refill.setText("0.00€")
        image = QtGui.QPixmap()
        self.note_photo.setPixmap(image)
        self.note_box.setStyleSheet("background-color: none;")
        self.refill_note.setEnabled(False)
        self.empty_note.setEnabled(False)
        self.note_box.setEnabled(False)
        self.repay_ecocup_btn.setEnabled(False)
        self.take_ecocup_btn.setEnabled(False) 
Example 26
Project: defconQt   Author: trufont   File: glyphViewFactory.py    (license) View Source Project 6 votes vote down vote up
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 
Example 27
Project: uitester   Author: IfengAutomation   File: case_editor.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 28
Project: uitester   Author: IfengAutomation   File: case_editor.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 29
Project: Py2DSpectroscopy   Author: SvenBo90   File: aboutWindowUi.py    (license) View Source Project 6 votes vote down vote up
def __init__(self, about_window):

        # set window title, object name and bjoect size
        about_window.setWindowTitle("About")
        about_window.setObjectName("about")
        about_window.setFixedWidth(385)
        about_window.setFixedHeight(184)

        # Juelich logo
        self.label = QLabel(about_window)
        self.label.setGeometry(QRect(100, 40, 311, 171))
        self.label.setText("")
        self.label.setPixmap(QPixmap("Jülich_fz_logo.svg.png"))
        self.label.setObjectName("label")

        # mail contact
        self.label_2 = QLabel(about_window)
        self.label_2.setGeometry(QRect(10, 0, 311, 81))
        self.label_2.setObjectName("label_2")
        self.label_2.setText("<html><head/><body><p><span style=\" font-weight:600;\">Py2DLuminescence 0.2.0</span>"
                             "</p><p>Sven Borghardt, <a href=\"mailto:[email protected]\">"
                             "<span style=\" text-decoration: underline; color:#0000ff;\">[email protected]"
                             "</span></a></p></body></html>") 
Example 30
Project: lilii   Author: LimeLinux   File: main.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 31
Project: Mac-Python-3.X   Author: L1nwatch   File: stickman.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 32
Project: Mac-Python-3.X   Author: L1nwatch   File: spreadsheet.py    (license) View Source Project 6 votes vote down vote up
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)) 
Example 33
Project: Mac-Python-3.X   Author: L1nwatch   File: classwizard.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 34
Project: Mac-Python-3.X   Author: L1nwatch   File: tetrix.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 35
Project: Mac-Python-3.X   Author: L1nwatch   File: draggabletext.py    (license) View Source Project 6 votes vote down vote up
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() 
Example 36
Project: Mac-Python-3.X   Author: L1nwatch   File: puzzle.py    (license) View Source Project 6 votes vote down vote up
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)) 
Example 37
Project: Mac-Python-3.X   Author: L1nwatch   File: dropsite.py    (license) View Source Project 6 votes vote down vote up
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() 
Example 38
Project: Mac-Python-3.X   Author: L1nwatch   File: draggableicons.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 39
Project: Mac-Python-3.X   Author: L1nwatch   File: draggableicons.py    (license) View Source Project 6 votes vote down vote up
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() 
Example 40
Project: examples   Author: pyqt   File: classwizard.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 41
Project: examples   Author: pyqt   File: tetrix.py    (license) View Source Project 6 votes vote down vote up
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) 
Example 42
Project: satellite-tracker   Author: lofaldli   File: map.py    (MIT License) View Source Project 5 votes vote down vote up
def __init__(self, background='images/world_map.jpg'):
        super().__init__(QGraphicsScene())
        self.background = QGraphicsPixmapItem(QPixmap(background))
        self.addItem(self.background)
        self.satellites = []
        self.groundStations = [] 
Example 43
Project: grid-control   Author: akej74   File: gridcontrol.py    (license) View Source Project 5 votes vote down vote up
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>') 
Example 44
Project: grid-control   Author: akej74   File: gridcontrol.py    (license) View Source Project 5 votes vote down vote up
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)) 
Example 45
Project: rockthetaskbar   Author: jamesabel   File: helloworld.py    (license) View Source Project 5 votes vote down vote up
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) 
Example 46
Project: rockthetaskbar   Author: jamesabel   File: gui.py    (license) View Source Project 5 votes vote down vote up
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() 
Example 47
Project: tvlinker   Author: ozmartian   File: __main__.py    (license) View Source Project 5 votes vote down vote up
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 
Example 48
Project: tvlinker   Author: ozmartian   File: __main__.py    (license) View Source Project 5 votes vote down vote up
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) 
Example 49
Project: kaptan   Author: KaOSx   File: ui_welcome.py    (license) View Source Project 5 votes vote down vote up
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) 
Example 50
Project: FuME   Author: fupadev   File: AboutDialog.py    (license) View Source Project 5 votes vote down vote up
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)