當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。