本文整理汇总了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)
示例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
示例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)
示例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)
示例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()
示例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)
示例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
示例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)
示例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)
示例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)
示例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)
示例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
示例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)
示例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()
示例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()