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


Python QgsMessageBar.CRITICAL属性代码示例

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


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

示例1: process_ili_file

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import CRITICAL [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

示例2: run

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import CRITICAL [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 CRITICAL [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: _addGeoGigServer

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import CRITICAL [as 别名]
def _addGeoGigServer(self, title, url):
        try:
            repos = addRepoEndpoint(url, title)
            if not repos:
                msg = "No repositories found at the specified server"
                QMessageBox.warning(self, 'Add repositories',
                                "No repositories found at the specified server",
                                QMessageBox.Ok)


        except Exception as e:
            msg = "No geogig server found at the specified url. %s"
            QgsMessageLog.logMessage(msg % e, level=QgsMessageLog.CRITICAL)
            QMessageBox.warning(self, 'Add repositories',
                                msg % "See the logs for details.",
                                QMessageBox.Ok)

        self.comboEndpoint.addItem(title)
        self.comboEndpoint.setCurrentIndex(self.comboEndpoint.count() - 1) 
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:21,代码来源:navigatordialog.py

示例5: show_message

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import CRITICAL [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

示例6: workerFinished

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import CRITICAL [as 别名]
def workerFinished(self, ret):
        #Clean up the worker and thread
        self.worker.deleteLater()
        self.thread.quit()
        self.thread.wait()
        self.thread.deleteLater()

        #Remove widget from messagebar
        self.iface.messageBar().popWidget(self.messageBar)
        if ret is not None:
            #Add the project to the map
            iface.addRasterLayer(ret, self.processName)
        else:
            #Notify the user that an error has occurred
            self.iface.messageBar().pushMessage('Something went wrong! See the message log for more information.', level=QgsMessageBar.CRITICAL, duration = 5) 
开发者ID:miltonisaya,项目名称:landSurfaceTemperature,代码行数:17,代码来源:lst_tool.py

示例7: workerError

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import CRITICAL [as 别名]
def workerError(self, e, exception_string):
        QgsMessageLog.logMessage('Worker thread raised an exception: \n'.format(exception_string), level = QgsMessageLog.CRITICAL) 
开发者ID:miltonisaya,项目名称:landSurfaceTemperature,代码行数:4,代码来源:lst_tool.py

示例8: ExecutarCmdo

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import CRITICAL [as 别名]
def ExecutarCmdo(database, host, local):
    comando = 'pg_dump -Fp -C -h ' +host+ ' -U '+Usuario+' ' +database+ ' > ' +local+ '/'+database+'.sql'
    progress.setInfo('<b>Iniciando processo de backup...</b><br/>')
    result = os.system(comando)
    if result==0:
        progress.setInfo('<b>Operacao concluida com sucesso!</b><br/><br/>')
        progress.setInfo('<b>Leandro Fran&ccedil;a - Eng Cart</b><br/>')
        time.sleep(4)
        iface.messageBar().pushMessage(u'Situacao', "Operacao Concluida com Sucesso!", level=QgsMessageBar.INFO, duration=5) 
    else:
        progress.setInfo('<b>Problema(s) durante a execucao do backup.</b><br/>')
        progress.setInfo('<b>Verifique se os parametros foram definidos corretamente.</b><br/>')
        time.sleep(8)
        iface.messageBar().pushMessage(u'Erro', "Problema(s) durante a execucao do backup.", level=QgsMessageBar.CRITICAL, duration=5) 
开发者ID:LEOXINGU,项目名称:scripts,代码行数:16,代码来源:BACKUP.py

示例9: reload_repositories

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import CRITICAL [as 别名]
def reload_repositories(self):
        """Slot for when user clicks reload repositories button."""
        # Show progress dialog
        self.show_progress_dialog('Reloading all repositories')

        for repo_name in self.repository_manager.directories:
            directory = self.repository_manager.directories[repo_name]
            url = directory['url']
            auth_cfg = directory['auth_cfg']
            try:
                status, description = self.repository_manager.reload_directory(
                    repo_name, url, auth_cfg)
                if status:
                    self.message_bar.pushMessage(
                        self.tr(
                            'Repository %s is successfully reloaded') %
                        repo_name, QgsMessageBar.INFO, 5)
                else:
                    self.message_bar.pushMessage(
                        self.tr(
                            'Unable to reload %s: %s') % (
                            repo_name, description),
                        QgsMessageBar.CRITICAL, 5)
            except Exception, e:
                self.message_bar.pushMessage(
                    self.tr('%s') % e,
                    QgsMessageBar.CRITICAL, 5)

        self.progress_dialog.hide()
        # Reload data and widget
        self.reload_data_and_widget() 
开发者ID:akbargumbira,项目名称:qgis_resources_sharing,代码行数:33,代码来源:resource_sharing_dialog.py

示例10: importClicked

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import CRITICAL [as 别名]
def importClicked(self):

        ret = QMessageBox.warning(config.iface.mainWindow(), 'Import warning',
                "Importing a layer will modify the original layer and might cause data loss.\n"
                "Make sure you have a backup copy of your layer before importing.\n"
                "Do you want to import the selected layer?",
                QMessageBox.Yes | QMessageBox.No)
        if ret == QMessageBox.No:
            return


        if self.repo is None:
            self.repo = repository.repos[self.repoCombo.currentIndex()]
        if self.layer is None:
            text = self.layerCombo.currentText()
            self.layer = layerFromName(text)

        user, email = config.getUserInfo()
        if user is None:
            self.close()
            return
        message = self.messageBox.toPlainText() or datetime.now().strftime("%Y-%m-%d %H_%M_%S")
        branch = self.branchCombo.currentText()
        try:
            self.repo.importgeopkg(self.layer, branch, message, user, email, False)
            filename, layername = namesFromLayer(self.layer)
            self.repo.checkoutlayer(filename, layername, ref = branch)
            self.layer.reload()
            self.layer.triggerRepaint()
        except GeoGigException as e:
            iface.messageBar().pushMessage("Error", str(e),
                                           level=QgsMessageBar.CRITICAL,
                                           duration=5)
            self.close()
            return

        addTrackedLayer(self.layer, self.repo.url)

        self.ok = True
        iface.messageBar().pushMessage("Layer was correctly added to repository",
                                       level=QgsMessageBar.INFO,
                                       duration=5)
        self.close() 
开发者ID:boundlessgeo,项目名称:qgis-geogiglight-plugin,代码行数:45,代码来源:importdialog.py

示例11: add_repository

# 需要导入模块: from qgis.gui import QgsMessageBar [as 别名]
# 或者: from qgis.gui.QgsMessageBar import CRITICAL [as 别名]
def add_repository(self):
        """Open add repository dialog."""
        dlg = ManageRepositoryDialog(self)
        if not dlg.exec_():
            return

        for repo in self.repository_manager.directories.values():
            if dlg.line_edit_url.text().strip() == repo['url']:
                self.message_bar.pushMessage(
                    self.tr(
                        'Unable to add another repository with the same URL!'),
                    QgsMessageBar.CRITICAL, 5)
                return

        repo_name = dlg.line_edit_name.text()
        repo_url = dlg.line_edit_url.text().strip()
        repo_auth_cfg = dlg.line_edit_auth_id.text().strip()
        if repo_name in self.repository_manager.directories:
            repo_name += '(2)'

        # Show progress dialog
        self.show_progress_dialog("Fetching repository's metadata")

        # Add repository
        try:
            status, description = self.repository_manager.add_directory(
                repo_name, repo_url, repo_auth_cfg)
            if status:
                self.message_bar.pushMessage(
                    self.tr(
                        'Repository is successfully added'),
                    QgsMessageBar.SUCCESS, 5)
            else:
                self.message_bar.pushMessage(
                    self.tr(
                        'Unable to add repository: %s') % description,
                    QgsMessageBar.CRITICAL, 5)
        except Exception, e:
            self.message_bar.pushMessage(
                self.tr('%s') % e,
                QgsMessageBar.CRITICAL, 5)
        finally:
            self.progress_dialog.hide()

        # Reload data and widget
        self.reload_data_and_widget()

        # Deactivate edit and delete button
        self.button_edit.setEnabled(False)
        self.button_delete.setEnabled(False) 
开发者ID:akbargumbira,项目名称:qgis_resources_sharing,代码行数:52,代码来源:resource_sharing_dialog.py


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