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


Python QtGui.QFont类代码示例

本文整理汇总了Python中PySide.QtGui.QFont的典型用法代码示例。如果您正苦于以下问题:Python QFont类的具体用法?Python QFont怎么用?Python QFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: optionsf

	def optionsf(self):
		self.opt = optdlg(self)
		self.opt.spinBox.setProperty("value", int(self.fontsize))
		font = QFont()
		font.setPixelSize(int(self.fontsize))
		self.opt.sampletxt.setFont(font)

		if str(self.clipauto) == "True":
			self.opt.checkclip.setChecked(True)
		elif str(self.clipauto) == "False":
			self.opt.checkclip.setChecked(False)

		if str(self.histdock) == "True":
			self.opt.checkshowhistdock.setChecked(True)
		elif str(self.histdock) == "False":
			self.opt.checkshowhistdock.setChecked(False)

		if str(self.bkmdock) == "True":
			self.opt.checkshowbkmdock.setChecked(True)
		elif str(self.bkmdock) == "False":
			self.opt.checkshowbkmdock.setChecked(False)

		self.opt.show()
		self.connect(self.opt.buttonBox, SIGNAL("accepted()"), self.optok)
		self.connect(self.opt.buttonBox.button(QDialogButtonBox.Apply), SIGNAL("clicked()"), self.optapply)
		self.connect(self.opt.checkdelhist, SIGNAL("stateChanged(int)"), self.deleteallhist)
		self.connect(self.opt.checkshowhistdock, SIGNAL("stateChanged(int)"), self.shownexttime)
		self.connect(self.opt.checkshowbkmdock, SIGNAL("stateChanged(int)"), self.shownexttime)
开发者ID:jnoortheen,项目名称:nigandu,代码行数:28,代码来源:mainwin.py

示例2: __init__

    def __init__(self, parent=None, userData=None,inspector = True):
        QWebView.__init__(self, parent)  

        settings = QWebSettings.globalSettings()
        settings.setFontFamily(QWebSettings.StandardFont, 'Helvetica')
        settings.setFontSize(QWebSettings.DefaultFontSize, 12)

        self.webpage = page = PtWebPage(self)        
        self.setPage(page) 
        self.connect(self, SIGNAL('loadFinished(bool)'), self.onLoadFinished)
        self.settings().setAttribute(
                    QWebSettings.WebAttribute.DeveloperExtrasEnabled, True)
        #path = os.getcwd()
        #self.settings().setUserStyleSheetUrl(QUrl.fromLocalFile(path + "/myCustom.css"))

        font = QFont("Helvetica")
        font.setPixelSize(12)
        self.setFont(font)
        # or globally:
        # QWebSettings.globalSettings().setAttribute(
        #     QWebSettings.WebAttribute.DeveloperExtrasEnabled, True)
        if inspector:
            self.inspector = QWebInspector()
            self.inspector.setPage(self.page())
            self.inspector.hide()

        self.page().setLinkDelegationPolicy(QWebPage.DelegateAllLinks)
        self.page().linkClicked.connect(self._on_page_link_clicked)
开发者ID:ptphp,项目名称:PtPy,代码行数:28,代码来源:ptwebview.py

示例3: paintEvent

 def paintEvent(self, event):
     """ Paints the widgets:
      - paints the background
      - paint each visible blocks that intersects the widget bbox.
     """
     painter = QPainter(self)
     painter.fillRect(event.rect(), self.back_brush)
     painter.setPen(self.text_pen)
     painter.setFont(self.font)
     w = self.width() - 2
     # better name lookup speed
     painter_drawText = painter.drawText
     align_right = Qt.AlignRight
     normal_font = painter.font()
     normal_font.setBold(False)
     bold_font = QFont(normal_font)
     bold_font.setBold(True)
     active = self.editor.codeEdit.textCursor().blockNumber()
     for vb in self.editor.codeEdit.visible_blocks:
         row = vb.row
         if row == active + 1:
             painter.setFont(bold_font)
         else:
             painter.setFont(normal_font)
         painter_drawText(0, vb.top, w, vb.height, align_right,
                          str(row))
     return Panel.paintEvent(self, event)
