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

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

项目:QtPropertyBrowserV2.6-for-pyqt5    作者:theall    | 项目源码 | 文件源码
def fontValuePixmap(font):
        f = QFont(font)
        img = QImage(16, 16, QImage.Format_ARGB32_Premultiplied)
        img.fill(0)
        p = QPainter(img)
        p.setRenderHint(QPainter.TextAntialiasing, True)
        p.setRenderHint(QPainter.Antialiasing, True)
        f.setPointSize(13)
        p.setFont(f)
        t = QTextOption()
        t.setAlignment(Qt.AlignCenter)
        p.drawText(QRectF(0, 0, 16, 16), 'A', t)
        p.end()
        return QPixmap.fromImage(img)
项目:tahoe-gui    作者:LeastAuthority    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super(self.__class__, self).__init__()
        self.parent = parent
        font = QFont()
        font.setPointSize(16)
        model = QStringListModel()
        model.setStringList(wordlist)
        completer = Completer()
        completer.setModel(model)
        self.setFont(font)
        self.setCompleter(completer)
        self.setAlignment(Qt.AlignCenter)
        #self.setPlaceholderText("Enter invite code")
项目:PyQt5-CWidgets    作者:ArmPitPerson    | 项目源码 | 文件源码
def __initUI(self):
        """Initialize the UI"""
        self.__layout = QtWidgets.QVBoxLayout()

        self.__console = QtWidgets.QTextEdit(self)
        self.__console.setFont(QtGui.QFont("Ubuntu Mono"))
        self.__console.setMinimumWidth(400)
        self.__console.setMinimumHeight(100)
        self.__console.setReadOnly(True)

        self.__layout.addWidget(self.__console)
        self.setLayout(self.__layout)

        with open(Resources.consoleStyle, "r") as CSS:
            self.__console.setStyleSheet(CSS.read())

        # Connect Signals
        self.readStdout.connect(self.printToConsole)
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def data(self, index, role=Qt.DisplayRole):
        row = index.row()
        if row >= len(self.message_type):
            return

        label = self.message_type[row]

        if role == Qt.DisplayRole:
            return label.name
        elif role == Qt.CheckStateRole:
            return label.show
        elif role == Qt.BackgroundColorRole:
            return constants.LABEL_COLORS[label.color_index]
        elif role == Qt.FontRole:
            font = QFont()
            font.setItalic(label.field_type is None)
            return font
项目:BigBrotherBot-For-UrT43    作者:ptitbigorneau    | 项目源码 | 文件源码
def initUI(self):
        """
        Initialize the MarqueeLabel layout.
        """
        self.setFixedSize(433, 40)
        self.font = QFont("Arial", GEOMETRY[b3.getPlatform()]['MARQUEE_LABEL_FONT_SIZE'])
        self.font.setItalic(True)
        self.setFont(self.font)
        self.setStyleSheet("""
        QLabel {
            background: transparent;
            color: #484848;
        }
        """)

        self.setVisible(B3App.Instance().settings.value('show_rss_news', type=bool))
