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


Python QMessageBox.information方法代码示例

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


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

示例1: batchFinished

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def batchFinished(self):
        self.base.stop()

        if len(self.errors) > 0:
            msg = u"Processing of the following files ended with error: <br><br>" + "<br><br>".join(self.errors)
            QErrorMessage(self).showMessage(msg)

        inDir = self.getInputFileName()
        outDir = self.getOutputFileName()
        if outDir is None or inDir == outDir:
            self.outFiles = self.inFiles

        # load layers managing the render flag to avoid waste of time
        canvas = self.iface.mapCanvas()
        previousRenderFlag = canvas.renderFlag()
        canvas.setRenderFlag(False)
        notCreatedList = []
        for item in self.outFiles:
            fileInfo = QFileInfo(item)
            if fileInfo.exists():
                if self.base.loadCheckBox.isChecked():
                    self.addLayerIntoCanvas(fileInfo)
            else:
                notCreatedList.append(item)
        canvas.setRenderFlag(previousRenderFlag)

        if len(notCreatedList) == 0:
            QMessageBox.information(self, self.tr("Finished"), self.tr("Operation completed."))
        else:
            QMessageBox.warning(self, self.tr("Warning"), self.tr("The following files were not created: \n{0}").format(', '.join(notCreatedList)))
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:32,代码来源:widgetBatchBase.py

示例2: currentColumn

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
 def currentColumn(self):
     """ returns row index of selected column """
     sel = self.viewFields.selectionModel()
     indexes = sel.selectedRows()
     if len(indexes) == 0:
         QMessageBox.information(self, self.tr("DB Manager"), self.tr("nothing selected"))
         return -1
     return indexes[0].row()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:10,代码来源:dlg_table_properties.py

示例3: deleteField

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def deleteField(self):
        """ delete selected field """
        row = self.selectedField()
        if row is None:
            QMessageBox.information(self, self.tr("DB Manager"), self.tr("no field selected"))
        else:
            self.fields.model().removeRows(row, 1)

        self.updatePkeyCombo()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:11,代码来源:dlg_create_table.py

示例4: createTable

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def createTable(self):
        """ create table with chosen fields, optionally add a geometry column """
        if not self.hasSchemas:
            schema = None
        else:
            schema = unicode(self.cboSchema.currentText())
            if len(schema) == 0:
                QMessageBox.information(self, self.tr("DB Manager"), self.tr("select schema!"))
                return

        table = unicode(self.editName.text())
        if len(table) == 0:
            QMessageBox.information(self, self.tr("DB Manager"), self.tr("enter table name!"))
            return

        m = self.fields.model()
        if m.rowCount() == 0:
            QMessageBox.information(self, self.tr("DB Manager"), self.tr("add some fields!"))
            return

        useGeomColumn = self.chkGeomColumn.isChecked()
        if useGeomColumn:
            geomColumn = unicode(self.editGeomColumn.text())
            if len(geomColumn) == 0:
                QMessageBox.information(self, self.tr("DB Manager"), self.tr("set geometry column name"))
                return

            geomType = self.GEOM_TYPES[self.cboGeomType.currentIndex()]
            geomDim = self.spinGeomDim.value()
            try:
                geomSrid = int(self.editGeomSrid.text())
            except ValueError:
                geomSrid = 0
            useSpatialIndex = self.chkSpatialIndex.isChecked()

        flds = m.getFields()
        pk_index = self.cboPrimaryKey.currentIndex()
        if pk_index >= 0:
            flds[pk_index].primaryKey = True

        # commit to DB
        QApplication.setOverrideCursor(Qt.WaitCursor)
        try:
            if not useGeomColumn:
                self.db.createTable(table, flds, schema)
            else:
                geom = geomColumn, geomType, geomSrid, geomDim, useSpatialIndex
                self.db.createVectorTable(table, flds, geom, schema)

        except (ConnectionError, DbError) as e:
            DlgDbError.showError(e, self)
            return

        finally:
            QApplication.restoreOverrideCursor()

        QMessageBox.information(self, self.tr("Good"), self.tr("everything went fine"))
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:59,代码来源:dlg_create_table.py

示例5: finish

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def finish(self):
        for count, alg in enumerate(self.algs):
            self.loadHTMLResults(alg, count)

        self.createSummaryTable()
        QApplication.restoreOverrideCursor()

        self.mainWidget.setEnabled(True)
        QMessageBox.information(self, self.tr('Batch processing'),
                                self.tr('Batch processing completed'))
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:12,代码来源:BatchAlgorithmDialog.py

