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


Python QMessageBox.warning方法代码示例

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


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

示例1: on_createConnectionPushButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_createConnectionPushButton_clicked(self):
        '''
        Creates a connection with the selected databases
        '''
        items = self.serverListWidget.selectedItems()
        existentConnections = []
        newConnections = []
        for item in items:
            dbname = item.data(Qt.UserRole)
            ret = self.storeConnection(self.serverWidget.serversCombo.currentText(), dbname)
            if not ret:
                existentConnections.append(dbname)
            else:
                newConnections.append(dbname)
        
        msg = self.tr('Information:\n')
        if len(existentConnections) > 0:
            msg += self.tr('The following databases connections already exist:\n')  
            for conn in existentConnections:
                msg += conn + ', '
        if len(newConnections) > 0:
            msg += self.tr('\nThe following databases connections were created successfully:\n')  
            for conn in newConnections:
                msg += conn+', '
        QMessageBox.warning(self, self.tr("Warning!"), msg) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:27,代码来源:serverDBExplorer.py

示例2: on_closeButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_closeButton_clicked(self):
        '''
        Closes the dialog if default connection is set
        '''
        currentConnections = self.getServers()
        self.tableWidget.setRowCount(len(currentConnections))
        for i, connection in enumerate(currentConnections):
            if self.tableWidget.cellWidget(i, 5).isChecked():
                (host, port, user, password, isDefault) = self.getServerConfiguration(connection)
                dlg = ServerConfigurator(self)
                dlg.setServerConfiguration(connection)
                dlg.storeServerConfiguration(connection, host, port, user, password, isDefault = True)
                self.defaultConnectionDict = self.setDefaultConnectionParameters(connection, host, port, user, password)
                self.defaultChanged.emit()
                self.done(0)
                return
        QMessageBox.warning(self, self.tr('Info!'), self.tr('Set default connection before closing!')) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:19,代码来源:viewServers.py

示例3: on_testButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_testButton_clicked(self):
        '''
        Tests server connection
        '''
        selectedItem = self.returnSelectedName()
        if not selectedItem:
            return
        name = selectedItem.text()
        try:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            test = self.testServer(name)
            if test:
                QMessageBox.warning(self, self.tr('Info!'), self.tr('Connection online.'))
            else:
                QMessageBox.warning(self, self.tr('Info!'), self.tr('Connection was not successful. Check log for details.'))
            QApplication.restoreOverrideCursor()
        except:
            QApplication.restoreOverrideCursor()
            QMessageBox.warning(self, self.tr('Info!'), self.tr('Connection was not successful. Check log for details.')) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:21,代码来源:viewServers.py

示例4: on_dropDatabasePushButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_dropDatabasePushButton_clicked(self):
        '''
        Drops a database and updates QSettings
        '''
        currentItem = self.dbListWidget.currentItem()
        if not currentItem:
            return
        if QMessageBox.question(self, self.tr('Question'), self.tr('Do you really want to drop database: ')+currentItem.text().split(' ')[0], QMessageBox.Ok|QMessageBox.Cancel) == QMessageBox.Cancel:
            return
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        localDbName = self.localDb.getDatabaseName()
        self.renewDb()
        try:
            self.serverWidget.abstractDb.dropDatabase(localDbName)
            QApplication.restoreOverrideCursor()
            QMessageBox.warning(self, self.tr('Success!'), self.tr('Database ')+localDbName+self.tr(' dropped successfully!'))
            self.clearQSettings(localDbName)
        except Exception as e:
            QApplication.restoreOverrideCursor()            
            QMessageBox.critical(self, self.tr('Critical!'), ':'.join(e.args))
        self.clearAll()
        self.populateListWithDatabasesFromServer() 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:24,代码来源:exploreDb.py

示例5: on_saveButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_saveButton_clicked(self):
        '''
        Saves a new server
        '''
        if self.checkFields():
            name = self.servEdit.text()
            host = self.hostEdit.text()
            port = self.portEdit.text()
            user = self.userEdit.text()
            password = self.passwordEdit.text()
            if not self.storeServerConfiguration(name, host, port, user, password):
                return
            QMessageBox.warning(self, self.tr("Info!"), self.tr("Server stored."))
            self.done(1)
        else:
            QMessageBox.warning(self, self.tr("Warning!"), self.tr("Fill all parameters.")) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:18,代码来源:serverConfigurator.py

示例6: on_createPushButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_createPushButton_clicked(self):
        '''
        Slot that opens the create profile dialog
        '''
        paramDlg = GenericParameterSetter()
        if not paramDlg.exec_():
            return
        templateDb, propertyName, edgvVersion = paramDlg.getParameters()
        if edgvVersion == self.tr('Select EDGV Version'):
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Enter a EDGV Version'))
            return
        if propertyName == '':
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Enter an Earth Coverage Name!'))
            return
        if propertyName in list(self.genericDbManager.getPropertyPerspectiveDict(viewType = DsgEnums.Property).keys()):
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Earth Coverage Name already exists!'))
            return
        dlg = CreateDatabaseCustomization(propertyName, templateDb, edgvVersion, self.genericDbManager)
        dlg.exec_() 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:21,代码来源:customizationManagerWidget.py