开发者ID:hofoen,项目名称:pcef-core,代码行数:27,代码来源:lines.py

示例4: initUI

    def initUI(self):
        self.setWindowTitle('TickTackToe 2000')

        self.resize(350, 350)
        self.center()

        self.main_layout = QVBoxLayout()

        self.form_layout = QGridLayout()
        self.main_layout.addLayout(self.form_layout)

        splitter = QSplitter(QtCore.Qt.Horizontal)
        self.main_layout.addWidget(splitter)

        self.game_layout = QGridLayout()
        self.main_layout.addLayout(self.game_layout)

        self.server_label = QLabel("Server: ")
        self.server_input = QLineEdit("127.0.0.1")
        self.form_layout.addWidget(self.server_label, 0, 0)
        self.form_layout.addWidget(self.server_input, 0, 1)

        self.port_label = QLabel("Port: ")
        self.port_input = QLineEdit("1632")
        self.form_layout.addWidget(self.port_label, 1, 0)
        self.form_layout.addWidget(self.port_input, 1, 1)

        self.connect_button = QPushButton("Connect")
        self.connect_button.setMinimumHeight(60)
        self.connect_button.pressed.connect(self.reconnect)
        self.form_layout.addWidget(self.connect_button, 0, 2, 2, 1)

        self.game_fields = {}

        tile_font = QFont()
        tile_font.setPointSize(30)

        for x in range(0, GAME_SIZE):
            for y in range(0, GAME_SIZE):
                f = QPushButton(" ")
                f.setMinimumHeight(90)
                f.setDisabled(True)
                f.setFont(tile_font)
                f.clicked.connect(self.onGameButtonClicked)

                if x in self.game_fields:
                    self.game_fields[x][y] = f
                else:
                    self.game_fields[x] = { 0: f }

                self.game_layout.addWidget(f, y, x)

        central_widget = QtGui.QWidget()
        central_widget.setLayout(self.main_layout)
        self.setCentralWidget(central_widget)

        self.statusBar().showMessage("")

        self.show()
开发者ID:pidpawel,项目名称:tictactoe,代码行数:59,代码来源:client.py

示例5: sizeHint

    def sizeHint(self, option, index):
        '''Custom size calculation of our items'''

        uid = to_str(index.data(role=IDROLE)) + 'x' + str(option.rect.width()) #Fix Bug #967 (sometime uid have some strange unicode chars ... ?)
        try:
            return self.memoized_size[uid]
        except:
            tweet = to_str(index.data(Qt.DisplayRole))

            # One time is enought sizeHint need to be fast

            if not self.fm:
                self.normFont = QFont(option.font)
                self.normFont.setPointSizeF(option.font.pointSizeF()
                        * self.fsize)
                self.fm = QFontMetrics(self.normFont)

            if not self.minifm:
                self.miniFont = QFont(option.font)
                self.miniFont.setPointSizeF(option.font.pointSizeF()
                        * 0.8 * self.fsize)
                self.minifm = QFontMetrics(self.miniFont)

            height = self.fm.boundingRect(
                0,
                0,
                option.rect.width() - 75,
                800,
                int(Qt.AlignTop) | int(Qt.AlignLeft) | int(Qt.TextWordWrap),
                tweet,
                ).height()

            reply_text = to_str(index.data(role=REPLYTEXTROLE))
            if reply_text:
                height += self.minifm.boundingRect(
                    0,
                    0,
                    option.rect.width() - 75,
                    800,
                    int(Qt.AlignTop) | int(Qt.AlignLeft)
                        | int(Qt.TextWordWrap),
                    reply_text,
                    ).height() + 5

            height += self.minifm.boundingRect(
                0,
                0,
                option.rect.width() - 75,
                800,
                int(Qt.AlignTop) | int(Qt.AlignLeft) | int(Qt.TextWordWrap),
                'LpqAT',
                ).height()
            height += 10  # Spacer

            if height < 70:
                height = 70
            self.memoized_size[uid] = QSize(option.rect.width(), height)
            return self.memoized_size[uid]
开发者ID:Jonney,项目名称:Khweeteur,代码行数:58,代码来源:list_view.py

