Python PyQt5.QtGui.QFont.Bold() Examples

The following are 13 code examples of PyQt5.QtGui.QFont.Bold(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtGui.QFont , or try the search function .
Example #1
Source File: syntax.py    From IDAngr with BSD 2-Clause "Simplified" License 6 votes vote down vote up
def format(color, style=''):
    """Return a QTextCharFormat with the given attributes.
    """
    _color = QColor()
    _color.setNamedColor(color)

    _format = QTextCharFormat()
    _format.setForeground(_color)
    if 'bold' in style:
        _format.setFontWeight(QFont.Bold)
    if 'italic' in style:
        _format.setFontItalic(True)

    return _format


# Syntax styles that can be shared by all languages 
Example #2
Source File: TextEditor.py    From Hydra with GNU General Public License v3.0 6 votes vote down vote up
def setDefaultSettings(self, lexer):
        # self.setAutoIndent(True)
        lexer.setFont(self.font)

        lexer.setColor(QColor("white"), 0)  # default
        lexer.setColor(QColor("#6B6E6C"), PythonLexer.Comment)  # = 1
        lexer.setColor(QColor("#ADD4FF"), 2)  # Number = 2
        lexer.setColor(QColor("#38ef7d"), 3)  # DoubleQuotedString
        lexer.setColor(QColor("#38ef7d"), 4)  # SingleQuotedString
        lexer.setColor(QColor("#F6DC74"), 5)  # Keyword
        lexer.setColor(QColor("#38ef7d"), 6)  # TripleSingleQuotedString
        lexer.setColor(QColor("#38ef7d"), 7)  # TripleDoubleQuotedString
        lexer.setColor(QColor("#74F6C3"), 8)  # ClassName
        lexer.setColor(QColor("#FF6666"), 9)  # FunctionMethodName
        lexer.setColor(QColor("magenta"), 10)  # Operator
        lexer.setColor(QColor("white"), 11)  # Identifier
        lexer.setColor(QColor("gray"), 12)  # CommentBlock
        lexer.setColor(QColor("#a8ff78"), 13)  # UnclosedString
        lexer.setColor(QColor("gray"), 14)  # HighlightedIdentifier
        lexer.setColor(QColor("#FF00E7"), 15)  # Decorator

        lexer.setFont(QFont("Iosevka", weight=QFont.Bold), 5)
        self.setCaretLineBackgroundColor(QColor("#3C3B3F"))
        self.setLexer(lexer) 
Example #3
Source File: exceptwindow.py    From Pythonic with GNU General Public License v3.0 6 votes vote down vote up
def initUI(self):

        self.confirm_button = QPushButton()

        self.headline = QFont("Arial", 10, QFont.Bold)

        self.elementInfo = QLabel()
        self.elementInfo.setFont(self.headline)

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

        self.setMinimumSize(400, 300)
        self.setWindowFlags(Qt.Window)

        self.exceptWindowLayout = QVBoxLayout()
        self.exceptWindowLayout.addWidget(self.elementInfo)
        self.exceptWindowLayout.addWidget(self.exceptionMessage)
        self.exceptWindowLayout.addStretch(1)
        self.exceptWindowLayout.addWidget(self.confirm_button)

        self.confirm_button.clicked.connect(self.close)

        self.setLayout(self.exceptWindowLayout) 
Example #4
Source File: uamodeler.py    From opcua-modeler with GNU General Public License v3.0 5 votes vote down vote up
def paint(self, painter, option, idx):
        new_idx = idx.sibling(idx.row(), 0)
        item = self.model.itemFromIndex(new_idx)
        if item and item.data(Qt.UserRole) in self.added_node_list:
            option.font.setWeight(QFont.Bold)
        QStyledItemDelegate.paint(self, painter, option, idx) 
Example #5
Source File: QtGrapSyntax.py    From grap with MIT License 5 votes vote down vote up
def format(color, style=''):
    """Return a QTextCharFormat with the given attributes.
    """
    _color = QColor()
    _color.setNamedColor(color)

    _format = QTextCharFormat()
    _format.setForeground(_color)
    if 'bold' in style:
        _format.setFontWeight(QFont.Bold)
    if 'italic' in style:
        _format.setFontItalic(True)

    return _format 
Example #6
Source File: syntax_hl_log.py    From execution-trace-viewer with MIT License 5 votes vote down vote up
def format(color, style=""):
    """Return a QTextCharFormat with the given attributes."""
    _color = QColor()
    _color.setNamedColor(color)
    _format = QTextCharFormat()
    _format.setForeground(_color)
    if "bold" in style:
        _format.setFontWeight(QFont.Bold)
    if "italic" in style:
        _format.setFontItalic(True)
    return _format


# Syntax styles 
Example #7
Source File: welcome_window.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def showEvent(self, QShowEvent):
        """ override to change font size when subtitle is cutted
        """
        if len(self._sub_title.text()) * self._char_width > (
                self._sub_title.width() - 155):
            font = QFont('OpenSans', 14, QFont.Bold)
            font.setPixelSize(20)
            self._sub_title.setFont(font)
        return super().showEvent(QShowEvent) 
Example #8
Source File: about_dlg.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def setup_ui(self):
        v_box = QVBoxLayout()
        head = QHBoxLayout()
        head.setContentsMargins(10, 10, 0, 10)
        # dwarf icon
        icon = QLabel()
        icon.setPixmap(QPixmap(utils.resource_path('assets/dwarf.svg')))
        icon.setAlignment(Qt.AlignCenter)
        icon.setMinimumSize(QSize(125, 125))
        icon.setMaximumSize(QSize(125, 125))
        head.addWidget(icon)

        # main title
        v_box = QVBoxLayout()
        title = QLabel('Dwarf')
        title.setContentsMargins(0, 0, 0, 0)
        title.setFont(QFont('Anton', 100, QFont.Bold))
        title.setMaximumHeight(125)
        title.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        title.setAlignment(Qt.AlignVCenter | Qt.AlignLeft)
        head.addWidget(title)
        v_box.addLayout(head)

        v_box.addWidget(QLabel('Copyright (C) 2019 Giovanni Rocca (iGio90)'))
        v_box.addWidget(QLabel('Version: ' + DWARF_VERSION))

        license_text = QTextEdit()
        # replace tabbed
        license_text.setText(self._gplv3.replace('            ', ''))
        license_text.setReadOnly(True)
        license_text.setMinimumWidth(550)
        v_box.addWidget(license_text)

        self.setLayout(v_box) 
Example #9
Source File: basic_stack_window.py    From Pythonic with GNU General Public License v3.0 5 votes vote down vote up
def raiseWindow(self, filename):

        logging.debug('StackWindow() called')
        self.setMinimumSize(400, 300)
        self.setWindowFlags(Qt.Window)
        self.setWindowTitle(QC.translate('', 'Stack'))

        self.confirm_button = QPushButton()
        self.confirm_button.setText(QC.translate('', 'Ok'))
        self.confirm_button.clicked.connect(self.close)

        self.headline = QFont("Arial", 10, QFont.Bold)

        self.info_string = QC.translate('', 'Debug info of element:')
        self.elementInfo = QLabel()
        self.elementInfo.setFont(self.headline)
        self.elementInfoText = QC.translate('', 'Last update:')
        self.elementInfoText += ' {}'.format(self.timestamp)
        self.elementInfo.setText(self.elementInfoText)

        # Will contain the QListWidgetItems
        self.stackWidget = QListWidget()

        try:
            self.restock(filename)
        except Exception as e:
            logging.error('StackWindow::raiseWindow() exception while opening file: {}'.format(e))
            self.closed.emit()
            return

               
        self.debugWindowLayout = QVBoxLayout()
        self.debugWindowLayout.addWidget(self.elementInfo)
        self.debugWindowLayout.addWidget(self.stackWidget)
        self.debugWindowLayout.addWidget(self.confirm_button)

        self.setLayout(self.debugWindowLayout)   
        
        self.show() 
Example #10
Source File: debugwindow.py    From Pythonic with GNU General Public License v3.0 5 votes vote down vote up
def raiseWindow(self):

        logging.debug('raiseWindow() called')
        self.setMinimumSize(400, 300)
        self.setWindowFlags(Qt.Window)
        self.setWindowTitle(QC.translate('', 'Debug'))
        self.setWindowModality(Qt.WindowModal)

        self.confirm_button = QPushButton()
        self.confirm_button.setText(QC.translate('', 'Ok'))
        self.confirm_button.clicked.connect(self.close)

        self.headline = QFont("Arial", 10, QFont.Bold)

        self.info_string = QC.translate('', 'Debug info of element:')
        self.elementInfo = QLabel()
        self.elementInfo.setFont(self.headline)
        self.elementInfo.setText(self.info_string + '{} {}'.format(self.source[0],
            alphabet[self.source[1]]))

        self.debugMessage = QTextEdit()
        self.debugMessage.setReadOnly(True)
        self.debugMessage.setText(self.message)



        self.debugWindowLayout = QVBoxLayout()
        self.debugWindowLayout.addWidget(self.elementInfo)
        self.debugWindowLayout.addWidget(self.debugMessage)
        self.debugWindowLayout.addStretch(1)
        self.debugWindowLayout.addWidget(self.confirm_button)

        self.setLayout(self.debugWindowLayout)   
        
        self.show() 
Example #11
Source File: demo.py    From 3D-Human-Body-Shape with MIT License 5 votes vote down vote up
def set_slider(self):
    self.slider = []
    self.spin = []
    self.label = []
    for i in range(0, utils.M_NUM):
      hbox = QtWidgets.QHBoxLayout()
      slider = IndexedQSlider(i, QtCore.Qt.Horizontal, self)
      slider.setStatusTip('%d. %s' % (i, utils.M_STR[i]))
      slider.setRange(-30, 30)
      slider.valueChangeForwarded.connect(
          self.viewer3D.sliderForwardedValueChangeHandler)
      slider.setFixedWidth(60)
      self.slider.append(slider)
      spinBox = QtWidgets.QSpinBox()
      spinBox.setRange(-30, 30)
      spinBox.valueChanged.connect(slider.setValue)
      slider.valueChanged.connect(spinBox.setValue)
      self.spin.append(spinBox)
      label = QtWidgets.QLabel()
      label.setText(utils.M_STR[i])
      # label.setFont(QFont("Arial", 11, QFont.Bold))
      label.setFont(QFont("Arial", 12))
      label.setFixedWidth(190)
      self.label.append(label)
      hbox.addWidget(label)
      hbox.addWidget(slider)
      hbox.addWidget(spinBox)
      self.box.addLayout(hbox) 
Example #12
Source File: demo.py    From 3D-Human-Body-Shape with MIT License 5 votes vote down vote up
def set_dialog(self):
    self.pre_dialog = QtWidgets.QDialog()
    self.dialogBox = QtWidgets.QVBoxLayout()
    self.pre_dialog.setWindowTitle("Input")
    self.editList = []
    for i in range(0, utils.M_NUM):
      edit = QtWidgets.QLineEdit()
      self.editList.append(edit)
      label = QtWidgets.QLabel()
      if i == 0:
        label.setText('{} (x2 kg)'.format(utils.M_STR[i]))
      else:
        label.setText('{} (cm)'.format(utils.M_STR[i]))
      # label.setFont(QFont("Arial", 11, QFont.Bold))
      label.setFont(QFont("Arial", 12))
      label.setFixedHeight(20)
      label.setFixedWidth(190)
      box = QtWidgets.QHBoxLayout()
      box.addWidget(label)
      box.addWidget(edit)
      self.dialogBox.addLayout(box)
    dialogOK = QtWidgets.QPushButton("OK")
    clearButton = QtWidgets.QPushButton("CLEAR")
    dialogOK.setFont(QFont("Arial", 11, QFont.Bold))
    clearButton.setFont(QFont("Arial", 11, QFont.Bold))
    dialogOK.clicked.connect(self.predict)
    clearButton.clicked.connect(self.clear)
    box = QtWidgets.QHBoxLayout()
    box.addWidget(dialogOK)
    box.addWidget(clearButton)
    self.dialogBox.addLayout(box)
    self.pre_dialog.setLayout(self.dialogBox) 
Example #13
Source File: videolist.py    From vidcutter with GNU General Public License v3.0 4 votes vote down vote up
def paint(self, painter: QPainter, option: QStyleOptionViewItem, index: QModelIndex) -> None:
        r = option.rect
        pencolor = Qt.white if self.theme == 'dark' else Qt.black
        if self.parent.isEnabled():
            if option.state & QStyle.State_Selected:
                painter.setBrush(QColor(150, 190, 78, 150))
            elif option.state & QStyle.State_MouseOver:
                painter.setBrush(QColor(227, 212, 232))
                pencolor = Qt.black
            else:
                brushcolor = QColor(79, 85, 87, 175) if self.theme == 'dark' else QColor('#EFF0F1')
                painter.setBrush(Qt.transparent if index.row() % 2 == 0 else brushcolor)
        painter.setPen(Qt.NoPen)
        painter.drawRect(r)
        thumbicon = QIcon(index.data(Qt.DecorationRole + 1))
        starttime = index.data(Qt.DisplayRole + 1)
        endtime = index.data(Qt.UserRole + 1)
        externalPath = index.data(Qt.UserRole + 2)
        chapterName = index.data(Qt.UserRole + 3)
        painter.setPen(QPen(pencolor, 1, Qt.SolidLine))
        if len(chapterName):
            offset = 20
            r = option.rect.adjusted(5, 5, 0, 0)
            cfont = QFont('Futura LT', -1, QFont.Medium)
            cfont.setPointSizeF(12.25 if sys.platform == 'darwin' else 10.25)
            painter.setFont(cfont)
            painter.drawText(r, Qt.AlignLeft, self.clipText(chapterName, painter, True))
            r = option.rect.adjusted(5, offset, 0, 0)
        else:
            offset = 0
            r = option.rect.adjusted(5, 0, 0, 0)
        thumbicon.paint(painter, r, Qt.AlignVCenter | Qt.AlignLeft)
        r = option.rect.adjusted(110, 10 + offset, 0, 0)
        painter.setFont(QFont('Noto Sans', 11 if sys.platform == 'darwin' else 9, QFont.Bold))
        painter.drawText(r, Qt.AlignLeft, 'FILENAME' if len(externalPath) else 'START')
        r = option.rect.adjusted(110, 23 + offset, 0, 0)
        painter.setFont(QFont('Noto Sans', 11 if sys.platform == 'darwin' else 9, QFont.Normal))
        if len(externalPath):
            painter.drawText(r, Qt.AlignLeft, self.clipText(os.path.basename(externalPath), painter))
        else:
            painter.drawText(r, Qt.AlignLeft, starttime)
        if len(endtime) > 0:
            r = option.rect.adjusted(110, 48 + offset, 0, 0)
            painter.setFont(QFont('Noto Sans', 11 if sys.platform == 'darwin' else 9, QFont.Bold))
            painter.drawText(r, Qt.AlignLeft, 'RUNTIME' if len(externalPath) else 'END')
            r = option.rect.adjusted(110, 60 + offset, 0, 0)
            painter.setFont(QFont('Noto Sans', 11 if sys.platform == 'darwin' else 9, QFont.Normal))
            painter.drawText(r, Qt.AlignLeft, endtime)