示例6: navigate

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def navigate(self):
        """manage navigation / paging"""

        caller = self.sender().objectName()

        if caller == 'btnFirst':
            self.startfrom = 0
        elif caller == 'btnLast':
            self.startfrom = self.catalog.results['matches'] - self.maxrecords
        elif caller == 'btnNext':
            self.startfrom += self.maxrecords
            if self.startfrom >= self.catalog.results["matches"]:
                msg = self.tr('End of results. Go to start?')
                res = QMessageBox.information(self, self.tr('Navigation'),
                                              msg,
                                              (QMessageBox.Ok |
                                               QMessageBox.Cancel))
                if res == QMessageBox.Ok:
                    self.startfrom = 0
                else:
                    return
        elif caller == "btnPrev":
            self.startfrom -= self.maxrecords
            if self.startfrom <= 0:
                msg = self.tr('Start of results. Go to end?')
                res = QMessageBox.information(self, self.tr('Navigation'),
                                              msg,
                                              (QMessageBox.Ok |
                                               QMessageBox.Cancel))
                if res == QMessageBox.Ok:
                    self.startfrom = (self.catalog.results['matches'] -
                                      self.maxrecords)
                else:
                    return

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        try:
            self.catalog.getrecords2(constraints=self.constraints,
                                     maxrecords=self.maxrecords,
                                     startposition=self.startfrom, esn='full')
        except ExceptionReport as err:
            QApplication.restoreOverrideCursor()
            QMessageBox.warning(self, self.tr('Search error'),
                                self.tr('Search error: %s') % err)
            return
        except Exception as err:
            QApplication.restoreOverrideCursor()
            QMessageBox.warning(self, self.tr('Connection error'),
                                self.tr('Connection error: %s') % err)
            return

        QApplication.restoreOverrideCursor()

        self.display_results()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:57,代码来源:maindialog.py

示例7: exportAsPython

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def exportAsPython(self):
        filename = unicode(QFileDialog.getSaveFileName(self,
                                                       self.tr('Save Model As Python Script'), '',
                                                       self.tr('Python files (*.py *.PY)')))
        if not filename:
            return

        if not filename.lower().endswith('.py'):
            filename += '.py'

        text = self.alg.toPython()
        with codecs.open(filename, 'w', encoding='utf-8') as fout:
            fout.write(text)
        QMessageBox.information(self, self.tr('Model exported'),
                                self.tr('Model was correctly exported.'))
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:17,代码来源:ModelerDialog.py

示例8: finished

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def finished(self):
        outFn = self.getOutputFileName()
        if self.needOverwrite:
            oldFile = QFile(outFn)
            newFile = QFile(self.tempFile)
            if oldFile.remove():
                newFile.rename(outFn)

        fileInfo = QFileInfo(outFn)
        if fileInfo.exists():
            if self.base.loadCheckBox.isChecked():
                self.addLayerIntoCanvas(fileInfo)
            QMessageBox.information(self, self.tr("Finished"), self.tr("Processing completed."))
        else:
            QMessageBox.warning(self, self.tr("Warning"), self.tr("{0} not created.").format(outFn))
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:17,代码来源:doProjection.py

示例9: accept

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
 def accept(self):
     if not self.preloadAPI.isChecked() and \
        not self.groupBoxPreparedAPI.isChecked():
         if self.tableWidget.rowCount() == 0:
             QMessageBox.information(self, self.tr("Warning!"),
                                     self.tr('Please specify API file or check "Use preloaded API files"'))
             return
     if self.groupBoxPreparedAPI.isChecked() and \
        not self.lineEdit.text():
         QMessageBox.information(self, self.tr("Warning!"),
                                 self.tr('The APIs file was not compiled, click on "Compile APIs..."'))
         return
     self.saveSettings()
     self.listPath = []
     QDialog.accept(self)
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:17,代码来源:console_settings.py

示例10: onOK

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def onOK(self):
        # execute and commit the code
        QApplication.setOverrideCursor(Qt.WaitCursor)
        try:
            sql = u"\n".join(self.updateSql())
            self.db.connector._execute_and_commit(sql)

        except BaseError as e:
            DlgDbError.showError(e, self)
            return

        finally:
            QApplication.restoreOverrideCursor()

        QMessageBox.information(self, "good!", "everything went fine!")
        self.accept()
开发者ID:boggins,项目名称:QGIS,代码行数:18,代码来源:dlg_versioning.py