示例6: drawGameOver

 def drawGameOver(self, painter):
     """ Draw the Game Over Message """
     font = QFont()
     font.setPointSize(48)
     penColor = QColor(255, 0, 0)
     
     painter.setFont(font)
     painter.setPen(penColor)
     painter.drawText(self.contentsRect(), Qt.AlignCenter, "Game Over")
开发者ID:cloew,项目名称:GalagaEsque,代码行数:9,代码来源:level_view.py

示例7: drawPaused

 def drawPaused(self, painter):
     """ Draw the Paused Message """
     font = QFont()
     font.setPointSize(48)
     penColor = QColor(238, 250, 12)
     
     painter.setFont(font)
     painter.setPen(penColor)
     painter.drawText(self.contentsRect(), Qt.AlignCenter, "Paused")
开发者ID:cloew,项目名称:GalagaEsque,代码行数:9,代码来源:level_view.py

示例8: drawScore

 def drawScore(self, painter):
     """ Draw the Score label """
     font = QFont()
     font.setPointSize(24)
     penColor = QColor(238, 250, 12)
     
     painter.setFont(font)
     painter.setPen(penColor)
     painter.drawText(10, 50, "Score: {0:,}".format(self.level.score))
开发者ID:cloew,项目名称:GalagaEsque,代码行数:9,代码来源:level_view.py

示例9: AdjacencyClueView

class AdjacencyClueView(QFrame): # Prolly could use a better name
    """ Represents the Adjacency Clue View """
    TRANSPARENCY = 100
    
    def __init__(self, adjacencyClue, fragilityClue, parent=None):
        """ Initialize the Adjacency Clue View """
        QFrame.__init__(self, parent)
        self.adjacencyClue = adjacencyClue
        self.fragilityClue = fragilityClue
        self.resize(34, 32)
        self.setupClueLabel()
        
    def setupFont(self):
        """ Setup the Font """
        self.font = QFont()
        self.font.setPointSize(15)
        
    def setupClueLabel(self):
        """ Setup the Clue Label """
        self.setupFont()
        self.clueLabel = QLabel('', self)
        self.clueLabel.setFont(self.font)
        self.clueLabel.move(0, 0)
        
    def updateView(self):
        """ Update the View """
        self.clueLabel.setText(self.getLabelText())
        self.setColorBasedOnFragility()
        self.clueLabel.resize(34, self.clueLabel.contentsRect().height())
        
    def getLabelText(self):
        """ Get the CLue Reading Text """
        adjacentMines = self.adjacencyClue.getAdjacentMinesClue()
        if adjacentMines == 0:
            return ''
        else:
            return str(adjacentMines)
        
    def setColorBasedOnFragility(self):
        """ Set color of the clue based on adjacency to Fragile Mines """
        color = "rgba({0}, {1}%)".format(self.getColor(), self.TRANSPARENCY)
        self.clueLabel.setStyleSheet("QLabel { color : %s }" % color)
        
    def getColor(self):
        """ Return color """
        if self.fragilityClue.distance is None:
            return "0, 0, 0"
        elif self.fragilityClue.distance <= 1:
            if self.fragilityClue.count == 1:
                return "227, 68, 20"
            else:
                return "196, 0, 0"
        elif self.fragilityClue.distance > 1 and self.fragilityClue.distance < 4:
            return "244, 244, 0"
        elif self.fragilityClue.distance >= 4:
            return "0, 154, 0"
开发者ID:cloew,项目名称:PyMine,代码行数:56,代码来源:adjacency_clue_view.py

示例10: setfontsize

	def setfontsize(self, i):
		if i >= 8 or i <= 24:
			font = QFont()
			font.setPixelSize(i)
			self.comboBox.setFont(font)
			self.searchbtn.setFont(font)
			self.bkmli.setFont(font)
			self.histli.setFont(font)
			self.listview.setFont(font)
			self.tamtext.setFont(font)
开发者ID:jnoortheen,项目名称:nigandu,代码行数:10,代码来源:mainwin.py

示例11: font

 def font(bold):
     """
     Returns a `QFont` object to be used in `View` derived classes.
     
     :param bold: Indicates whether or not the font will be bold
     """
     
     font = QFont(View.fontFamily, 9, 50, False)
     font.setBold(bold)
     
     return font
