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


Python QgsMessageBar.WARNING属性代码示例

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


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

示例1: Verifica

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def Verifica(self, Opcao):
        proj = QgsProject.instance()
        Formas=QEsgModel.GIS_SHAPES
        msgTxt=''
        for aForma in Formas:
            ProjVar=proj.readEntry("QEsg", aForma)[0]
            if ProjVar!='':
                #msgTxt+=QCoreApplication.translate('QEsg','Layer Indefinido: ') +aForma+ '\n'
            #else:
                vLayerLst=QgsMapLayerRegistry.instance().mapLayersByName(ProjVar)
                if vLayerLst:
                    vLayer=vLayerLst[0]
                    #msgTxt+=aForma+ '='+vLayer.name()+ '\n' #dataProvider().dataSourceUri()
                    if Opcao=='Criar':
                        self.CriaCampos(aForma,vLayer)
                    elif Opcao=='Preencher' and aForma=='PIPES': #so estou preenchendo o layer de tubos por enquanto
                        self.Preenche(aForma,vLayer)
                else:
                    msgTxt+=aForma+'='+ProjVar+QCoreApplication.translate('QEsg',u' (Layer não encontrado)')+'\n'
        if msgTxt!='':
            iface.messageBar().pushMessage("QEsg:", msgTxt, level=QgsMessageBar.WARNING, duration=4)
            #QMessageBox.information(None,'QEsg',msgTxt) 
开发者ID:jorgealmerio,项目名称:QEsg,代码行数:24,代码来源:QEsg_01Campos.py

示例2: clicked

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def clicked(self, pt, b):
        '''Capture the coordinate when the mouse button has been released,
        format it, and copy it to the clipboard.'''
        try:
            if self.capture4326:
                canvasCRS = self.canvas.mapSettings().destinationCrs()
                transform = QgsCoordinateTransform(canvasCRS, epsg4326)
                pt4326 = transform.transform(pt.x(), pt.y())
                self.capturesig.emit(pt4326)
                return
            msg = self.formatCoord(pt, self.settings.delimiter)
            formatString = self.coordFormatString()
            if msg != None:
                clipboard = QApplication.clipboard()
                clipboard.setText(msg)
                self.iface.messageBar().pushMessage("", "{} coordinate {} copied to the clipboard".format(formatString, msg), level=QgsMessageBar.INFO, duration=4)
        except Exception as e:
            self.iface.messageBar().pushMessage("", "Invalid coordinate: {}".format(e), level=QgsMessageBar.WARNING, duration=4) 
开发者ID:NationalSecurityAgency,项目名称:qgis-latlontools-plugin,代码行数:20,代码来源:copyLatLonTool.py

示例3: process_ili_file

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def process_ili_file(self, ilifile):
        fileModels = list()
        try:
            fileModels = self.parse_ili_file(ilifile, "utf-8")
        except UnicodeDecodeError:
            try:
                fileModels = self.parse_ili_file(ilifile, "latin1")
                self.new_message.emit(QgsMessageBar.WARNING,
                    self.tr('Even though the ili file `{}` could be read, it is not in UTF-8. Please encode your ili models in UTF-8.'.format(os.path.basename(ilifile))))
            except UnicodeDecodeError:
                self.new_message.emit(QgsMessageBar.CRITICAL,
                    self.tr('Could not parse ili file `{}` with UTF-8 nor Latin-1 encodings. Please encode your ili models in UTF-8.'.format(os.path.basename(ilifile))))
                QgsMessageLog.logMessage(self.tr('Could not parse ili file `{ilifile}`. We suggest you to encode it in UTF-8. ({exception})'.format(ilifile=ilifile, exception=str(e))), self.tr('Projectgenerator'))
                fileModels = list()

        return fileModels 
开发者ID:opengisch,项目名称:projectgenerator,代码行数:18,代码来源:ilicache.py

示例4: run

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def run(self):
        active_layer = self.iface.activeLayer()
        try:
            btm_left, top_right = bounds_from_extent(self.iface.mapCanvas().extent(), active_layer.crs())
        except AttributeError:
            self.clear_and_push_message("No active layer!", QgsMessageBar.CRITICAL, 3)
            print "be sure to have an active layer before starting the plugin"
            return

        self.dlg.show()
        self.fill_with_bounds(btm_left, top_right)
        result = self.dlg.exec_()

        if result:
            self.filename = self.dlg.lineEdit_5.text().replace(" ", "")
            self.dest_path = os.path.join(self.dlg.lineEdit_6.text(), self.filename + '.tif')
            self.bounds = (btm_left[0], btm_left[1], top_right[0], top_right[1])
            self.clear_and_push_message("DEM data is being downloaded, please wait for the process to complete", QgsMessageBar.WARNING, 10)

            import elevation
            elevation.datasource.clip(bounds=self.bounds, output=self.dest_path)

            self.clear_and_push_message("Data correctly downloaded", QgsMessageBar.INFO, 5)
            if self.dlg.preview_checkbox.isChecked():
            	self.iface.addRasterLayer(self.dest_path, '%s srtm dem' % self.filename) 
