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


Python iface.messageBar方法代码示例

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


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

示例1: __init__

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def __init__(self, inMsg=' Loading...', inMaxStep=1):
        """
        """
        # Save reference to the QGIS interface
        # initialize progressBar
        # QApplication.processEvents() # Help to keep UI alive
        self.iface = iface

        widget = iface.messageBar().createMessage('Please wait  ', inMsg)

        prgBar = QProgressBar()
        self.prgBar = prgBar

        widget.layout().addWidget(self.prgBar)
        iface.messageBar().pushWidget(widget)
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        # if Max 0 and value 0, no progressBar, only cursor loading
        # default is set to 0
        prgBar.setValue(1)
        # set Maximum for progressBar
        prgBar.setMaximum(inMaxStep) 
开发者ID:nkarasiak,项目名称:dzetsaka,代码行数:24,代码来源:progressBar.py

示例2: showUserAndLogMessage

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def showUserAndLogMessage(before, text="", level=QGis.Info, duration=3, onlyLog=False):
        ''' Show user & log info/warning/error messages '''
        if not onlyLog:
            iface.messageBar().popWidget()
            iface.messageBar().pushMessage(
                before, text, level=level, duration=duration)
        if level == QGis.Info:
            log.info(text)
        elif level == QGis.Warning:
            log.warning(text)
        elif level == QGis.Critical:
            log.error(text)
        return

#     @staticmethod
#     def removeMosaicFolder(video_file):
#         ''' Remove mosaic folder '''
#         folder = getVideoFolder(video_file)
#         out = os.path.join(folder, "mosaic")
#         try:
#             shutil.rmtree(out, ignore_errors=True)
#         except Exception:
#             None 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:25,代码来源:QgsUtils.py

示例3: populate

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def populate(self):
        stores = self.element.catalog.get_stores(workspaces=self.element)
        nonAscii = False
        for store in stores:
            storeItem = GsStoreItem(store)
            try:
                storeItem.populate()
            except UnicodeDecodeError:
                nonAscii = True
                continue
            self.addChild(storeItem)

        if nonAscii:
            iface.messageBar().pushMessage("Warning", "Some datasores contain non-ascii characters and could not be loaded",
                                  level = Qgis.Warning,
                                  duration = 10) 
开发者ID:planetfederal,项目名称:qgis-geoserver-plugin,代码行数:18,代码来源:gsexploreritems.py

示例4: messageShow

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def messageShow(self, progress, count, max):
        if not progress:
            progressMessageBar = iface.messageBar().createMessage(
                "Looping through " + str(max) + " records ...")
            progress = QProgressBar()
            progress.setMaximum(max)
            progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
            progressMessageBar.layout().addWidget(progress)
            iface.messageBar().pushWidget(progressMessageBar, level=1)
            iface.mainWindow().repaint()
        #    return progress
        if progress:
            progress.setValue(count)
        return(progress) 
开发者ID:riccardoklinger,项目名称:Hqgis,代码行数:16,代码来源:hqgis.py

示例5: reset

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def reset(self):
        """!@brief Simply remove progressBar and reset cursor
        """
        # Remove progressBar and back to default cursor
        self.iface.messageBar().clearWidgets()
        self.iface.mapCanvas().refresh()
        QApplication.restoreOverrideCursor() 
开发者ID:nkarasiak,项目名称:dzetsaka,代码行数:9,代码来源:progressBar.py

示例6: updatePublishedStyle

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def updatePublishedStyle(layer):
    global _currentMessageBarLayer
    track = pluginSetting("TrackLayers")
    if track and isTrackedLayer(layer):
        if iface.messageBar().currentItem() is None:
            _resetCurrentMessageBarLayer()
        if _currentMessageBarLayer != layer:
            _currentMessageBarLayer = layer
            widget = iface.messageBar().createMessage("",
                    "This layer was uploaded to a geoserver catalog. Do you want to update the published style?")
            updateButton = QtWidgets.QPushButton(widget)
            updateButton.setText("Update")
            def updateStyle():
                url = getTrackingInfo(layer)
                catalog = Catalog(url)
                wrapper = CatalogWrapper(catalog)
                wrapper.publishStyle(layer)
                iface.messageBar().popWidget()
                _resetCurrentMessageBarLayer()
            updateButton.pressed.connect(updateStyle)
            widget.layout().addWidget(updateButton)
            stopTrackingButton = QtWidgets.QPushButton(widget)
            stopTrackingButton.setText("Stop tracking this layer")
            def stopTracking():
                removeTrackedLayer(layer)
                iface.messageBar().popWidget()
                _resetCurrentMessageBarLayer()
            stopTrackingButton.pressed.connect(stopTracking)
            widget.layout().addWidget(stopTrackingButton)
            iface.messageBar().pushWidget(widget, Qgis.Info)
            iface.messageBar().currentItem().geoserverLayer = layer
            #iface.messageBar().widgetRemoved.connect(_resetCurrentMessageBarLayer) 