项目:Visualization    作者:nwrush    | 项目源码 | 文件源码
def setupUi(self, topicsList):
        topicsList.setObjectName("topicsList")
        topicsList.resize(642, 730)
        self.verticalLayout = QtWidgets.QVBoxLayout(topicsList)
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtWidgets.QLabel(topicsList)
        font = QtGui.QFont()
        font.setPointSize(12)
        self.label.setFont(font)
        self.label.setAlignment(QtCore.Qt.AlignCenter)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label)
        self.filterText = QtWidgets.QLineEdit(topicsList)
        self.filterText.setObjectName("filterText")
        self.verticalLayout.addWidget(self.filterText)
        self.listWidget = QtWidgets.QListView(topicsList)
        self.listWidget.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
        self.listWidget.setObjectName("listWidget")
        self.verticalLayout.addWidget(self.listWidget)

        self.retranslateUi(topicsList)
        QtCore.QMetaObject.connectSlotsByName(topicsList)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(540, 393)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setText("")
        self.label.setPixmap(QtGui.QPixmap(":/newPrefix/images/image3487.png"))
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.textBrowser = QtWidgets.QTextBrowser(Dialog)
        font = QtGui.QFont()
        font.setFamily("Arial")
        self.textBrowser.setFont(font)
        self.textBrowser.setOpenExternalLinks(True)
        self.textBrowser.setObjectName("textBrowser")
        self.gridLayout.addWidget(self.textBrowser, 1, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(540, 393)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setText("")
        self.label.setPixmap(QtGui.QPixmap(":/newPrefix/images/image3487.png"))
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.textBrowser = QtWidgets.QTextBrowser(Dialog)
        font = QtGui.QFont()
        font.setFamily("Arial")
        self.textBrowser.setFont(font)
        self.textBrowser.setOpenExternalLinks(True)
        self.textBrowser.setObjectName("textBrowser")
        self.gridLayout.addWidget(self.textBrowser, 1, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(540, 393)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setText("")
        self.label.setPixmap(QtGui.QPixmap(":/newPrefix/images/image3487.png"))
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.textBrowser = QtWidgets.QTextBrowser(Dialog)
        font = QtGui.QFont()
        font.setFamily("Arial")
        self.textBrowser.setFont(font)
        self.textBrowser.setOpenExternalLinks(True)
        self.textBrowser.setObjectName("textBrowser")
        self.gridLayout.addWidget(self.textBrowser, 1, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:Osdag    作者:osdag-admin    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(540, 393)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setText("")
        self.label.setPixmap(QtGui.QPixmap(":/newPrefix/images/image3487.png"))
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
        self.textBrowser = QtWidgets.QTextBrowser(Dialog)
        font = QtGui.QFont()
        font.setFamily("Arial")
        self.textBrowser.setFont(font)
        self.textBrowser.setOpenExternalLinks(True)
        self.textBrowser.setObjectName("textBrowser")
        self.gridLayout.addWidget(self.textBrowser, 1, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:SantosGUI    作者:santosfamilyfoundation    | 项目源码 | 文件源码
def __init__(self, parent):
        super(HomographyScene, self).__init__(parent)
        self.points = []
        self.main_pixmap_item = None  # Either None or a QGraphicsPixmapItem representing the loaded image

        # Point configuration
        self.point_rad = 12  # Radius, in pixels
        self.point_pen_color = QtGui.QColor(255, 74, 13, 230)  # R, G, B, A
        self.point_pen = QtGui.QPen(self.point_pen_color, 6)
        self.point_brush_color = QtGui.QColor(195, 13, 255, 20)  # R, G, B, A
        self.point_brush = QtGui.QBrush(self.point_brush_color)
        self.point_selected = False
        self.selected_point = None

        font = QtGui.QFont()
        font.setPixelSize(48)
        font.setBold(True)
        self.label_font = font
        self.label_pen_color = QtGui.QColor(0, 0, 0)  # R, G, B
        self.label_pen = QtGui.QPen(self.label_pen_color, 2)
        self.label_brush_color = QtGui.QColor(255, 255, 255)  # R, G, B
        self.label_brush = QtGui.QBrush(self.label_brush_color)
项目:dayworkspace    作者:copie    | 项目源码 | 文件源码
def setupUi(self, mainWindow):
        mainWindow.setObjectName("mainWindow")
        mainWindow.resize(604, 100)
        mainWindow.setMinimumSize(QtCore.QSize(604, 100))
        mainWindow.setMaximumSize(QtCore.QSize(604, 100))
        self.lineEdit = QtWidgets.QLineEdit(mainWindow)
        self.lineEdit.setGeometry(QtCore.QRect(0, 0, 601, 101))
        self.lineEdit.setMinimumSize(QtCore.QSize(601, 101))
        self.lineEdit.setMaximumSize(QtCore.QSize(601, 101))
        font = QtGui.QFont()
        font.setPointSize(28)
        self.lineEdit.setFont(font)
        self.lineEdit.setObjectName("lineEdit")

        self.retranslateUi(mainWindow)
        QtCore.QMetaObject.connectSlotsByName(mainWindow)
项目:dayworkspace    作者:copie    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(376, 68)
        Form.setMinimumSize(QtCore.QSize(376, 68))
        Form.setMaximumSize(QtCore.QSize(376, 68))
        self.lineEdit = QtWidgets.QLineEdit(Form)
        self.lineEdit.setGeometry(QtCore.QRect(0, 0, 381, 71))
        self.lineEdit.setMinimumSize(QtCore.QSize(381, 71))
        self.lineEdit.setMaximumSize(QtCore.QSize(381, 71))
        font = QtGui.QFont()
        font.setPointSize(20)
        self.lineEdit.setFont(font)
        self.lineEdit.setObjectName("lineEdit")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:KerbalPie    作者:Vivero    | 项目源码 | 文件源码
def __init__(self,
            timeSpan=30.0,
            yMin=-1.0,
            yMax=1.0,
            yOriginValue=0.0,
            xTickInterval=5.0,
            yTickInterval=0.2,
            labelFont=QFont("Segoe UI", 10),
            refreshRate=0.1,
            **kwds):

        # validate inputs
        assert timeSpan > 0.0

        self._timeSpan = timeSpan

        self._lastUpdate = time.time()

        self._refreshRate = refreshRate

        self._refreshTimer = QTimer()
        self._refreshTimer.timeout.connect(self._refresh_plots)
        self._refreshTimer.start(self._refreshRate * 1000.0)

        super(QPlot2DTime, self).__init__(
            xMin=timeSpan,
            xMax=0.0,
            yMin=yMin,
            yMax=yMax,
            xOriginValue=0.0,
            yOriginValue=yOriginValue,
            xTickInterval=xTickInterval,
            yTickInterval=yTickInterval,
            labelFont=labelFont,
            **kwds)


    # P U B L I C   M E T H O D S 
    #===========================================================================
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(529, 329)
        self.selInfoWidget = QtWidgets.QWidget(Form)
        self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
        self.selInfoWidget.setObjectName("selInfoWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.selDescLabel = QtWidgets.QLabel(self.selInfoWidget)
        self.selDescLabel.setText("")
        self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.selDescLabel.setWordWrap(True)
        self.selDescLabel.setObjectName("selDescLabel")
        self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
        self.selNameLabel = QtWidgets.QLabel(self.selInfoWidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.selNameLabel.setFont(font)
        self.selNameLabel.setText("")
        self.selNameLabel.setObjectName("selNameLabel")
        self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
        self.selectedTree = DataTreeWidget(self.selInfoWidget)
        self.selectedTree.setObjectName("selectedTree")
        self.selectedTree.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
        self.hoverText = QtWidgets.QTextEdit(Form)
        self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
        self.hoverText.setObjectName("hoverText")
        self.view = FlowchartGraphicsView(Form)
        self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
        self.view.setObjectName("view")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:NeoAnalysis    作者:neoanalysis    | 项目源码 | 文件源码
def setupUi(self, Form):
        Form.setObjectName("Form")
        Form.resize(529, 329)
        self.selInfoWidget = QtWidgets.QWidget(Form)
        self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222))
        self.selInfoWidget.setObjectName("selInfoWidget")
        self.gridLayout = QtWidgets.QGridLayout(self.selInfoWidget)
        self.gridLayout.setContentsMargins(0, 0, 0, 0)
        self.gridLayout.setObjectName("gridLayout")
        self.selDescLabel = QtWidgets.QLabel(self.selInfoWidget)
        self.selDescLabel.setText("")
        self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
        self.selDescLabel.setWordWrap(True)
        self.selDescLabel.setObjectName("selDescLabel")
        self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1)
        self.selNameLabel = QtWidgets.QLabel(self.selInfoWidget)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.selNameLabel.setFont(font)
        self.selNameLabel.setText("")
        self.selNameLabel.setObjectName("selNameLabel")
        self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1)
        self.selectedTree = DataTreeWidget(self.selInfoWidget)
        self.selectedTree.setObjectName("selectedTree")
        self.selectedTree.headerItem().setText(0, "1")
        self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2)
        self.hoverText = QtWidgets.QTextEdit(Form)
        self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81))
        self.hoverText.setObjectName("hoverText")
        self.view = FlowchartGraphicsView(Form)
        self.view.setGeometry(QtCore.QRect(0, 0, 256, 192))
        self.view.setObjectName("view")

        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