开发者ID:bopen,项目名称:qgis-elevation-plugin,代码行数:27,代码来源:qgis_elevation_plugin.py

示例5: uiNDVIthresholdLSEcalc

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def uiNDVIthresholdLSEcalc(self):
        self.ndviRaster = self.dlg.lseNDVIthresholdNDVI.text()
        self.outputPath = self.dlg.lseNDVIthresholdOutputRaster.text()
        self.rasterType = str(self.dlg.lseNDVIthresholdRasterFormat.currentText())
        #Loading the raster to the QGIS project
        if (self.dlg.lseNDVIthresholdAddToProject.isChecked()):
            self.addToQGIS = 'Yes'
        else:
            self.addToQGIS = 'No'
        #Validate the inputs
        if self.ndviRaster == '':
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                                "NDVI is required",
                                                QgsMessageBar.WARNING, 3)
        elif self.outputPath == '':
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                                "Specify output to be saved",
                                                QgsMessageBar.WARNING, 3)
        elif self.outputPath != '' and self.ndviRaster !='':
            self.argList = [self.ndviRaster, self.outputPath, self.rasterType, self.addToQGIS]
            self.startWorker('ndviThresholdLSE', self.argList, 'Estimating LSE from NDVI')
        self.closePlugin() 
开发者ID:miltonisaya,项目名称:landSurfaceTemperature,代码行数:24,代码来源:lst_tool.py

示例6: zhangLSEalgorithm

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def zhangLSEalgorithm(self):
        self.ndviRaster   = self.dlg.zhangNDVILineEdit.text()
        self.outputRaster = self.dlg.zhangOutputLineEdit.text()
        self.rasterType   = str(self.dlg.zhangRasterType.currentText())
        if self.dlg.zhangLSEAddToProject.isChecked():
            self.addToQGIS = 'Yes'
        else:
            self.addToQGIS = 'No'
        #Validate the inputs
        if self.ndviRaster == '':
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                                "NDVI is required",
                                                QgsMessageBar.WARNING, 3)
        elif self.outputRaster == '':
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                                "Specify output to be saved",
                                                QgsMessageBar.WARNING, 3)
        elif self.outputRaster != '' and self.ndviRaster !='':
            self.argList = [self.ndviRaster, self.outputRaster, self.rasterType, self.addToQGIS]
            self.startWorker('ZhangLSE', self.argList, 'Estimating the LSE from NDVI')
        self.closePlugin() 
开发者ID:miltonisaya,项目名称:landSurfaceTemperature,代码行数:23,代码来源:lst_tool.py

示例7: uiCalcBrightnessTemp

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def uiCalcBrightnessTemp(self):
        self.sensorType      = self.dlg.btSensorType.currentText()
        self.bandNo          = self.dlg.btBandNo.currentText()
        self.radianceRaster  = self.dlg.btRadianceRaster.text()
        self.outputRaster    = self.dlg.btOutputRaster.text()
        self.fileType        = str(self.dlg.btFormat.currentText())
        
        if (self.dlg.btAddToProject.isChecked()):
            self.addToQGIS = 'Yes'
        else:
            self.addToQGIS = 'No'
        #Validate the inputs
        if self.radianceRaster =='':
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                                "The radiance is required",
                                                QgsMessageBar.WARNING, 3)
        elif self.outputRaster == '':
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                                "Specify output to be saved",
                                                QgsMessageBar.WARNING, 3)
        elif self.radianceRaster != '' and self.outputRaster != '':
            self.argList = [self.sensorType, self.bandNo, self.radianceRaster, self.outputRaster, self.fileType, self.addToQGIS]
            self.startWorker('BT', self.argList, 'Calculating TOA Brightness Temperature')
        self.closePlugin() 
开发者ID:miltonisaya,项目名称:landSurfaceTemperature,代码行数:26,代码来源:lst_tool.py

示例8: canvasReleaseEvent

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def canvasReleaseEvent(self, event):
        point = self.canvas.getCoordinateTransform().toMapCoordinates(
            event.x(), event.y())

        if self.layer is None:
            self.identifyMessage.emit(
                self.tr('To identify landmarks, you must select landmarks '
                        'layer by clicking on its name in the legend'),
                QgsMessageBar.WARNING)
            return

        if self.layer.type() != QgsMapLayer.VectorLayer:
            self.identifyMessage.emit(
                self.tr('This tool works only for vector layers. Please '
                        'select another layer in legend and try again'),
                QgsMessageBar.WARNING)
            return

        res = self.identifyLayer(point)

        if res:
            print 'Identify OK'
            self.identified.emit(self.results)
        else:
            pass 
开发者ID:matsu-reki,项目名称:GkukanMusiumdb,代码行数:27,代码来源:identifytool.py

示例9: showErrorMessage

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def showErrorMessage(self, message):
        self.iface.messageBar().pushMessage("", message, level=QgsMessageBar.WARNING, duration=3) 
开发者ID:NationalSecurityAgency,项目名称:qgis-shapetools-plugin,代码行数:4,代码来源:vector2Shape.py