示例7: on_createPropertyPushButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_createPropertyPushButton_clicked(self):
        """
        1. Open custom manager according to property type;
        2. Use manager to apply to database
        """
        dlg = GenericParameterSetter(hideDbUi = True)
        if not dlg.exec_():
            return
        propertyName = dlg.getParameters()
        if propertyName == '':
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Enter a {0} name!').format(self.widgetName))
            return
        if propertyName in list(self.genericDbManager.getPropertyPerspectiveDict(viewType = DsgEnums.Property).keys()):
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! {0} name already exists!').format(self.widgetName))
            return
        setupDict = self.populateConfigInterface(self.abstractDb)
        if setupDict:
            self.genericDbManager.createAndInstall(propertyName, setupDict, self.genericDbManager.edgvVersion, dbList = [self.abstractDb.db.databaseName()])
            self.refresh()
            QMessageBox.information(self, self.tr('Success!'), self.tr('{0} configuration {1} created successfuly!').format(self.widgetName, propertyName)) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:22,代码来源:genericCompactPropertyManagerWidget.py

示例8: on_importPropertyPushButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_importPropertyPushButton_clicked(self):
        """
        Imports a property file into dsgtools_admindb
        """
        fd = QFileDialog()
        widgetType = self.getWhoAmI()
        filename = fd.getOpenFileName(caption=self.captionDict[widgetType],filter=self.filterDict[widgetType])
        if filename == '':
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Select a file to import!'))
            return
        try:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            self.genericDbManager.importSetting(filename)
            settingName = os.path.basename(fullFilePath).split('.')[0]
            self.genericDbManager.installSetting(settingName, dbList = [self.abstractDb.db.databaseName()])
            QApplication.restoreOverrideCursor()
            QMessageBox.information(self, self.tr('Sucess!'), self.tr('Success! {0} successfully imported and installed in {1}.').format(widgetType, settingName))
        except Exception as e:
            QApplication.restoreOverrideCursor()
            QMessageBox.critical(self, self.tr('Error!'), self.tr('Error! Problem importing {0}: {1}').format(widgetType, ':'.join(e.args)) )
        self.refresh() 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:23,代码来源:genericCompactPropertyManagerWidget.py

示例9: on_exportPropertyPushButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_exportPropertyPushButton_clicked(self):
        """
        Export selected properties.
        """
        exportPropertyList = [self.propertyComboBox.currentText()]
        if exportPropertyList == []:
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Select a profile to export!'))
            return
        fd = QFileDialog()
        folder = fd.getExistingDirectory(caption = self.tr('Select a folder to output'))
        folder = folder[0] if isinstance(folder, tuple) else folder
        if folder == '':
            # QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Select a output!'))
            return
        edgvVersion = self.genericDbManager.edgvVersion
        try:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            for exportProperty in exportPropertyList:
                self.genericDbManager.exportSetting(exportProperty, edgvVersion, folder)
            QApplication.restoreOverrideCursor()
            QMessageBox.information(self, self.tr('Success!'), self.tr('Success! {0} successfully exported.').format(self.widgetName))
        except Exception as e:
            QApplication.restoreOverrideCursor()
            QMessageBox.critical(self, self.tr('Error!'), self.tr('Error! Problem exporting {0}: {1}').format(self.widgetName, ':'.join(e.args)) ) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:26,代码来源:genericCompactPropertyManagerWidget.py

示例10: on_createPushButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_createPushButton_clicked(self):
        '''
        Slot that opens the create profile dialog
        '''
        dlg = GenericParameterSetter()
        if not dlg.exec_():
            return
        templateDb, propertyName, edgvVersion = dlg.getParameters()
        if not templateDb:
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Select a template database!'))
            return
        if edgvVersion == self.tr('Select EDGV Version'):
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Enter a EDGV Version'))
            return
        if propertyName == '':
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Enter a Field Toolbox Configuration Name!'))
            return
        if propertyName in list(self.genericDbManager.getPropertyPerspectiveDict(viewType = DsgEnums.Property).keys()):
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Field Toolbox Configuration Name already exists!'))
            return
        fieldSetupDict = self.populateConfigInterface(templateDb)
        if fieldSetupDict:
            self.genericDbManager.createSetting(propertyName, edgvVersion, fieldSetupDict)
            self.refresh()
            QMessageBox.information(self, self.tr('Success!'), self.tr('Field Toolbox Configuration ') + propertyName + self.tr(' created successfuly!')) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:27,代码来源:fieldToolBoxConfigManagerWidget.py