开发者ID:ShareByLink,项目名称:iqbox-ftp,代码行数:11,代码来源:views.py

示例12: __init__

    def __init__(self, view, uistack, widget):
        f = QFont('FreeMono')
        f.setWeight(QFont.Black)
        f.setPixelSize(16)

        self.grids = []
        self.colors = []

        self._view = view

        for p in providers:
            view.colors.addItem(p.name)
        view.colors.currentIndexChanged.connect(self.colorchange)

        self._detailview = view.detail
        self._detailview.scale(10, 10)

        self._lastdepth = -1
        self._detail = None
        self.add()

        view.layer.sliderMoved.connect(self.layer)
        view.detailLayer.sliderMoved.connect(self.detaillayer)

        self._view.add.pressed.connect(self.add)

        def detailevent(event):
            if (isinstance(event, QKeyEvent) and
                    event.text() == u'\t' and
                    event.type() == QEvent.ShortcutOverride):
                widget.keyPressEvent(QKeyEvent(
                    QEvent.KeyPress,
                    event.key(),
                    event.nativeModifiers(),
                    event.text(),
                    event.isAutoRepeat(),
                    event.count()))
                return True
            return QWidget.event(widget, event)

        widget.event = detailevent
        widget.keyPressEvent = self.key

        view.rotation.valueChanged.connect(self.rotate)

        view.layer.setValue(view.layer.maximum())

        self._view.showDetail.pressed.connect(self.showdetail)
        self._view.hideDetail.pressed.connect(self.hidedetail)
        self.hidedetail()

        self._view.pentagon.pressed.connect(self.pentagon)

        self._uistack = uistack
开发者ID:tps12,项目名称:hey-grid,代码行数:54,代码来源:screenpresenter.py

示例13: load_layout_list

 def load_layout_list(self, settings):
     self.layout_list.clear()
     for menu_item in settings:
         font = QFont()
         if menu_item == 'pin_notes' or menu_item == 'notes':
             font.setStyle(QFont.StyleItalic)
         else:
             font.setWeight(QFont.DemiBold)
         item = QListWidgetItem(self.layout_labels[menu_item])
         item.setData(Qt.UserRole, menu_item)
         item.setTextAlignment(Qt.AlignCenter)
         item.setFont(font)
         self.layout_list.addItem(item)
开发者ID:MikeyG,项目名称:gevernote,代码行数:13,代码来源:management.py

示例14: __CreateGrid

    def __CreateGrid(self):
        g1 = QGridLayout()
        self.centralWidget().setLayout(g1)

        g1.setSpacing(5)

        bold = QFont()
        bold.setBold(True)
        self.__AddGridLabel(g1, 'Source Directory:', QFont(), 0, 0, -1)
        self.__AddGridLabel(g1, 'Archive Directory:', QFont(), 1, 0, -1)
        self.__AddGridLabel(g1, 'Target Directory:', QFont(), 2, 0, -1)
        self.__AddGridLabel(g1, 'Max Number of Videos:', QFont(), 3, 0, -1)
        self.__AddGridLabel(g1, 'Video File Types:', QFont(), 3, 2, -1)
        #self.__AddGridLabel(g1, 'Max Run Time in Hours:', QFont(), 4, 2, -1)

        g1.addWidget(self.qleSourceDir, 0, 1, 1, 3)
        g1.addWidget(self.qleArchiveDir, 1, 1, 1, 3)
        g1.addWidget(self.qleDestinationDir, 2, 1, 1, 3)
        g1.addWidget(self.qleMaxVidsCap, 3, 1)
        g1.addWidget(self.qleVideoTypes, 3, 3)
        #g1.addWidget(self.qleRunTimeMax, 4, 3)
        
        g1.addWidget(self.qpbRun, 10, 3, alignment = -1)
        
        g1.addWidget(QLabel('', self), 4, 0,) # Empty Column As Separator
        g1.addWidget(QLabel('', self), 5, 0,) # Empty Column As Separator
        
        self.__AddGridLabel(g1, 'Videos Completed:',   bold, 5, 0, -1)
        self.__AddGridLabel(g1, 'Start Time:',         bold, 5, 2, -1)
        self.__AddGridLabel(g1, 'Videos In Progress:', bold, 6, 0, -1)
        self.__AddGridLabel(g1, 'Time Remaining:',     bold, 7, 2, -1)
        self.__AddGridLabel(g1, 'Target Space Left:',  bold, 7, 0, -1)
        self.__AddGridLabel(g1, 'Archive Space Left:', bold, 8, 0, -1)
        self.__AddGridLabel(g1, 'End Time:',           bold, 6, 2, -1)
        self.__AddGridLabel(g1, 'Processing Speed:',   bold, 8, 2, -1)
        
        g1.addWidget(self.qlVidsDone,        5, 1,) 
        g1.addWidget(self.qlVidsInProgress,  6, 1)
        g1.addWidget(self.qlStartTime,       5, 3,) 
        g1.addWidget(self.qlEndTime,         6, 3,) 
        g1.addWidget(self.qlTimeLeft,        7, 3,) 
        g1.addWidget(self.qlDestinationSpace,     7, 1,) 
        g1.addWidget(self.qlArcSpace,        8, 1,)
        g1.addWidget(self.qlProcessingSpeed, 8, 3,)
        
        g1.addWidget(self.qpbSourceDir,      0, 4,)
        g1.addWidget(self.qpbArchiveDir,     1, 4,)
        g1.addWidget(self.qpbTargetDir,      2, 4,)        
        self.show
