当前位置: 首页>>代码示例>>Python>>正文


Python QtGui.QFont方法代码示例

本文整理汇总了Python中PySide2.QtGui.QFont方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QFont方法的具体用法?Python QtGui.QFont怎么用?Python QtGui.QFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide2.QtGui的用法示例。


在下文中一共展示了QtGui.QFont方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: confirmDialog

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def confirmDialog(tex_count):
    """
    displays a confirmation dialog (with info about amount of found textures) for starting texture conversion process
    """
    font = QtGui.QFont()
    font.setBold( True )

    dialog = QtWidgets.QMessageBox()
    if in_hou:
        dialog.setParent(hou.ui.mainQtWindow(), QtCore.Qt.Window)
        dialog.setProperty("houdiniStyle", True)
    dialog.setFont(font)

    dialog.setIcon(QtWidgets.QMessageBox.Information)
    dialog.setWindowTitle("Proceed?")
    dialog.setText("{} textures found, proceed?".format(tex_count))

    dialog.setStandardButtons(QtWidgets.QMessageBox.Cancel | QtWidgets.QMessageBox.Ok)
    dialog.setDefaultButton(QtWidgets.QMessageBox.Yes)
    ret = dialog.exec_()
    
    if ret == dialog.Ok:
        return True
    else:
        return False 
开发者ID:jtomori,项目名称:batch_textures_convert,代码行数:27,代码来源:gui.py

示例2: __init__

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def __init__(self, name=None):

        pen = QtGui.QPen(QtCore.Qt.SolidLine)
        pen.setColor(QtGui.QColor(0, 0, 0, 255))
        pen.setWidthF(0.2)
        pen.setJoinStyle(QtCore.Qt.MiterJoin)
        self.pen = pen

        self.brush = QtGui.QBrush(QtGui.QColor(255, 255, 0, 255))
        self.font = QtGui.QFont('Decorative', 12)

        self.rect = QtCore.QRectF()
        self.shape = QtGui.QPainterPath()
        self.path = QtGui.QPainterPath()

        self.scale = (1, 1)
        self.tooltip = ''

        self.method = ''
        self.args = [] 
开发者ID:chiefenne,项目名称:PyAero,代码行数:22,代码来源:GraphicsItemsCollection.py

示例3: data

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def data(self, index, role=Qt.DisplayRole):
        if role == Qt.CheckStateRole:
            return None

        if role == Qt.FontRole:
            return QFont(self.font_name, self.font_size)

        regs = self.view.session_data['emulator.registers']
        if len(regs) == 0 and index.row() == 0:
            return None

        if regs[index.row()][index.column()] is None:
            return None

        elif index.column() == 0:
            return regs[index.row()][0]
        else:
            return hex(regs[index.row()][1]) 
开发者ID:joshwatson,项目名称:f-ing-around-with-binaryninja,代码行数:20,代码来源:registers.py

示例4: init_font_config

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def init_font_config(self):
        self.ui_default_font = QApplication.font("QMenu")
        self.tabular_view_font = QApplication.font("QMenu")

        self.disasm_font = QFont("DejaVu Sans Mono", 10)
        self.disasm_font_metrics = QFontMetricsF(self.disasm_font)
        self.disasm_font_height = self.disasm_font_metrics.height()
        self.disasm_font_width = self.disasm_font_metrics.width('A')
        self.disasm_font_ascent = self.disasm_font_metrics.ascent()

        self.symexec_font = QFont("DejaVu Sans Mono", 10)
        self.symexec_font_metrics = QFontMetricsF(self.symexec_font)
        self.symexec_font_height = self.symexec_font_metrics.height()
        self.symexec_font_width = self.symexec_font_metrics.width('A')
        self.symexec_font_ascent = self.symexec_font_metrics.ascent()

        self.code_font = QFont("Source Code Pro", 10)
        self.code_font_metrics = QFontMetricsF(self.code_font)
        self.code_font_height = self.code_font_metrics.height()
        self.code_font_width = self.code_font_metrics.width('A')
        self.code_font_ascent = self.code_font_metrics.ascent() 