开发者ID:planetfederal,项目名称:qgis-geoserver-plugin,代码行数:34,代码来源:layerwatcher.py

示例7: get_layers

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def get_layers(self, resource=None):
        """Prefix the layer name with ws name"""
        lyrs = super().get_layers(resource)
        # Start patch:
        layers = {}
        result = []
        for l in lyrs:
            try:
                layers[l.name].append(l)
            except KeyError:
                layers[l.name] = [l]
        # Prefix all names
        noAscii = False
        for name, ls in list(layers.items()):
            try:
                if len(ls) == 1:
                    l = ls[0]
                    l.name = self.get_namespaced_name(l.name)
                    result.append(l)
                else:
                    i = 0
                    res = self._get_res(ls[0].name)
                    for l in ls:
                        l.name = "%s:%s" % (res[i].workspace.name, l.name)
                        i += 1
                        result.append(l)
            except UnicodeDecodeError:
                noAscii = True

        if noAscii:
            iface.messageBar().pushMessage("Warning", "Some layers contain non-ascii characters and could not be loaded",
                      level = QgsMessageBar.WARNING,
                      duration = 10)
        return result 
开发者ID:planetfederal,项目名称:qgis-geoserver-plugin,代码行数:36,代码来源:basecatalog.py

示例8: setInfo

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def setInfo(msg):
    iface.messageBar().pushMessage("Info", msg,
                                              level = Qgis.Info,
                                              duration = 10) 
开发者ID:planetfederal,项目名称:qgis-geoserver-plugin,代码行数:6,代码来源:__init__.py

示例9: setWarning

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def setWarning(msg):
    iface.messageBar().pushMessage("Warning", msg,
                                          level = Qgis.Warning,
                                          duration = 10) 
开发者ID:planetfederal,项目名称:qgis-geoserver-plugin,代码行数:6,代码来源:__init__.py

示例10: setError

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def setError(msg, trace=None):
    iface.messageBar().pushMessage("Geoserver", msg, level=Qgis.Warning, duration=10)
    if trace is not None:
        QgsMessageLog.logMessage("{}:{}".format(msg, trace), level=Qgis.Critical) 
开发者ID:planetfederal,项目名称:qgis-geoserver-plugin,代码行数:6,代码来源:__init__.py

示例11: _showSldParsingError

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def _showSldParsingError(self):
        iface.messageBar().pushMessage("Warning", "Style is not stored as XML and cannot be edited",
                                              level = Qgis.Warning,
                                              duration = 10) 
开发者ID:planetfederal,项目名称:qgis-geoserver-plugin,代码行数:6,代码来源:gsexploreritems.py

示例12: resetActivity

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def resetActivity(self):
        if self.progress is not None:
            iface.messageBar().clearWidgets()
            self.isProgressVisible = False
            self.progress = None
            self.progressMaximum = 0 
开发者ID:planetfederal,项目名称:qgis-geoserver-plugin,代码行数:8,代码来源:explorer.py

示例13: setProgressMaximum

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def setProgressMaximum(self, value, msg = ""):
        self.progressMaximum = value
        self.isProgressVisible = True
        self.progressMessageBar = iface.messageBar().createMessage(msg)
        self.progress = QProgressBar()
        self.progress.setMaximum(self.progressMaximum)
        self.progress.setAlignment(Qt.AlignLeft|Qt.AlignVCenter)
        self.progressMessageBar.layout().addWidget(self.progress)
        iface.messageBar().pushWidget(self.progressMessageBar, Qgis.Info) 
开发者ID:planetfederal,项目名称:qgis-geoserver-plugin,代码行数:11,代码来源:explorer.py

示例14: accept

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def accept(self):
        self.__project.create_raster_from_formation(self.formation.currentData(),
                                     self.level.currentText(),
                                     self.outDir.filePath()
                                     )
        iface.messageBar().pushMessage("Export raster completed",
                                       """<a href="file:///{dir}">{dir}</a>""".format(dir=self.outDir.filePath()),
                                       level=Qgis.Info, duration=5)
        self.close() 
开发者ID:Oslandia,项目名称:albion,代码行数:11,代码来源:export_raster_formation.py

示例15: accept

# 需要导入模块: from qgis.utils import iface [as 别名]
# 或者: from qgis.utils.iface import messageBar [as 别名]
def accept(self):
        self.__project.create_raster_from_collar(self.useDepth.isChecked(),
                                     self.outDir.filePath()
                                     )
        iface.messageBar().pushMessage("Export raster completed",
                                       """<a href="file:///{dir}">{dir}</a>""".format(dir=self.outDir.filePath()),
                                       level=Qgis.Info, duration=5)
        self.close() 
开发者ID:Oslandia,项目名称:albion,代码行数:10,代码来源:export_raster_collar.py


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