项目:notepad    作者:lfsando    | 项目源码 | 文件源码
def default_visual(self):

        # Pallete
        default_palette = self.text_widget.palette()

        # Background
        default_background_color = QtGui.QColor()
        default_background_color.setNamedColor('#2B2B2B')
        default_palette.setColor(QtGui.QPalette.Base, default_background_color)

        # Font Color
        default_font_color = QtGui.QColor()
        default_font_color.setNamedColor('#F8F8F2')
        default_palette.setColor(QtGui.QPalette.Text, default_font_color)

        # Font Type
        default_font = QtGui.QFont('Consolas', 13)
        self.text_widget.setFont(default_font)

        self.text_widget.setPalette(default_palette)
项目:gui_tool    作者:UAVCAN    | 项目源码 | 文件源码
def get_monospace_font():
    preferred = ['Consolas', 'DejaVu Sans Mono', 'Monospace', 'Lucida Console', 'Monaco']
    for name in preferred:
        font = QFont(name)
        if QFontInfo(font).fixedPitch():
            logger.debug('Preferred monospace font: %r', font.toString())
            return font

    font = QFont()
    font.setStyleHint(QFont().Monospace)
    font.setFamily('monospace')
    logger.debug('Using fallback monospace font: %r', font.toString())
    return font
项目:Red-GUI    作者:ScarletRav3n    | 项目源码 | 文件源码
def __init__(self):
        super(MainWindow, self).__init__()

        self.large_font = QtGui.QFont("Arial", 12)
        self.reg_font = QtGui.QFont("Arial", 10)
        self.small_font = QtGui.QFont("Arial", 8)

        self.settings = Settings()
        self.init_ui()
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def onSelectFontUserInterface( self, *args ):
        font = QtGui.QFont( self.ui_face, self.ui_point_size )
        font, ok = QtWidgets.QFontDialog.getFont( font, self, T_('Choose font') )

        if ok:
            self.ui_face = font.family()
            self.ui_point_size = font.pointSize()

            self.ui_font_text.setText( '%s %dpt ' % (self.ui_face, self.ui_point_size) )
            self.ui_font_text.setFont( font )
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def onSelectFontCode( self, *args ):
        font = QtGui.QFont( self.code_face, self.code_point_size )
        font, ok = QtWidgets.QFontDialog.getFont( font, self, T_('Choose font') )

        if ok:
            self.code_face = font.family()
            self.code_point_size = font.pointSize()

            self.code_font_text.setText( '%s %dpt ' % (self.code_face, self.code_point_size) )
            self.code_font_text.setFont( font )
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, args:List[str] ) -> None:
        self.__all_singletons = {}  # type: Dict[str, None]
        self.__code_font = None     # type: QtGui.QFont

        all_factories, all_messages = wb_scm_factories.allScmFactories()
        # convert to a dict
        self.all_factories = dict( [(f.scmName(), f) for f in all_factories] )

        extra_loggers = []
        for factory in self.all_factories.values():
            extra_loggers.extend( factory.extraLoggers() )

        super().__init__( ('Scm', 'Workbench'), args, debug_class=wb_scm_debug.WbScmDebug, extra_loggers=extra_loggers,  )

        for msg in all_messages:
            self.log.info( msg )
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def writePreferences( self ) -> None:
        super().writePreferences()

        self.setAppStyles()

        p = self.prefs.font_code
        if p.face is None or p.point_size is None:
            self.__code_font = self.font()

        else:
            self.__code_font = QtGui.QFont( p.face, p.point_size )

    # place fix style changes in this list
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def getCodeFont( self ) -> 'QtGui.QFont':
        return self.__code_font