开发者ID:angr,项目名称:angr-management,代码行数:23,代码来源:config_manager.py

示例5: _show_trace_func

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def _show_trace_func(self, show_func_tag):
        x = self.TRACE_FUNC_X
        y = self.TRACE_FUNC_Y
        prev_name = None
        for position in self.trace.trace_func:
            bbl_addr = position.bbl_addr
            func_name = position.func_name
            l.debug('Draw function %x, %s', bbl_addr, func_name)
            color = self.trace.get_func_color(func_name)
            self.trace_func.addToGroup(self.scene.addRect(x, y,
                                                          self.TRACE_FUNC_WIDTH, self.trace_func_unit_height,
                                                          QPen(color), QBrush(color)))
            if show_func_tag is True and func_name != prev_name:
                tag = self.scene.addText(func_name, QFont("Source Code Pro", 7))
                tag.setPos(x + self.TRACE_FUNC_WIDTH +
                           self.TAG_SPACING, y -
                           tag.boundingRect().height() // 2)
                self.trace_func.addToGroup(tag)
                anchor = self.scene.addLine(
                    self.TRACE_FUNC_X + self.TRACE_FUNC_WIDTH, y,
                    x + self.TRACE_FUNC_WIDTH + self.TAG_SPACING, y)
                self.trace_func.addToGroup(anchor)
                prev_name = func_name
            y += self.trace_func_unit_height 
开发者ID:angr,项目名称:angr-management,代码行数:26,代码来源:qtrace_viewer.py

示例6: main

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def main():
    app = QApplication(sys.argv)

    app.setWindowIcon(QIcon(':/icons/app.svg'))

    fontDB = QFontDatabase()
    fontDB.addApplicationFont(':/fonts/Roboto-Regular.ttf')
    app.setFont(QFont('Roboto'))

    f = QFile(':/style.qss')
    f.open(QFile.ReadOnly | QFile.Text)
    app.setStyleSheet(QTextStream(f).readAll())
    f.close()

    translator = QTranslator()
    translator.load(':/translations/' + QLocale.system().name() + '.qm')
    app.installTranslator(translator)

    mw = MainWindow()
    mw.show()

    sys.exit(app.exec_()) 
开发者ID:gmarull,项目名称:pyside2-boilerplate,代码行数:24,代码来源:__main__.py

示例7: __getFont

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def __getFont(self):
		weight = self.weight

		if self.weight == TextFormatWeight.NORMAL:
			weight = QtGui.QFont.Normal
		elif self.weight == TextFormatWeight.BOLD:
			weight = QtGui.QFont.Bold
		elif self.weight == TextFormatWeight.BOLDER:
			weight = QtGui.QFont.Black
		elif self.weight == TextFormatWeight.LIGHTER:
			weight = QtGui.QFont.Light

		font = QtGui.QFont()
		font.setFamily(self.font)
		font.setPixelSize(self.size)
		font.setWeight(weight)
		font.setItalic(self.italic)

		return font 
开发者ID:yuehaowang,项目名称:pylash_engine,代码行数:21,代码来源:display.py

示例8: data

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def data(self, index, role=Qt.DisplayRole):
        if role == Qt.CheckStateRole:
            return None

        if role == Qt.FontRole:
            return QFont(self.font_name, self.font_size)

        size = len(self.stack)

        if 0 == size or size < index.row():
            return

        return hex(self.stack[index.row()][index.column()]) 
开发者ID:joshwatson,项目名称:f-ing-around-with-binaryninja,代码行数:15,代码来源:stack.py

示例9: __init__

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def __init__(self, view, label, callback):
        super().__init__(label)
        self.callback = callback
        self.view = view

        font_name = Settings().get_string('ui.font.name')
        font_size = Settings().get_integer('ui.font.size')
        button_font = QFont(font_name, font_size)
        fm = QFontMetrics(button_font)
        self.setFont(button_font)
        self.setFixedWidth(fm.horizontalAdvance(label) + 10)

        QObject.connect(self, SIGNAL('clicked()'), self.callback) 
开发者ID:joshwatson,项目名称:f-ing-around-with-binaryninja,代码行数:15,代码来源:buttons.py

示例10: data

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def data(self, index, role=Qt.DisplayRole):
        if role == Qt.CheckStateRole:
            return None

        if role == Qt.FontRole:
            return QFont(self.font_name, self.font_size)

        memory = self.view.session_data.get('emulator.memory')
        if memory is None:
            return

        row = memory[index.row()]

        if index.column() == 0:
            return hex(row.start)

        elif index.column() == 1:
            return hex(row.end)

        elif index.column() == 2:
            return hex(row.data_offset)

        elif index.column() == 3:
            return hex(row.data_length)

        elif index.column() == 4:
            return (
                f'{"r" if row.readable else "-"}'
                f'{"w" if row.writable else "-"}'
                f'{"x" if row.executable else "-"}'
            ) 
开发者ID:joshwatson,项目名称:f-ing-around-with-binaryninja,代码行数:33,代码来源:memory.py

示例11: __init__

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def __init__(self, backgroundLayer = None):
		super(LineEdit, self).__init__()
		
		self.__font = "Arial"
		self.__size = 15
		self.__italic = False
		self.__weight = TextFormatWeight.NORMAL
		self.__preWidth = self.width
		self.__preHeight = self.height
		self.__preX = self.x
		self.__preY = self.y
		self.__preVisible = not self.visible
		self.__textColor = "black"
		self.__widgetFont = QtGui.QFont()
		self.__widgetPalette = QtGui.QPalette()
		self.lineEditWidget = QtWidgets.QLineEdit(stage.canvasWidget)
		self.backgroundLayer = backgroundLayer

		if not isinstance(self.backgroundLayer, DisplayObject):
			self.backgroundLayer = Sprite()
			self.backgroundLayer.graphics.beginFill("white")
			self.backgroundLayer.graphics.lineStyle(2, "gray")
			self.backgroundLayer.graphics.drawRect(0, 0, 200, 40)
			self.backgroundLayer.graphics.endFill()

		self.addChild(self.backgroundLayer)

		self.__initWidget()

		self.addEventListener(LoopEvent.ENTER_FRAME, self.__loop) 
开发者ID:yuehaowang,项目名称:pylash_engine,代码行数:32,代码来源:ui.py

示例12: __getFontWeight

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def __getFontWeight(self, v):
		weight = v

		if v == TextFormatWeight.NORMAL:
			weight = QtGui.QFont.Normal
		elif v == TextFormatWeight.BOLD:
			weight = QtGui.QFont.Bold
		elif v == TextFormatWeight.BOLDER:
			weight = QtGui.QFont.Black
		elif v == TextFormatWeight.LIGHTER:
			weight = QtGui.QFont.Light

		return weight 
开发者ID:yuehaowang,项目名称:pylash_engine,代码行数:15,代码来源:ui.py

示例13: draw_shape

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def draw_shape(painter, shape):
    options = shape.options
    content_rect = shape.content_rect()
    if shape.clicked:
        bordercolor = QtGui.QColor(options['bordercolor.clicked'])
        backgroundcolor = QtGui.QColor(options['bgcolor.clicked'])
        bordersize = options['borderwidth.clicked']
    elif shape.hovered:
        bordercolor = QtGui.QColor(options['bordercolor.hovered'])
        backgroundcolor = QtGui.QColor(options['bgcolor.hovered'])
        bordersize = options['borderwidth.hovered']
    else:
        bordercolor = QtGui.QColor(options['bordercolor.normal'])
        backgroundcolor = QtGui.QColor(options['bgcolor.normal'])
        bordersize = options['borderwidth.normal']
    textcolor = QtGui.QColor(options['text.color'])
    alpha = options['bordercolor.transparency'] if options['border'] else 255
    bordercolor.setAlpha(255 - alpha)
    backgroundcolor.setAlpha(255 - options['bgcolor.transparency'])

    pen = QtGui.QPen(bordercolor)
    pen.setStyle(QtCore.Qt.SolidLine)
    pen.setWidthF(bordersize)
    painter.setPen(pen)
    painter.setBrush(QtGui.QBrush(backgroundcolor))
    if options['shape'] == 'square':
        painter.drawRect(shape.rect)
    else:
        painter.drawEllipse(shape.rect)

    if shape.pixmap is not None:
        rect = shape.image_rect or content_rect
        painter.drawPixmap(rect, shape.pixmap)

    painter.setPen(QtGui.QPen(textcolor))
    painter.setBrush(QtGui.QBrush(textcolor))
    option = QtGui.QTextOption()
    flags = VALIGNS[options['text.valign']] | HALIGNS[options['text.halign']]
    option.setAlignment(flags)
    font = QtGui.QFont()
    font.setBold(options['text.bold'])
    font.setItalic(options['text.italic'])
    font.setPixelSize(options['text.size'])
    painter.setFont(font)
    text = options['text.content']
    painter.drawText(QtCore.QRectF(content_rect), flags, text) 
开发者ID:luckylyk,项目名称:hotbox_designer,代码行数:48,代码来源:painting.py

示例14: __init__

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def __init__(self, parent=None, mode=0):
        QtWidgets.QMainWindow.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = '0.1'
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'
        self.hotkey = {}
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']
        self.memoData['last_export'] = ''
        self.memoData['last_import'] = ''
        self.name = self.__class__.__name__
        self.location = ''
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
            
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)
        
        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {} 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:45,代码来源:universal_tool_template_1116.py

