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


Python QMessageBox.question方法代碼示例

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


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

示例1: mousePressEvent

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def mousePressEvent(self, event):
        self.oldx = event.x()
        self.oldy = event.y()

        highlighted = self.highlight(event.x(), event.y())
        if highlighted:
            if self.tool == "delete":
                if QMessageBox.Ok == QMessageBox.question(self, "Delete one edge", "Do you want to delete selectd edge ?", QMessageBox.Ok|QMessageBox.Cancel):
                    self.scene.delete_highlighted("edge")
                    self.scene.update("edge")
                    self.update()
            if self.tool == "add":
                if self.previous_pick:
                    self.scene.add_edge(self.previous_pick, highlighted)
                    self.previous_pick = None
                    self.scene.update("edge")
                    self.update()
                else:
                    self.previous_pick = highlighted
        else:
            self.previous_pick = None 
開發者ID:Oslandia,項目名稱:albion,代碼行數:23,代碼來源:viewer_3d.py

示例2: batchUpgradePostgis

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def batchUpgradePostgis(self, dbList):
        exceptionDict = dict()
        successList = []
        if QMessageBox.question(self, self.tr('Question'), self.tr('This operation will upgrade PostGIS version for templates databases as well as the selected databases. Would you like to continue?'), QMessageBox.Ok|QMessageBox.Cancel) == QMessageBox.Cancel:
            return successList, exceptionDict
        dbsDict = self.instantiateAbstractDbs(instantiateTemplates = True)
        self.closeAbstractDbs(dbsDict)
        for dbName in dbsDict:
            try:
                if self.serverWidget.abstractDb.checkIfTemplate(dbName):
                    self.serverWidget.abstractDb.setDbAsTemplate(dbName = dbName, setTemplate = False)
                    dbsDict[dbName].upgradePostgis()
                    self.serverWidget.abstractDb.setDbAsTemplate(dbName = dbName, setTemplate = True)
                    successList.append(dbName)
                else:
                    dbsDict[dbName].upgradePostgis()
                    successList.append(dbName)
            except Exception as e:
                exceptionDict[dbName] =  ':'.join(e.args)
        return successList, exceptionDict 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:22,代碼來源:batchDbManager.py