项目:scm-workbench    作者:barry-scott    | 项目源码 | 文件源码
def __init__( self, app, parent, name=None ):
        super().__init__( parent )
        self.name = name

        self.style_normal = self.STYLE_DEFAULT
        self.style_line_numbers = self.STYLE_LASTPREDEFINED + 1
        self.style_line_numbers_for_diff = self.STYLE_LASTPREDEFINED

        self.emptyUndoBuffer()

        self.setMarginWidth( 0, 0 )
        self.setMarginWidth( 1, 0 )
        self.setMarginWidth( 2, 0 )

        # make some styles
        self.styleSetFromSpec( self.style_normal,
                'size:%d,face:%s,fore:#000000,back:#e0e0e0' % (wb_config.point_size, wb_config.face) )
        self.styleSetFromSpec( self.style_line_numbers,
                'size:%d,face:%s,fore:#000000,back:#f0f0f0' % (wb_config.point_size, wb_config.face) )
        self.styleSetFromSpec( self.style_line_numbers_for_diff,
                'size:%d,face:%s,fore:#000000,back:#d0d0d0' % (wb_config.point_size, wb_config.face) )

        # Calculate space for 6 digits
        font = QtGui.QFont( wb_config.face, wb_config.point_size )
        self.setFont( font )

        fontmetrics = QtGui.QFontMetrics( font )

        width = fontmetrics.width( '123456' )

        self.setScrollWidth( width )
        self.setMaximumWidth( width )
        self.setMinimumWidth( width )

        # no scroll bars on the line number control
        self.setVScrollBar( False )
        self.setHScrollBar( False )
