當前位置: 首頁>>代碼示例>>Python>>正文


Python QgsMessageBar.INFO屬性代碼示例

本文整理匯總了Python中qgis.gui.QgsMessageBar.INFO屬性的典型用法代碼示例。如果您正苦於以下問題:Python QgsMessageBar.INFO屬性的具體用法?Python QgsMessageBar.INFO怎麽用?Python QgsMessageBar.INFO使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在qgis.gui.QgsMessageBar的用法示例。


在下文中一共展示了QgsMessageBar.INFO屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: clicked

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [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

示例2: run

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [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

示例3: createRepo

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def createRepo(self):
        name, ok = QInputDialog.getText(self, 'Create repository',
                                              'Enter the repository name:')
        if ok:
            group = self.comboEndpoint.currentText()
            url = repository.repoEndpoints[group]
            try:
                repo = execute(lambda: createRepoAtUrl(url, group, name))
            except GeoGigException as e:
                config.iface.messageBar().pushMessage("Error", str(e),
                               level=QgsMessageBar.CRITICAL,
                               duration=5)
                return
            item = RepoItem(self, self.repoTree, repo)
            addRepo(repo)
            self.repoTree.addTopLevelItem(item)
            config.iface.messageBar().pushMessage("Create repository", "Repository correctly created",
                                           level=QgsMessageBar.INFO,
                                           duration=5) 
開發者ID:boundlessgeo,項目名稱:qgis-geogiglight-plugin,代碼行數:21,代碼來源:navigatordialog.py

示例4: canvasReleaseEvent

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def canvasReleaseEvent(self, event):
        if self.rubberBand is None:
            return

        startPointLayerCoords = self.toLayerCoordinates(self.layer, self.startPointMapCoords)
        stopPointLayerCoords = self.toLayerCoordinates(self.layer, event.pos())
        dx = stopPointLayerCoords.x() - startPointLayerCoords.x()
        dy = stopPointLayerCoords.y() - startPointLayerCoords.y()

        for f in self.movedFeatures:
             geom = QgsGeometry(f.geometry())
             geom.translate(dx, dy)
             self.layer.dataProvider().changeGeometryValues({f.id(): geom})

        if self.rubberBand is not None:
            self.rubberBand.reset()
        del self.rubberBand
        self.rubberBand = None
        self.canvas.refresh()
        self.layer.triggerRepaint()
        self.landmarkMoved.emit(self.tr('Landmark moved.'), QgsMessageBar.INFO) 
開發者ID:matsu-reki,項目名稱:GkukanMusiumdb,代碼行數:23,代碼來源:movelandmarktool.py

示例5: importData

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def importData(self):
        fileName = self._selectFile(mode='import')
        if fileName is None:
            return

        layer = self.toolbox.cmbLayers.currentLayer()
        if layer is None or not layer.isValid():
            self._showMessage(self.tr('Landmark layer is not selected.'))
            return

        writer = DataProcessor(layer.source())
        writer.setDataFile(fileName)
        if writer.importData():
            self._showMessage(self.tr('Import completed.'), QgsMessageBar.INFO)
            return

        self._showMessage(self.tr('Import failed.')) 
開發者ID:matsu-reki,項目名稱:GkukanMusiumdb,代碼行數:19,代碼來源:landmark_plugin.py

示例6: exportData

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def exportData(self):
        fileName = self._selectFile()
        if fileName is None:
            return

        layer = self.toolbox.cmbLayers.currentLayer()
        if layer is None or not layer.isValid():
            self._showMessage(self.tr('Landmark layer is not selected.'))
            return

        writer = DataProcessor(layer.source())
        writer.setLayer(layer)
        writer.setDataFile(fileName)
        if writer.exportData():
            self._showMessage(self.tr('Export completed.'), QgsMessageBar.INFO)
            return

        self._showMessage(self.tr('Export failed.')) 
開發者ID:matsu-reki,項目名稱:GkukanMusiumdb,代碼行數:20,代碼來源:landmark_plugin.py

示例7: _showMessage

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def _showMessage(self, message, level=QgsMessageBar.INFO):
        iface.messageBar().pushMessage(
            message, level, iface.messageTimeout()) 
開發者ID:boundlessgeo,項目名稱:qgis-what3words-plugin,代碼行數:5,代碼來源:plugin.py

示例8: canvasReleaseEvent

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [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

示例9: run

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def run(self):
        self.bar.pushMessage("Hello", "World", level=QgsMessageBar.INFO) 
開發者ID:webgeodatavore,項目名稱:pyqgis-samples,代碼行數:4,代碼來源:qgis-sample-QgsMessageBar.py

示例10: clicked

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def clicked(self, pt, b):
        '''Capture the coordinate when the mouse button has been released,
        format it, and copy it to the clipboard.'''
        canvasCRS = self.canvas.mapSettings().destinationCrs()
        transform = QgsCoordinateTransform(canvasCRS, epsg4326)
        pt4326 = transform.transform(pt.x(), pt.y())
        lat = pt4326.y()
        lon = pt4326.x()
        mapprovider = self.settings.getMapProviderString(lat, lon)
        url = QUrl(mapprovider).toString()
        webbrowser.open(url, new=2)
        self.iface.messageBar().pushMessage("", "Viewing Coordinate %f,%f in external map" % (lat,lon), level=QgsMessageBar.INFO, duration=3) 
開發者ID:NationalSecurityAgency,項目名稱:qgis-latlontools-plugin,代碼行數:14,代碼來源:showOnMapTool.py

示例11: not_data

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def not_data(self):
        """Message for fields without information"""
        self.msgBar.pushMessage('Completar datos de municipio o indicar la ruta de descarga' , level=QgsMessageBar.INFO, duration=3) 
開發者ID:sigdeletras,項目名稱:Spanish_Inspire_Catastral_Downloader,代碼行數:5,代碼來源:Spanish_Inspire_Catastral_Downloader.py

示例12: show_message

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [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

示例13: revertChange

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def revertChange(layer):
    if hasLocalChanges(layer):
        QMessageBox.warning(config.iface.mainWindow(), 'Cannot revert commit',
                "The layer has local changes.\n"
                "Revert local changes before reverting a previous commit.",
                QMessageBox.Ok)
        return
    tracking = getTrackingInfo(layer)
    repo = Repository(tracking.repoUrl)
    filename, layername = namesFromLayer(layer)
    from geogig.gui.dialogs.historyviewer import HistoryViewerDialog
    dlg = HistoryViewerDialog(repo, layername)
    dlg.exec_()
    if dlg.ref is not None:
        #TODO check that selected commit is in history line

        commit = Commit.fromref(repo, dlg.ref)
        # check if we are reverting commit which adds layer to the repo
        if commit.addsLayer():
            QMessageBox.warning(config.iface.mainWindow(), 'Cannot revert commit',
                    "Commits which add layer to the repository can not "
                    "be reverted. Use GeoGig Navigator to remove layer "
                    "from branch.")
            return

        applyLayerChanges(repo, layer, commit.commitid, commit.parent.commitid, False)
        layer.reload()
        layer.triggerRepaint()
        config.iface.messageBar().pushMessage("GeoGig", "Commit changes have been reverted in local layer",
                                                      level=QgsMessageBar.INFO,
                                                      duration=5)
        commitdialog.suggestedMessage = "Reverted changes from commit %s [%s] " % (commit.commitid, commit.message) 
開發者ID:boundlessgeo,項目名稱:qgis-geogiglight-plugin,代碼行數:34,代碼來源:layeractions.py

示例14: changeVersion

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def changeVersion(layer):
    if hasLocalChanges(layer):
        QMessageBox.warning(config.iface.mainWindow(), 'Cannot change commit',
                "The layer has local changes that would be overwritten. "
                "Either sync layer with branch or revert local changes "
                "before changing commit.",
                QMessageBox.Ok)
    else:
        tracking = getTrackingInfo(layer)
        repo = Repository(tracking.repoUrl)
        dlg = HistoryViewerDialog(repo, tracking.layername)
        dlg.exec_()
        if dlg.ref is not None:
            layers = repo.trees(dlg.ref)
            if tracking.layername not in layers:
                QMessageBox.warning(config.iface.mainWindow(), 'Cannot change commit',
                "The selected commit does not contain the specified layer.",
                QMessageBox.Ok)
            else:
                repo.checkoutlayer(tracking.geopkg, tracking.layername, None, dlg.ref)
                config.iface.messageBar().pushMessage("GeoGig", "Layer has been updated to commit %s" % dlg.ref,
                                                       level=QgsMessageBar.INFO,
                                                       duration=5)
                layer.reload()
                layer.triggerRepaint()
                repoWatcher.layerUpdated.emit(layer)
                repoWatcher.repoChanged.emit(repo) 
開發者ID:boundlessgeo,項目名稱:qgis-geogiglight-plugin,代碼行數:29,代碼來源:layeractions.py

示例15: revertLocalChanges

# 需要導入模塊: from qgis.gui import QgsMessageBar [as 別名]
# 或者: from qgis.gui.QgsMessageBar import INFO [as 別名]
def revertLocalChanges(layer):
    if hasLocalChanges(layer):
        tracking = getTrackingInfo(layer)
        repo = Repository(tracking.repoUrl)
        commitid = getCommitId(layer)
        repo.checkoutlayer(tracking.geopkg, tracking.layername, None, commitid)
        config.iface.messageBar().pushMessage("GeoGig", "Local changes have been discarded",
                                                      level=QgsMessageBar.INFO,
                                                      duration=5)
        layer.reload()
        layer.triggerRepaint()
    else:
        config.iface.messageBar().pushMessage("GeoGig", "No local changes were found",
                                                      level=QgsMessageBar.INFO,
                                                      duration=5) 
開發者ID:boundlessgeo,項目名稱:qgis-geogiglight-plugin,代碼行數:17,代碼來源:layeractions.py


注:本文中的qgis.gui.QgsMessageBar.INFO屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。