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


Python QFont.setWeight方法代码示例

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


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

示例1: _create_layout

# 需要导入模块: from AnyQt.QtGui import QFont [as 别名]
# 或者: from AnyQt.QtGui.QFont import setWeight [as 别名]
    def _create_layout(self):
        box = gui.widgetBox(self.mainArea, 'RMSE')
        BOLD_FONT = QFont()
        BOLD_FONT.setWeight(QFont.DemiBold)
        widget = self

        class HereTableWidget(QTableWidget):
            def __init__(self, parent):
                super().__init__(parent)
                parent.layout().addWidget(self)
                self.setHorizontalScrollMode(self.ScrollPerPixel)
                self.setVerticalScrollMode(self.ScrollPerPixel)

            def update_table(self, fusers, relations):
                self.clear()
                self.setRowCount(0)
                self.setColumnCount(len(fusers))
                self.setHorizontalHeaderLabels([fuser[0].name for fuser in fusers.values()])
                for id, relation in relations.items():
                    row = self.rowCount()
                    self.insertRow(row)
                    if not np.ma.is_masked(relation.data):
                        widget.warning(id, 'Relation "{}" has no missing values '
                                           '(mask)'.format(relation_str(relation)))
                    rmses = []
                    for fuser in fusers.values():
                        rep_rmse = []
                        for fuserfit in fuser:
                            if not fuserfit.can_complete(relation):
                                break
                            completion = fuserfit.complete(relation)
                            rep_rmse.append(RMSE(relation.data, completion))
                        rmses.append(np.mean(rep_rmse) if rep_rmse else None)
                    try: min_rmse = min(e for e in rmses if e is not None)
                    except ValueError: continue # No fuser could complete this relation
                    for col, rmse in enumerate(rmses):
                        if rmse is None: continue
                        item = QTableWidgetItem('{:.05f}'.format(rmse))
                        item.setFlags(Qt.ItemIsEnabled)
                        if rmse == min_rmse and len(rmses) > 1:
                            item.setFont(BOLD_FONT)
                        self.setItem(row, col, item)
                self.setVerticalHeaderLabels([relation_str(i) for i in relations.values()])
                self.resizeColumnsToContents()
                self.resizeRowsToContents()

        self.table = HereTableWidget(box)
开发者ID:biolab,项目名称:orange3-datafusion,代码行数:49,代码来源:owcompletionscoring.py

示例2: update_font

# 需要导入模块: from AnyQt.QtGui import QFont [as 别名]
# 或者: from AnyQt.QtGui.QFont import setWeight [as 别名]
def update_font(basefont, weight=None, italic=None, underline=None,
                pixelSize=None, pointSize=None):
    """
    Return a copy of `basefont` :class:`QFont` with updated properties.
    """
    font = QFont(basefont)

    if weight is not None:
        font.setWeight(weight)

    if italic is not None:
        font.setItalic(italic)

    if underline is not None:
        font.setUnderline(underline)

    if pixelSize is not None:
        font.setPixelSize(pixelSize)

    if pointSize is not None:
        font.setPointSize(pointSize)

    return font
开发者ID:PrimozGodec,项目名称:orange3,代码行数:25,代码来源:outputview.py


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