项目:acbDecrypter    作者:Rieksee    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(491, 81)
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.label = QtWidgets.QLabel(Dialog)
        font = QtGui.QFont()
        font.setPointSize(13)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.gridLayout.addWidget(self.label, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:kodi-remote    作者:chatper    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()

        self.setGeometry(600, 200, 420, 320)
        self.setWindowTitle('Help')
        self.setWindowIcon(QIcon(ICON_PATH))

        label = QLabel('Press anything on your keyboard to see what it does.')
        self.actionLabel = QLabel('Press something!')
        self.img = QLabel('img', self)
        self.img.setPixmap(QPixmap(HELP_IMG_PATH))


        grid = QGridLayout()
        grid.setSpacing(4)

        grid.addWidget(self.img, 0, 0)
        grid.addWidget(label, 1, 0)
        grid.addWidget(self.actionLabel, 2, 0)

        myFont=QFont()
        myFont.setBold(True)
        myFont.setPixelSize(24)
        self.actionLabel.setFont(myFont)

        palette = QPalette()
        palette.setColor(QPalette.Foreground,Qt.green)
        self.actionLabel.setPalette(palette)

        self.setLayout(grid)
        self.show()
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def addGraphicsItems(self):
        self.mainRect = QGraphicsRectItem(QRectF(-15, -15, 30, 30), self)
        self.nodeTitle = QGraphicsTextItem(type(self).name, self)
        titleFont = QFont()
        titleFont.setBold(True)
        self.nodeTitle.setFont(titleFont)
        self.selectedChanged(self.isSelected())
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def updateSheets(self):
        if self.sheets is not None and self.ownsheet is not None:
            self.listSheetItems = {}
            self.listWidget.clear()
            for sheetId in self.sheets:
                if not sheetId == self.ownsheet:
                    newItem = QListWidgetItem(self.sheets[sheetId])
                    newItem.setToolTip(str(sheetId))
                    newItem.setData(Qt.UserRole, sheetId)
                    self.listSheetItems[sheetId] = newItem
                    self.listWidget.addItem(newItem)

                    if sheetId == self.selectedSheet:
                        boldFont = QFont()
                        boldFont.setBold(True)
                        newItem.setFont(boldFont)
项目:pyree-old    作者:DrLuke    | 项目源码 | 文件源码
def listClicked(self, item):
        normalFont = QFont()
        boldFont = QFont()
        boldFont.setBold(True)

        for i in range(self.listWidget.count()):
            itemnormal = self.listWidget.item(i)
            itemnormal.setFont(normalFont)

        self.selectedSheet = item.data(Qt.UserRole)
        self.sendDataToImplementations({"subsheetid": self.selectedSheet})
        item.setFont(boldFont)
项目:PySAT    作者:USGS-Astrogeology    | 项目源码 | 文件源码
def make_combobox(choices):
    combo = QtWidgets.QComboBox()
    # combo.setMaximumWidth(200)
    font = QtGui.QFont()
    font.setPointSize(10)
    combo.setFont(font)
    for i, choice in enumerate(choices):
        combo.addItem("")
        combo.setItemText(i, choice)

    return combo
项目:vidcutter    作者:ozmartian    | 项目源码 | 文件源码
def initTheme(self) -> None:
        qApp.setStyle(VideoStyleDark() if self.theme == 'dark' else VideoStyleLight())
        self.fonts = [
            QFontDatabase.addApplicationFont(':/fonts/FuturaLT.ttf'),
            QFontDatabase.addApplicationFont(':/fonts/NotoSans.ttc')
        ]
        self.style().loadQSS(self.theme, self.parent.devmode)
        QApplication.setFont(QFont('Noto Sans UI', 12 if sys.platform == 'darwin' else 10, 300))
项目:BATS-Bayesian-Adaptive-Trial-Simulator    作者:ContaTP    | 项目源码 | 文件源码
def __init__(self, parent=None):

        QtWidgets.QWidget.__init__(self, parent)
        # Click pos
        self.clickPos = QtCore.QPoint(50, 50)
        # App Icon
        self.icon_Label = QtWidgets.QLabel()
        self.icon_Label.setPixmap(QtGui.QPixmap(":/resources/bcts.png").scaled(QtCore.QSize(40, 40)))
        self.icon_Label.setFixedWidth(40)
        # Title font
        self.title_font = QtGui.QFont("Segoe UI")
        self.title_font.setPointSize(11)
        self.title_font.setBold(True)
        # Title        
        self.title_Label = QtWidgets.QLabel("")
        self.title_Label.setFont(self.title_font)
        self.title_Label.setAlignment(QtCore.Qt.AlignCenter)
        #?Button
        self.closeApp_btn = QtWidgets.QToolButton()
        self.closeApp_btn.setIcon(QtGui.QIcon(":/resources/close.png"))
        self.closeApp_btn.setObjectName("closeButton")
        self.titlelayout = QtWidgets.QHBoxLayout()
        self.titlelayout.addWidget(self.icon_Label)
        self.titlelayout.addWidget(self.title_Label)
        self.titlelayout.addWidget(self.closeApp_btn)
        self.titlelayout.setSpacing(0) 
        self.titlelayout.setContentsMargins(5, 5, 5, 5)
        # Stylesheet
        self.setStyleSheet("QLabel{background:#ffffff; color:#859ba6; font-family:'Segoe UI'; font-size:12pt;} QToolButton{border:none;} QPushButton:hover{background:#6e66cc;border:1px solid #373366;} QToolButton:hover{background:#fa7064;}")
        self.setLayout(self.titlelayout)
        # Slots & signals
        self.closeApp_btn.clicked.connect(parent.close)
项目:BATS-Bayesian-Adaptive-Trial-Simulator    作者:ContaTP    | 项目源码 | 文件源码
def __init__(self, parent=None):

        QtWidgets.QWidget.__init__(self, parent)
        # Add new font
        self.titleFont = QtGui.QFont('Caviar Dreams', 20)
        self.titleFont.setLetterSpacing(QtGui.QFont.AbsoluteSpacing, 2.0)
        # Parent widget, application window
        self.parent = parent
        # Mouse
        self.clickPos = QtCore.QPoint(50, 50)
        # Layout
        self.titleLayout = QtWidgets.QHBoxLayout()
        # Icon
        self.iconLabel = QtWidgets.QLabel()
        self.iconLabel.setPixmap(QtGui.QPixmap(":/resources/bcts.png").scaled(QtCore.QSize(100, 100)))
        self.iconLabel.setAlignment(QtCore.Qt.AlignCenter)
        # Title text     
        self.titleLabel = QtWidgets.QLabel("BATS")
        self.titleLabel.setFont(self.titleFont)
        # Stylesheet
        self.setStyleSheet("QLabel{color:#ffffff;}")
        # Add widget
        self.titleLayout.addWidget(self.iconLabel)
        self.titleLayout.addWidget(self.titleLabel)
        # Set layout
        self.titleLayout.setContentsMargins(20, 10, 20, 0)
        self.titleLayout.setSpacing(30)
        self.titleLayout.setAlignment(QtCore.Qt.AlignCenter)
        self.setLayout(self.titleLayout)



# Side Menu
项目:BATS-Bayesian-Adaptive-Trial-Simulator    作者:ContaTP    | 项目源码 | 文件源码
def __init__(self, parent=None):

        QtWidgets.QWidget.__init__(self, parent)
        # Customize widget
        self.setObjectName("Option")
        # Layout 
        optionLayout = QtWidgets.QHBoxLayout()
        # Option font
        optionFont = QtGui.QFont("Caviar Dreams")
        optionFont.setPointSize(12)
        optionFont.setBold(False)
        optionFont.setLetterSpacing(QtGui.QFont.AbsoluteSpacing, 1.0)
        # Set widgets
        # Separator
        optionSep = QtWidgets.QWidget()
        optionSep.setStyleSheet("QWidget{background:#4da8e8;}")
        optionSep.setFixedWidth(2)
        # Doc button
        docButton = QtWidgets.QPushButton()
        docButton.setIcon(QtGui.QIcon(":/resources/doc.png"))
        docButton.setIconSize(QtCore.QSize(40, 40))
        docButton.setText("Documentation")
        docButton.setFont(optionFont)
        docButton.setCursor(QtCore.Qt.PointingHandCursor)
        # Layout
        optionLayout.addWidget(docButton, 10)
        # self.optionLayout.setAlignment(QtCore.Qt.AlignCenter)
        optionLayout.setContentsMargins(0, 0, 0, 0)
        optionLayout.setSpacing(0)
        optionLayout.setAlignment(QtCore.Qt.AlignCenter)
        self.setLayout(optionLayout)
        # Stylesheet
        self.setStyleSheet("QWidget {margin: 0 0 0 0; padding: 0 0 0 0;} QPushButton{background:transparent; border:none; border-top: 2px solid #4da8e8; padding: 0 10px 0 10px; color: #ffffff; outline: none;} QPushButton:hover{background:#45c8dc;}")

        # Actiond
        docButton.clicked.connect(self.openDoc)
项目:BATS-Bayesian-Adaptive-Trial-Simulator    作者:ContaTP    | 项目源码 | 文件源码
def __init__(self, parent=None):

        QtWidgets.QWidget.__init__(self, parent)
        self.setupUi(self)
        # Store plot
        self.parent = parent
        self.table_file = None
        self.plot_file = {}
        self.exportTable_flag = self.exportPlot_flag = 0
        # Set font size amd color for log console
        self.log_tabWidget.setCurrentIndex(0)
        self.log_tabWidget.setTabIcon(0, QtGui.QIcon(":/resources/tab_log.png"))
        self.log_tabWidget.setTabIcon(1, QtGui.QIcon(":/resources/tab_info_disabled.png"))
        self.log_tabWidget.tabBar().setTabTextColor(0, QtGui.QColor("#4f8a10"))  
        self.log_tabWidget.tabBar().setStyleSheet("QTabBar:tab:selected{ border-color: #4f8a10;}")
        font = QtGui.QFont("Segoe UI", 10)
        self.logConsole.setFont(font)
        self.configConsole.setFont(font)
        self.configConsole.setTextColor(QtGui.QColor("#00529B"))
        self.verticalHeaderFont = font
        self.logConsole.setTextColor(NORMAL_LOG_COLOR)
        # Link the stdout to log textedit
        self.originalsys = sys.stdout
        sys.stdout = StdOutStream()
        # self.wheelfilter = WheelFilter()
        # self.graph_comboBox.installEventFilter(self.wheelfilter)
        # Set current index to the comboBox
        # self.graph_comboBox.setCurrentIndex(-1)


        # Action
        self.log_tabWidget.currentChanged.connect(self.changeTab)
        sys.stdout.textWritten.connect(self.writeLog)
        self.logClear_btn.clicked.connect(self.clearLog)
        # self.graph_comboBox.currentIndexChanged.connect(self.changeGraph)
        self.tableExport_btn.clicked.connect(self.exportTable)
        self.plotExport_btn.clicked.connect(self.exportPlot)


    # Function for the log tab
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def __init__(self, parent=None):
        super().__init__(parent)
        s = Settings()
        browser_font_size = int(s.value('browser_font', 9))
        self.title_font = QtGui.QFont('Open Sans Extrabold', browser_font_size)
        self.summary_font = QtGui.QFont('Open Sans',
                                        browser_font_size * 0.95,
                                        QtGui.QFont.Bold)
        self.title_font_metrics = QtGui.QFontMetrics(self.title_font)
        self.summary_font_metrics = QtGui.QFontMetrics(self.title_font)
        self.last_icon_size = self.parent().iconSize().height()
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def placeholder_thumb_generator(title, size=150):
    """Returns a QPixmap of size with the first letter of each word in title"""
    initials = ' '.join([x[0] for x in title.split(' ') if len(x) > 2])
    key = 'placeholder' + initials
    img = QtGui.QPixmapCache.find(key)
    if img:
        return img
    qsize = QtCore.QSize(size, size)
    circle_color = QtGui.QColor(50, 50, 50)
    text_color = QtGui.QColor(75, 75, 75)
    rect = QtCore.QRect(QtCore.QPoint(0, 0), QtCore.QPoint(size, size))
    center = QtCore.QPoint(size / 2, size / 2)
    img = QtGui.QPixmap(qsize)
    img.fill(QtCore.Qt.transparent)
    p = QtGui.QPainter(img)
    p.setFont(QtGui.QFont('Open Sans', size / 4, weight=QtGui.QFont.Bold))
    p.setBrush(QtGui.QBrush(circle_color))
    p.setPen(circle_color)
    p.setRenderHint(QtGui.QPainter.Antialiasing, True)
    p.drawEllipse(center, size / 2 - 1, size / 2 - 1)
    p.setPen(text_color)
    p.drawText(rect, QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter, initials)
    QtGui.QPixmapCache.insert(key, img)
    return img
项目:plexdesktop    作者:coryo    | 项目源码 | 文件源码
def show_indicator(self):
        self.indicator = self.scene.addText(
            'Loading', QtGui.QFont('Helvetica', 16, 1))
        self.indicator.setDefaultTextColor(QtGui.QColor('red'))
        viwport_center = self.ui.view.mapToScene(
            self.ui.view.viewport().geometry().center())
        self.indicator.setPos(viwport_center - self.indicator.boundingRect().center())
项目:rteeg    作者:kaczmarj    | 项目源码 | 文件源码
def __init__(self, stream, func, args, buffer_len, kill_signal,
                 parent=None):
        super(MainWindow, self).__init__(parent)

        self.feedback = QLabel()
        self.feedback.setText("Waiting for feedback ...")
        self.feedback.setAlignment(QtCore.Qt.AlignCenter)

        font = QtGui.QFont()
        font.setPointSize(24)
        self.feedback.setFont(font)

        self.layout = QVBoxLayout()
        self.layout.addWidget(self.feedback)

        self.setLayout(self.layout)
        self.setWindowTitle("feedback")
        self.resize(300, 200)

        self.worker = Worker(stream=stream,
                             func=func,
                             args=args,
                             buffer_len=buffer_len,
                             kill_signal=kill_signal)
        self.worker.refresh_signal.connect(self.update)
        self.worker.start()
项目:CRIkit2    作者:CoherentRamanNIST    | 项目源码 | 文件源码
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(389, 239)
        Dialog.setStyleSheet("font: 10pt \"Arial\";")
        self.gridLayout = QtWidgets.QGridLayout(Dialog)
        self.gridLayout.setObjectName("gridLayout")
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1)
        self.verticalLayout = QtWidgets.QVBoxLayout()
        self.verticalLayout.setObjectName("verticalLayout")
        self.label = QtWidgets.QLabel(Dialog)
        font = QtGui.QFont()
        font.setFamily("Arial")
        font.setPointSize(10)
        font.setItalic(False)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.verticalLayout.addWidget(self.label, 0, QtCore.Qt.AlignTop)
        self.comboBox = QtWidgets.QComboBox(Dialog)
        self.comboBox.setObjectName("comboBox")
        self.verticalLayout.addWidget(self.comboBox)
        spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem)
        spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.verticalLayout.addItem(spacerItem1)
        self.label_2 = QtWidgets.QLabel(Dialog)
        self.label_2.setObjectName("label_2")
        self.verticalLayout.addWidget(self.label_2)
        self.plainTextEditDescription = QtWidgets.QPlainTextEdit(Dialog)
        self.plainTextEditDescription.setReadOnly(True)
        self.plainTextEditDescription.setObjectName("plainTextEditDescription")
        self.verticalLayout.addWidget(self.plainTextEditDescription)
        self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog)