示例3: on_dropDatabasePushButton_clicked

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [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

示例4: on_removeUserButton_clicked

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def on_removeUserButton_clicked(self):
        selectedUsers = self.serverUserTable.selectedItems()
        if not self.abstractDb:
            QMessageBox.critical(self, self.tr('Critical!'), self.tr('First select a database!'))
            return
        if len(selectedUsers) == 0:
            QMessageBox.critical(self, self.tr('Critical!'), self.tr('First select a user to remove!'))
            return
        selectedUserNames = [i.text(0) for i in selectedUsers]
        if QMessageBox.question(self, self.tr('Question'), self.tr('Do you really want to remove users: ')+', '.join(selectedUserNames), QMessageBox.Ok|QMessageBox.Cancel) == QMessageBox.Cancel:
            return
        exceptionDict = dict()
        successList = []
        for user in selectedUserNames:
            try:
                self.abstractDb.reassignAndDropUser(user)
                successList.append(user)
            except Exception as e:
                exceptionDict[user] =  ':'.join(e.args)
        header = self.tr('Drop user(s) operation complete!\n')
        self.outputMessage(header, successList, exceptionDict)
        self.populateUsers() 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:24,代碼來源:manageServerUsers.py

示例5: execute

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def execute(self):
        """
        Called whenever the action is triggered
        """
        reply = QMessageBox.question(None,
                                     self.tr("Delete Script"),
                                     self.tr("Are you sure you want to delete this script?"),
                                     QMessageBox.Yes | QMessageBox.No,
                                     QMessageBox.No)
        if reply == QMessageBox.Yes:
            file_path = self.itemData.description_file
            if file_path is not None:
                os.remove(file_path)
                QgsApplication.processingRegistry().providerById("r").refreshAlgorithms()
            else:
                QMessageBox.warning(None,
                                    self.tr("Delete Script"),
                                    self.tr("Can not find corresponding script file.")) 
開發者ID:north-road,項目名稱:qgis-processing-r,代碼行數:20,代碼來源:delete_script.py

示例6: clearAll

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def clearAll(self):
        reply = QMessageBox.question(
            self, 'Message',
            'Are your sure you want to delete all locations?',
            QMessageBox.Yes, QMessageBox.No)

        if reply == QMessageBox.Yes:
            self.resultsTable.blockSignals(True)
            self.removeMarkers()
            self.resultsTable.setRowCount(0)
            self.resultsTable.blockSignals(False) 
開發者ID:NationalSecurityAgency,項目名稱:qgis-latlontools-plugin,代碼行數:13,代碼來源:multizoom.py

示例7: removeTableRows

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def removeTableRows(self):
        '''Remove selected entries from the coordinate table.'''
        indices = [x.row() for x in self.resultsTable.selectionModel().selectedRows()]
        if len(indices) == 0:
            return
        # We need to remove the rows from the bottom to the top so that the indices
        # don't change.
        reply = QMessageBox.question(
            self, 'Message',
            'Are your sure you want to delete the selected locations?',
            QMessageBox.Yes, QMessageBox.No)

        if reply == QMessageBox.Yes:
            # Blocking the signals is necessary to prevent the signals replacing
            # the marker before it is completely removed.
            self.resultsTable.blockSignals(True)
            for row in sorted(indices, reverse=True):
                # Remove the marker from the map
                item = self.resultsTable.item(row, 0).data(Qt.UserRole)
                if item.marker is not None:
                    self.canvas.scene().removeItem(item.marker)
                    item.marker = None
                # Then remove the location from the table
                self.resultsTable.removeRow(row)

            self.resultsTable.blockSignals(False)
            self.resultsTable.clearSelection() 
開發者ID:NationalSecurityAgency,項目名稱:qgis-latlontools-plugin,代碼行數:29,代碼來源:multizoom.py

示例8: on_dropDatabasePushButton_clicked

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def on_dropDatabasePushButton_clicked(self):
        selectedDbNameList = self.getSelectedDbList()
        if len(selectedDbNameList) == 0:
            QMessageBox.warning(self, self.tr('Warning'), self.tr('Please select one or more databases to drop!'))
            return
        if QMessageBox.question(self, self.tr('Question'), self.tr('Do you really want to drop databases: ')+', '.join(selectedDbNameList), QMessageBox.Ok|QMessageBox.Cancel) == QMessageBox.Cancel:
            return
        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        successList, exceptionDict = self.batchDropDbs(selectedDbNameList)
        QApplication.restoreOverrideCursor()
        self.setDatabases()
        header = self.tr('Drop operation complete. \n')
        self.outputMessage(header, successList, exceptionDict)
        self.dbsCustomSelector.setInitialState(self.dbsCustomSelector.fromLs) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:16,代碼來源:batchDbManager.py

示例9: on_deleteCustomizationPushButton_clicked

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def on_deleteCustomizationPushButton_clicked(self):
        #TODO: Reimplement
        customizationName = self.customizationListWidget.currentItem().text()
        edgvVersion = self.versionSelectionComboBox.currentText()
        if QMessageBox.question(self, self.tr('Question'), self.tr('Do you really want to delete customization ')+customizationName+'?', QMessageBox.Ok|QMessageBox.Cancel) == QMessageBox.Cancel:
            return
        try:
            QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
            self.genericDbManager.deleteCustomization(customizationName, edgvVersion)
            QApplication.restoreOverrideCursor()
            QMessageBox.warning(self, self.tr('Success!'), self.tr('Customization ') + customizationName + self.tr(' successfully deleted.'))
            self.refreshProfileList()
        except Exception as e:
            QApplication.restoreOverrideCursor()
            QMessageBox.warning(self, self.tr('Warning!'), self.tr('Error! Problem deleting customization: ') + ':'.join(e.args)) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:17,代碼來源:customizationManagerWidget.py

示例10: deleteSelectedSetting

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def deleteSelectedSetting(self):
        edgvVersion = self.genericDbManager.edgvVersion
        uiParameterDict = self.getParametersFromInterface()
        settingTextList = ', '.join(uiParameterDict['parameterList'])
        if QMessageBox.question(self, self.tr('Question'), self.tr('Do you really want to delete ')+settingTextList+'?', QMessageBox.Ok|QMessageBox.Cancel) == QMessageBox.Cancel:
            return
        successDict, exceptionDict = self.manageSettings(GenericManagerWidget.Delete, selectedConfig = uiParameterDict['parameterList'])
        header, operation = self.getDeleteHeader()
        self.outputMessage(operation, header, successDict, exceptionDict) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:11,代碼來源:genericManagerWidget.py

示例11: setupFromFile

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def setupFromFile(self):
        """
        Opens a earth coverage file
        """
        if QMessageBox.question(self, self.tr('Question'), self.tr('Do you want to open an earth coverage file?'), QMessageBox.Ok|QMessageBox.Cancel) == QMessageBox.Cancel:
            return
        filename, __ = QFileDialog.getOpenFileName(self, self.tr('Open Earth Coverage Setup configuration'), '', self.tr('Earth Coverage Files (*.json)'))
        return filename 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:10,代碼來源:setupEarthCoverage.py

示例12: on_deletePermissionPushButton_clicked

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def on_deletePermissionPushButton_clicked(self):
        if self.profilesListWidget.currentItem() is not None:
            profileName, edgvVersion = self.profilesListWidget.currentItem().text().split(' (')
            edgvVersion = edgvVersion.replace(')','')
            if QMessageBox.question(self, self.tr('Question'), self.tr('Do you really want to delete profile ')+profileName+'?', QMessageBox.Ok|QMessageBox.Cancel) == QMessageBox.Cancel:
                return
            try:
                QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
                self.permissionManager.deleteSetting(profileName, edgvVersion)
                QApplication.restoreOverrideCursor()
                QMessageBox.warning(self, self.tr('Success!'), self.tr('Permission ') + profileName + self.tr(' successfully deleted.'))
                self.refreshProfileList()
            except Exception as e:
                QApplication.restoreOverrideCursor()
                QMessageBox.warning(self, self.tr('Warning!'), self.tr('Error! Problem deleting permission: ') + ':'.join(e.args)) 
開發者ID:dsgoficial,項目名稱:DsgTools,代碼行數:17,代碼來源:serverProfilesManager.py

示例13: set_tms_scales

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def set_tms_scales(self):
        res = QMessageBox.question(
            self.iface.mainWindow(),
            self.tr('QuickMapServices'),
            self.tr('Set SlippyMap scales for current project? \nThe previous settings will be overwritten!'),
            QMessageBox.Yes | QMessageBox.No)
        if res == QMessageBox.Yes:
            # set scales
            QgsProject.instance().writeEntry('Scales', '/ScalesList', self.scales_list)
            # activate
            QgsProject.instance().writeEntry('Scales', '/useProjectScales', True)
            # update in main window
            # ???? no way to update: http://hub.qgis.org/issues/11917 
開發者ID:nextgis,項目名稱:quickmapservices,代碼行數:15,代碼來源:quick_map_services.py

示例14: on_delete

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def on_delete(self):
        res = QMessageBox.question(None,
                                   self.tr('Delete group'),
                                   self.tr('Delete selected group?'),
                                   QMessageBox.Yes, QMessageBox.No)
        if res == QMessageBox.Yes:
            group_info = self.lstGroups.currentItem().data(Qt.UserRole)
            dir_path = os.path.abspath(os.path.join(group_info.file_path, os.path.pardir))
            shutil.rmtree(dir_path, True)
            self.feel_list()
            self.ds_model.resetModel() 
開發者ID:nextgis,項目名稱:quickmapservices,代碼行數:13,代碼來源:user_groups_box.py

示例15: on_delete

# 需要導入模塊: from qgis.PyQt.QtWidgets import QMessageBox [as 別名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import question [as 別名]
def on_delete(self):
        res = QMessageBox.question(None,
                                   self.tr('Delete service'),
                                   self.tr('Delete selected service?'),
                                   QMessageBox.Yes, QMessageBox.No)
        if res == QMessageBox.Yes:
            ds_info = self.lstServices.currentItem().data(Qt.UserRole)
            dir_path = os.path.abspath(os.path.join(ds_info.file_path, os.path.pardir))
            shutil.rmtree(dir_path, True)
            self.feel_list()
            self.ds_model.resetModel() 
開發者ID:nextgis,項目名稱:quickmapservices,代碼行數:13,代碼來源:user_services_box.py


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