示例11: on_exportPushButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_exportPushButton_clicked(self):
        if not self.permissionTreeWidget.currentItem() or (self.permissionTreeWidget.currentItem().text(0) != '' or self.permissionTreeWidget.currentItem().text(2) != ''):
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Error! Select a profile to export!'))
            return

        fd = QFileDialog()
        folder = fd.getExistingDirectory(caption = self.tr('Select a folder to output'))
        if folder == '':
            # QMessageBox.warning(self, self.tr('Warning!'), self.tr('Error! Select a output!'))
            return
        profileName = self.permissionTreeWidget.currentItem().text(1)
        dbName = self.permissionTreeWidget.currentItem().parent().text(0)
        edgvVersion = self.dbDict[dbName].getDatabaseVersion()
        try:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            self.permissionManager.exportSetting(profileName, edgvVersion, folder)
            QApplication.restoreOverrideCursor()
            QMessageBox.warning(self, self.tr('Success!'), self.tr('Permission successfully exported.'))
        except Exception as e:
            QApplication.restoreOverrideCursor()
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Error! Problem exporting permission: ') + ':'.join(e.args)) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:23,代码来源:permissionWidget.py

示例12: on_importPushButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_importPushButton_clicked(self):
        """
        Imports a property file into dsgtools_admindb
        """
        fd = QFileDialog()
        widgetType = self.getWhoAmI()
        filename = fd.getOpenFileName(caption=self.captionDict[widgetType],filter=self.filterDict[widgetType])[0]
        filename = filename[0] if isinstance(filename, tuple) else filename
        if filename == '':
            # QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Select a file to import!'))
            return
        try:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            self.genericDbManager.importSetting(filename)
            QApplication.restoreOverrideCursor()
            QMessageBox.information(self, self.tr('Success!'), self.widgetName + self.tr(' successfully imported.'))
        except Exception as e:
            QApplication.restoreOverrideCursor()
            QMessageBox.critical(self, self.tr('Error!'), self.tr('Error! Problem importing ') +self.widgetName + ': '  + ':'.join(e.args))
        self.refresh() 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:22,代码来源:genericManagerWidget.py

示例13: on_batchImportPushButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def on_batchImportPushButton_clicked(self):
        """
        Imports all config files from a folder into dsgtools_admindb. It only works for a single type of config per time.
        """
        fd = QFileDialog()
        folder = fd.getExistingDirectory(caption = self.tr('Select a folder with json files: '))
        if folder == '':
            # QMessageBox.warning(self, self.tr('Warning!'), self.tr('Warning! Select a input folder!'))
            return
        try:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            self.genericDbManager.batchImportSettings(folder)
            QApplication.restoreOverrideCursor()
            QMessageBox.information(self, self.tr('Success!'), self.widgetName + self.tr(' successfully imported.'))
        except Exception as e:
            QApplication.restoreOverrideCursor()
            QMessageBox.critical(self, self.tr('Error!'), self.tr('Error! Problem importing ') + self.widgetName + ': ' + ':'.join(e.args)) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:19,代码来源:genericManagerWidget.py

示例14: outputMessage

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def outputMessage(self, operation, header, successDict, exceptionDict):
        """
        successDict = {configName: [--list of successful databases--]}
        exceptionDict = {configName: {dbName: errorText}}
        """
        viewType = self.getViewType()
        msg = header
        for setting in list(successDict.keys()):
            successList = successDict[setting]
            if len(successDict[setting]) > 0:
                msg += self.tr('\nSuccessful ')
                msg += operation + ' : '
                msg += setting
                if successList:
                    if len(successList) > 0:
                        try:
                            msg += self.tr(' on databases ') + ', '.join(successList)
                        except: #none type case, just add .
                            msg += '.'
        msg += self.logInternalError(exceptionDict)
        QMessageBox.warning(self, self.tr('Operation Complete!'), msg) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:23,代码来源:genericManagerWidget.py

示例15: validateCurrentPage

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import warning [as 别名]
def validateCurrentPage(self):
        if self.currentId() == 0:
            if self.importRadioButton.checkState() == Qt.Unchecked() and self.createNewRadioButton.checkState() == Qt.Unchecked() and self.installRadioButton.checkState() == Qt.Unchecked():
                errorMsg = self.tr('An option must be chosen!\n')
                QMessageBox.warning(self, self.tr('Error!'), errorMsg)
                return False
            if self.installRadioButton.checkState() == Qt.Checked():
                if self.settingComboBox.currentIndex() == 0:
                    errorMsg = self.tr('A setting must be chosen!\n')
                    QMessageBox.warning(self, self.tr('Error!'), errorMsg)
                    return False
                else:
                    return True
            return True
        else:
            return True 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:18,代码来源:selectTaskWizard.py


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