项目:pyqt5    作者:yurisnm    | 项目源码 | 文件源码
def switch_to_text(self, text):

        font = QFont()
        font.setPointSize(self.__height_to_point(self.PIX.height()))
        graphics_text_item = QGraphicsTextItem(text)
        graphics_text_item.setFlag(QGraphicsItem.ItemIsMovable)
        graphics_text_item.setFont(font)
        self.scene().addItem(graphics_text_item)
        graphics_text_item.setPos(
            QPoint(self.item.boundingRect().x(), self.item.boundingRect().y()))
        self.path = QPainterPath()
        self.item = GraphicsPathItem()
        self.scene().addItem(self.item)
项目:defconQt    作者:trufont    | 项目源码 | 文件源码
def otherUIFont():
    """
    Returns an auxiliary UI font.
    """
    font = QFont()
    pointSize = 9
    if sys.platform == "win32":
        font.setFamily("Segoe UI")
    elif sys.platform == "darwin":
        try:
            platform
        except NameError:
            import platform
        if platform.mac_ver()[0].startswith("10.10"):
            font.setFamily("Lucida Grande")
        pointSize = 12
    elif sys.platform.startswith("linux"):
        font.setFamily("Luxi Sans")
    font.setPointSize(pointSize)
    return font

# ----
# Keys
# ----
项目:Linalfred    作者:PeterHo    | 项目源码 | 文件源码
def setEditBoxFont(self):
        font = QFont()
        font.setPointSize(self.dlg.theme.editBoxFontSize)
        self.setFont(font)