示例11: finished

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def finished(self, load):
        outFn = self.getOutputFileName()
        if outFn is None:
            return

        if outFn == '':
            QMessageBox.warning(self, self.tr("Warning"), self.tr("No output file created."))
            return

        fileInfo = QFileInfo(outFn)
        if fileInfo.exists():
            if load:
                self.addLayerIntoCanvas(fileInfo)
            QMessageBox.information(self, self.tr("Finished"), self.tr("Processing completed."))
        else:
            #QMessageBox.warning(self, self.tr( "Warning" ), self.tr( "%1 not created." ).arg( outFn ) )
            QMessageBox.warning(self, self.tr("Warning"), self.tr("%s not created.") % outFn)
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:19,代码来源:widgetPluginBase.py

示例12: save

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def save(self, connections):
        """save connections ops"""

        doc = etree.Element('qgsCSWConnections')
        doc.attrib['version'] = '1.0'

        for conn in connections:
            url = self.settings.value('/MetaSearch/%s/url' % conn)
            if url is not None:
                connection = etree.SubElement(doc, 'csw')
                connection.attrib['name'] = conn
                connection.attrib['url'] = url

        # write to disk
        with open(self.filename, 'w') as fileobj:
            fileobj.write(prettify_xml(etree.tostring(doc)))
        QMessageBox.information(self, self.tr('Save Connections'),
                                self.tr('Saved to %s') % self.filename)
        self.reject()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:21,代码来源:manageconnectionsdialog.py

示例13: fieldDown

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def fieldDown(self):
        """ move selected field down """
        row = self.selectedField()
        if row is None:
            QMessageBox.information(self, self.tr("DB Manager"), self.tr("No field selected"))
            return
        if row == self.fields.model().rowCount() - 1:
            QMessageBox.information(self, self.tr("DB Manager"), self.tr("field is at bottom already"))
            return

        # take row and reinsert it
        rowdata = self.fields.model().takeRow(row)
        self.fields.model().insertRow(row + 1, rowdata)

        # set selection again
        index = self.fields.model().index(row + 1, 0, QModelIndex())
        self.fields.selectionModel().select(index, QItemSelectionModel.Rows | QItemSelectionModel.ClearAndSelect)

        self.updatePkeyCombo()
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:21,代码来源:dlg_create_table.py

示例14: saveModel

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
    def saveModel(self, saveAs):
        if unicode(self.textGroup.text()).strip() == '' \
                or unicode(self.textName.text()).strip() == '':
            QMessageBox.warning(
                self, self.tr('Warning'), self.tr('Please enter group and model names before saving')
            )
            return
        self.alg.name = unicode(self.textName.text())
        self.alg.group = unicode(self.textGroup.text())
        if self.alg.descriptionFile is not None and not saveAs:
            filename = self.alg.descriptionFile
        else:
            filename = unicode(QFileDialog.getSaveFileName(self,
                                                           self.tr('Save Model'),
                                                           ModelerUtils.modelsFolder(),
                                                           self.tr('Processing models (*.model)')))
            if filename:
                if not filename.endswith('.model'):
                    filename += '.model'
                self.alg.descriptionFile = filename
        if filename:
            text = self.alg.toJson()
            try:
                fout = codecs.open(filename, 'w', encoding='utf-8')
            except:
                if saveAs:
                    QMessageBox.warning(self, self.tr('I/O error'),
                                        self.tr('Unable to save edits. Reason:\n %s') % unicode(sys.exc_info()[1]))
                else:
                    QMessageBox.warning(self, self.tr("Can't save model"),
                                        self.tr("This model can't be saved in its "
                                                "original location (probably you do not "
                                                "have permission to do it). Please, use "
                                                "the 'Save as...' option."))
                return
            fout.write(text)
            fout.close()
            self.update = True
            QMessageBox.information(self, self.tr('Model saved'),
                                    self.tr('Model was correctly saved.'))

            self.hasChanged = False
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:44,代码来源:ModelerDialog.py

示例15: get_connections_from_file

# 需要导入模块: from PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from PyQt.QtWidgets.QMessageBox import information [as 别名]
def get_connections_from_file(parent, filename):
    """load connections from connection file"""

    error = 0
    try:
        doc = etree.parse(filename).getroot()
        if doc.tag != 'qgsCSWConnections':
            error = 1
            msg = parent.tr('Invalid CSW connections XML.')
    except etree.ParseError as err:
        error = 1
        msg = parent.tr('Cannot parse XML file: %s' % err)
    except IOError as err:
        error = 1
        msg = parent.tr('Cannot open file: %s' % err)

    if error == 1:
        QMessageBox.information(parent, parent.tr('Loading Connections'), msg)
        return
    return doc
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:22,代码来源:util.py


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