示例10: zoomTo

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def zoomTo(self):
        apikey = pluginSetting("apiKey")
        if apikey is None or apikey == "":
            self._showMessage('what3words API key is not set. Please set it and try again.', QgsMessageBar.WARNING)
            return
        self.zoomToDialog.setApiKey(apikey)
        self.zoomToDialog.show() 
开发者ID:boundlessgeo,项目名称:qgis-what3words-plugin,代码行数:9,代码来源:plugin.py

示例11: setTool

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def setTool(self):
        apikey = pluginSetting("apiKey")
        if apikey is None or apikey == "":
            self._showMessage('what3words API key is not set. Please set it and try again.', QgsMessageBar.WARNING)
            return
        if self.mapTool is None:
            self.mapTool = W3WMapTool(self.iface.mapCanvas())
        self.toolAction.setChecked(True)
        self.iface.mapCanvas().setMapTool(self.mapTool) 
开发者ID:boundlessgeo,项目名称:qgis-what3words-plugin,代码行数:11,代码来源:plugin.py

示例12: canvasReleaseEvent

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def canvasReleaseEvent(self, e):
        pt = self.toMapCoordinates(e.pos())
        w3wCoord = self.toW3W(pt)
        if w3wCoord:
            iface.messageBar().pushMessage("what3words", "The 3 word address: '{}' has been copied to the clipboard".format(w3wCoord), level=QgsMessageBar.INFO, duration=6)
            clipboard = QApplication.clipboard()
            clipboard.setText(w3wCoord)
        else:
            iface.messageBar().pushMessage("what3words", "Could not convert the selected point to a 3 word address", level=QgsMessageBar.WARNING, duration=3) 
开发者ID:boundlessgeo,项目名称:qgis-what3words-plugin,代码行数:11,代码来源:maptool.py

示例13: show_message

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def show_message(self, level, message):
        if level == QgsMessageBar.WARNING:
            self.bar.pushMessage(message, QgsMessageBar.INFO, 10)
        elif level == QgsMessageBar.CRITICAL:
            self.bar.pushMessage(message, QgsMessageBar.WARNING, 10) 
开发者ID:opengisch,项目名称:projectgenerator,代码行数:7,代码来源:generate_project.py

示例14: push

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def push(self):
        dlg = RemoteRefDialog(self.repo)
        dlg.exec_()
        if dlg.remote is not None:
            try:
                self.repo.push(dlg.remote, dlg.branch)
                config.iface.messageBar().pushMessage("Changes have been correctly pushed to connection",
                                               level = QgsMessageBar.INFO, duration = 5)
            except CannotPushException, e:
                config.iface.messageBar().pushMessage(str(e),
                                               level = QgsMessageBar.WARNING, duration = 5)
            except NothingToPushException, e:
                config.iface.messageBar().pushMessage("Nothing to push. Already up to date",
                                               level = QgsMessageBar.INFO, duration = 5) 
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:16,代码来源:navigatordialog.py

示例15: uiAsterSWAcalc

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import WARNING [as 别名]
def uiAsterSWAcalc(self):
        self.btBand13       = self.dlg.lineEditSWAbt13.text()
        self.btBand14       = self.dlg.lineEditSWAbt14.text()
        self.lseBand13      = self.dlg.lineEditSWAlse13.text()
        self.lseBand14      = self.dlg.lineEditSWAlse14.text()
        self.atmTransBand13 = float(self.dlg.b13atmTrans.text())
        self.atmTransBand14 = float(self.dlg.b14atmTrans.text())
        self.rasterType     = str(self.dlg.swaRasterType.currentText()) 
        self.outputPath     = self.dlg.lineEditSWAOut.text()
        self.unit           = str(self.dlg.swaUnit.currentText())
        if (self.dlg.swaAddToProj.isChecked()):
            self.addToQGIS = 'Yes'
        else:
            self.addToQGIS = 'No'
            
        if (self.btBand13 == ''):
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                    "Band 13 brightness temperature is required",
                                    QgsMessageBar.WARNING, 3)
        elif (self.btBand14 == ''):
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                    "Band 14 brightness temperature is required",
                                    QgsMessageBar.WARNING, 3)
        elif (self.lseBand13 == ''):
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                    "Band 13 land surface emissivity is required",
                                    QgsMessageBar.WARNING, 3)
        elif (self.lseBand14 == ''):
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                    "Band 14 land surface emissivity is required",
                                    QgsMessageBar.WARNING, 3)
        elif (self.outputPath == ''):
            self.iface.messageBar().pushMessage("Land Surface Temperature Plugin",
                                    "The output save location is required",
                                    QgsMessageBar.WARNING, 3)
        else:
            self.argList = [self.btBand13, self.btBand14, self.lseBand13, self.lseBand14, self.atmTransBand13, \
                            self.atmTransBand14, self.outputPath, self.rasterType, self.unit, self.addToQGIS]
            self.startWorker('SWA', self.argList, 'Calculating land surface temperature')
        self.closePlugin() 
开发者ID:miltonisaya,项目名称:landSurfaceTemperature,代码行数:42,代码来源:lst_tool.py


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