项目:asprilo    作者:potassco    | 项目源码 | 文件源码
def set_rect(self, rect):
        scale = config.get('display', 'id_font_scale')
        bold = config.get('display', 'id_font_bold')
        self._text.setFont(QFont('', rect.width()*0.08*scale))
        self._text.setPos(rect.x(), rect.y() + 0.6*rect.height())
        self._text.setDefaultTextColor(QColor(config.get('display', 'id_font_color')))
        if self._display_mode == 0:
            if bold:
                self._text.setHtml('<b>P(' + str(self._id) + ')</b>')
            else:
                self._text.setHtml('P(' + str(self._id) + ')')
            self._graphics_item.setRect(rect.x(), rect.y(), rect.width(), rect.height())
            self._items[0].setRect(rect.x() + rect.width()/5, rect.y(), rect.width()/5, rect.height())
            self._items[1].setRect(rect.x() + rect.width()/5 * 3, rect.y(), rect.width()/5, rect.height())
        elif self._display_mode == 1:
            self._text.setPlainText('')
            self._graphics_item.setRect(rect.x(), rect.y(), rect.width(), rect.height())
            self._items[0].setRect(rect.x() + rect.width()/5, rect.y(), rect.width()/5, rect.height())
            self._items[1].setRect(rect.x() + rect.width()/5 * 3, rect.y(), rect.width()/5, rect.height())
