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


Python QAction.setFont方法代码示例

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


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

示例1: addInfoActions

# 需要导入模块: from qgis.PyQt.QtWidgets import QAction [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QAction import setFont [as 别名]
def addInfoActions(layer):
    commitId = getCommitId(layer)
    tracking = getTrackingInfo(layer)
    repo = Repository(tracking.repoUrl)
    _infoActions[layer.id()] = []
    try:
        commit = Commit.fromref(repo, commitId)
        messageAction = QAction("Message: '%s'" % commit.message.splitlines()[0], config.iface.legendInterface())
        f = messageAction.font();
        f.setBold(True);
        messageAction.setFont(f);
        config.iface.legendInterface().addLegendLayerAction(messageAction, u"GeoGig", u"id1", QgsMapLayer.VectorLayer, False)
        config.iface.legendInterface().addLegendLayerActionForLayer(messageAction, layer)
        _infoActions[layer.id()].append(messageAction)
    except Exception, e:
        QgsMessageLog.logMessage("Cannot connect to server when creating GeoGig layer context:\n %s" % str(e), level=QgsMessageLog.WARNING)
        messageAction = QAction("Error: Cannot connect with repository", config.iface.legendInterface())
        f = messageAction.font();
        f.setBold(True);
        messageAction.setFont(f);
        config.iface.legendInterface().addLegendLayerAction(messageAction, u"GeoGig", u"id1", QgsMapLayer.VectorLayer, False)
        config.iface.legendInterface().addLegendLayerActionForLayer(messageAction, layer)
        _infoActions[layer.id()].append(messageAction)
        return False
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:26,代码来源:layeractions.py

示例2: str

# 需要导入模块: from qgis.PyQt.QtWidgets import QAction [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QAction import setFont [as 别名]
        config.iface.legendInterface().addLegendLayerActionForLayer(messageAction, layer)
        _infoActions[layer.id()].append(messageAction)
    except Exception, e:
        QgsMessageLog.logMessage("Cannot connect to server when creating GeoGig layer context:\n %s" % str(e), level=QgsMessageLog.WARNING)
        messageAction = QAction("Error: Cannot connect with repository", config.iface.legendInterface())
        f = messageAction.font();
        f.setBold(True);
        messageAction.setFont(f);
        config.iface.legendInterface().addLegendLayerAction(messageAction, u"GeoGig", u"id1", QgsMapLayer.VectorLayer, False)
        config.iface.legendInterface().addLegendLayerActionForLayer(messageAction, layer)
        _infoActions[layer.id()].append(messageAction)
        return False
    shaAction = QAction("Commit ID: %s" % commitId, config.iface.legendInterface())
    f = shaAction.font();
    f.setBold(True);
    shaAction.setFont(f);
    config.iface.legendInterface().addLegendLayerAction(shaAction, u"GeoGig", u"id1", QgsMapLayer.VectorLayer, False)
    config.iface.legendInterface().addLegendLayerActionForLayer(shaAction, layer)
    _infoActions[layer.id()].append(shaAction)
    return True

def updateInfoActions(layer):
    setAsRepoLayer(layer)

def setAsNonRepoLayer(layer):
    removeLayerActions(layer)
    action = QAction("Import to GeoGig...", config.iface.legendInterface())
    action.triggered.connect(partial(addLayer, layer))
    if layer.type() == QgsMapLayer.RasterLayer or layer.storageType() != 'GPKG':
        action.setEnabled(False)
    config.iface.legendInterface().addLegendLayerAction(action, u"GeoGig", u"id2", QgsMapLayer.VectorLayer, False)
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:33,代码来源:layeractions.py


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