示例15: __init__

# 需要导入模块: from PySide2 import QtGui [as 别名]
# 或者: from PySide2.QtGui import QFont [as 别名]
def __init__(self, parent=None, mode=0):
        QtWidgets.QMainWindow.__init__(self, parent)
        #------------------------------
        # class variables
        #------------------------------
        self.version = '0.1'
        self.date = '2017.01.01'
        self.log = 'no version log in user class'
        self.help = 'no help guide in user class'
        
        self.uiList={} # for ui obj storage
        self.memoData = {} # key based variable data storage
        self.memoData['font_size_default'] = QtGui.QFont().pointSize()
        self.memoData['font_size'] = self.memoData['font_size_default']
        self.memoData['last_export'] = ''
        self.memoData['last_import'] = ''
        self.name = self.__class__.__name__
        self.location = ''
        if getattr(sys, 'frozen', False):
            # frozen - cx_freeze
            self.location = sys.executable
        else:
            # unfrozen
            self.location = os.path.realpath(sys.modules[self.__class__.__module__].__file__)
            
        self.iconPath = os.path.join(os.path.dirname(self.location),'icons',self.name+'.png')
        self.iconPix = QtGui.QPixmap(self.iconPath)
        self.icon = QtGui.QIcon(self.iconPath)
        self.fileType='.{0}_EXT'.format(self.name)
        
        #------------------------------
        # core function variable
        #------------------------------
        self.qui_core_dict = {
            'vbox': 'QVBoxLayout','hbox':'QHBoxLayout','grid':'QGridLayout', 'form':'QFormLayout',
            'split': 'QSplitter', 'grp':'QGroupBox', 'tab':'QTabWidget',
            'btn':'QPushButton', 'btnMsg':'QPushButton', 'label':'QLabel', 'input':'QLineEdit', 'check':'QCheckBox', 'choice':'QComboBox',
            'txt': 'QTextEdit',
            'list': 'QListWidget', 'tree': 'QTreeWidget', 'table': 'QTableWidget',
            'space': 'QSpacerItem',
            'menu' : 'QMenu', 'menubar' : 'QMenuBar',
        }
        self.qui_user_dict = {} 
开发者ID:shiningdesign,项目名称:universal_tool_template.py,代码行数:45,代码来源:universal_tool_template_1020.py


注:本文中的PySide2.QtGui.QFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。