项目:asprilo    作者:potassco    | 项目源码 | 文件源码
def set_rect(self, rect):
        if self._carried is not None:
            rect = self._carried.get_rect()

        scale = config.get('display', 'id_font_scale')
        bold = config.get('display', 'id_font_bold')
        self._text.setFont(QFont('', rect.width()*0.08*scale))
        self._text.setPos(rect.x(), rect.y() + 0.4*rect.height())
        self._text.setDefaultTextColor(QColor(config.get('display', 'id_font_color')))

        if self._display_mode == 0:
            if bold:
                self._text.setHtml('<b>S(' + str(self._id) + ')</b>')
            else:
                self._text.setHtml('S(' + str(self._id) + ')')
            self._graphics_item.setRect(rect.x() + 0.25*rect.width(), 
                                        rect.y() + 0.25*rect.height(),
                                        rect.width()*0.5,
                                        rect.height()*0.5)

            self._graphics_carried.setRect(rect.x() + 0.325*rect.width(), 
                                        rect.y() + 0.325*rect.height(),
                                        rect.width()*0.35,
                                        rect.height()*0.35)
        elif self._display_mode == 1:
            self._text.setPlainText('')
            self._graphics_item.setRect(rect.x() + 0.05*rect.width(),
                                        rect.y() + 0.05*rect.height(),
                                        rect.width()*0.9,
                                        rect.height()*0.9)
            self._graphics_carried.setRect(rect.x() + 0.125*rect.width(),
                                        rect.y() + 0.125*rect.height(),
                                        rect.width()*0.75,
                                        rect.height()*0.75)
项目:asprilo    作者:potassco    | 项目源码 | 文件源码
def set_rect(self, rect):
        scale = config.get('display', 'id_font_scale')
        bold = config.get('display', 'id_font_bold')
        self._text.setFont(QFont('', rect.width()*0.08*scale))
        self._text.setPos(rect.x(), rect.y() + 0.2*rect.height())
        self._text.setDefaultTextColor(QColor(config.get('display', 'id_font_color')))

        if self._display_mode == 0:
            if bold:
                self._text.setHtml('<b>R(' + str(self._id) + ')</b>')
            else:
                self._text.setHtml('R(' + str(self._id) + ')')
            self._graphics_item.setRect(rect.x() + 0.25*rect.width(), 
                                        rect.y() + 0.25*rect.height(),
                                        rect.width()*0.5,
                                        rect.height()*0.5,)

        elif self._display_mode == 1:
            self._text.setPlainText('')
            self._graphics_item.setRect(rect.x() + 0.05*rect.width(),
                                        rect.y() + 0.05*rect.height(),
                                        rect.width()*0.9,
                                        rect.height()*0.9)

        if self._carries is not None:
            self._carries.set_rect(rect)
项目:asprilo    作者:potassco    | 项目源码 | 文件源码
def set_rect(self, rect):
        scale = config.get('display', 'id_font_scale')
        bold = config.get('display', 'id_font_bold')
        font = QFont('', rect.width()*0.08*scale)
        self._text.setFont(font)
        self._text.setPos(rect.x(), rect.y() + 0.6*rect.height())
        self._text.setDefaultTextColor(QColor(config.get('display', 'id_font_color')))

        if self._display_mode == 0:            
            ss = ''
            if bold:
                ss = '<b>'
            for key in self._ids:
                count = 0
                for ii in self._ids[key]:
                    if count == 0:
                        ss = ss + '(' + key + ': ' + ii[0]
                    else:
                        ss = ss + ', ' + ii[0]
                    count += 1
                ss = ss + ')\n'

            if bold:
                ss += '</b>'

            self._text.setHtml(ss)
            self._graphics_item.setRect(rect.x(), rect.y(), rect.width(), rect.height())

        elif self._display_mode == 1:
            self._text.setPlainText('')
            self._graphics_item.setRect(rect.x(), rect.y(), rect.width(), rect.height())
项目:brown    作者:ajyoon    | 项目源码 | 文件源码
def __init__(self, brown_object, family_name, size, weight, italic):
        """
        Args:
            brown_object (Brush): The object this interface belongs to
            family_name (str): The name of the font family
            size (Unit): The size of the font
            weight (int or None): The font weight. If `None`,
                a normal weight will be used.
            italic (bool): Italicized or not
        """
        super().__init__(brown_object)
        self.family_name = family_name
        self.size = size
        self.weight = weight
        self.italic = italic
        self.qt_object = QtGui.QFont(
            self.family_name,
            GraphicUnit(self.size).value,
            self.weight if self.weight is not None else -1,
            self.italic)
        self._qt_font_info_object = QtGui.QFontInfo(self.qt_object)
        self._qt_font_metrics_object = QtGui.QFontMetricsF(
            self.qt_object,
            brown._app_interface.view)

    ######## PUBLIC PROPERTIES ########
项目:brown    作者:ajyoon    | 项目源码 | 文件源码
def test_init_qt_attribute_transfer(self):
        test_font = FontInterface(None, 'Bravura', MockUnit(12), 1, False)
        assert(isinstance(test_font.qt_object, QtGui.QFont))
        assert(test_font.qt_object.bold() is False)
        assert(test_font.qt_object.italic() is False)
        assert(test_font.qt_object.pointSize() == 6)
        assert(test_font.qt_object.weight() == 1)