开发者ID:DominicanKnight,项目名称:ManageHD,代码行数:49,代码来源:ManageHD_GUI.py

示例15: __init__

 def __init__(self, repo, selected_items, parent=None):
     super(CommitDialog, self).__init__(parent=parent)
     self.repo = repo
     self.dialog_buttons.button(QDialogButtonBox.Ok).setEnabled(False)
     self.selected_items = selected_items
     if len(selected_items) == 1 and isinstance(selected_items[0],
             WorkspaceDirectory):
         self.root_dir = selected_items[0]
     else:
         self.root_dir = None
     fixed_font = QFont('Courier', self.message_text.font().pointSize())
     fixed_font.setStyleHint(QFont.Monospace)
     self.message_text.setFont(fixed_font)
     self.text_pos_label.setFont(fixed_font)
     with busy_cursor():
         self.staged_changes_model = StagedChangesModel(repo, self.root_dir,
             parent=self)
         self.local_changes_model = LocalChangesModel(repo.workspace,
             parent=self)
         self.local_changes_model.file_source = lambda: tuple(deep_item
             for selected_item in selected_items
             for deep_item in deep_file_list(selected_item)
             if exclude_unmodified(deep_item) and exclude_ignored(deep_item))
         if self.root_dir:
             self.staged_changes_button.setChecked(True)
             self.show_staged_changes()
         else:
             self.local_changes_button.setChecked(True)
             self.show_local_changes()
         if self.repo.head_ref:
             (self.last_commit,) = self.repo.log(max_commits=1)
         else:
             self.last_commit = None
             self.action_reuse_last_msg.setEnabled(False)
             self.action_reuse_log_msg.setEnabled(False)
             self.amend_checkbox.setEnabled(False)
     self.staged_changes_button.clicked.connect(self.show_staged_changes)
     self.local_changes_button.clicked.connect(self.show_local_changes)
     self.local_changes_model.dataChanged.connect(self.local_change_toggled)
     self.message_text.cursorPositionChanged.connect(self.text_pos_changed)
     self.message_text.textChanged.connect(self.message_text_changed)
     reuse_menu = QMenu()
     reuse_menu.addAction(self.action_reuse_last_msg)
     reuse_menu.addAction(self.action_reuse_log_msg)
     self.reuse_msg_button.setDefaultAction(self.action_reuse_last_msg)
     self.reuse_msg_button.setMenu(reuse_menu)
     self.action_reuse_last_msg.triggered.connect(self.reuse_last_message)
     self.action_reuse_log_msg.triggered.connect(self.select_old_message)
     self.amend_checkbox.toggled.connect(self.amend_toggled)
开发者ID:vstojkovic,项目名称:berk,代码行数:49,代码来源:commit.py


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