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


Python QMessageBox.No方法代码示例

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


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

示例1: CustomMessage

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [as 别名]
def CustomMessage(title, msg, informative="", icon="Critical"):
        ''' Custom Informative Message '''
        d = QMessageBox()
        d.setTextFormat(Qt.RichText)
        d.setWindowTitle(title)
        d.setWindowIcon(QIcon(QPixmap(":/imgFMV/images/icon.png")))
        d.setText(msg)
        d.setInformativeText(informative)
        d.setIconPixmap(QgsUtils.GetIcon(icon))
        d.addButton(QMessageBox.Yes)
        d.addButton(QMessageBox.No)
        d.setDefaultButton(QMessageBox.No)
       
        # Trick resize QMessageBox
        horizontalSpacer = QSpacerItem(500, 0, QSizePolicy.Minimum, QSizePolicy.Expanding)
        layout = d.layout()
        layout.addItem(horizontalSpacer, layout.rowCount(), 0, 1, layout.columnCount())
        
        ret = d.exec_()
        return ret 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:22,代码来源:QgsUtils.py

示例2: __create_cells

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [as 别名]
def __create_cells(self):
        assert(self.project)
        createAlbionRaster = True

        if self.project.has_cell:
            createAlbionRaster = False
            if (
                QMessageBox.Yes
                != QMessageBox(
                    QMessageBox.Information,
                    "Creating cells",
                    "Do you want to replace project cells (your graphs will become invalid) ?",
                    QMessageBox.Yes | QMessageBox.No,
                ).exec_()
            ):
                return

        self.project.triangulate(createAlbionRaster)
        self.__refresh_layers() 
开发者ID:Oslandia,项目名称:albion,代码行数:21,代码来源:plugin.py

示例3: execute

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [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

示例4: clearAll

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [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

示例5: removeTableRows

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [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

示例6: __add_selection_to_graph_node

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [as 别名]
def __add_selection_to_graph_node(self):
        assert(self.project)
        #TODO ADD DIALOG TO REMIND USER THE CURRENT GRAPH
        if (
            self.__iface.activeLayer()
            and self.__iface.activeLayer().selectedFeatures()
        ):
            selection = self.__iface.activeLayer().selectedFeatures()
            graph = self.__current_graph.currentText()
            if (
                QMessageBox.Yes
                != QMessageBox(
                    QMessageBox.Information,
                    "Adding selected edges",
                    "Do you want to add {} selected edges to {} ?".format(
                        len(selection),
                        graph
                    ),
                    QMessageBox.Yes | QMessageBox.No,
                ).exec_()
            ):
                return

            self.project.add_to_graph_node(graph, selection)

        self.__refresh_layers() 
开发者ID:Oslandia,项目名称:albion,代码行数:28,代码来源:plugin.py

示例7: set_tms_scales

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [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

示例8: on_delete

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [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

示例9: on_delete

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [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

示例10: __import_project

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [as 别名]
def __import_project(self):
        fil, __ = QFileDialog.getOpenFileName(
            None,
            u"Import project from file",
            QgsProject.instance().readEntry("albion", "last_dir", "")[0],
            "File formats (*.zip)",
        )
        if not fil:
            return

        QgsProject.instance().writeEntry("albion", "last_dir", os.path.dirname(fil)),

        if fil[-4:] != ".zip":
            self.__iface.messageBar().pushWarning(
                "Albion", "unsupported extension for import"
            )

        project_name = os.path.split(fil)[1][:-4]
        dir_ = tempfile.mkdtemp()
        with zipfile.ZipFile(fil, "r") as z:
            z.extractall(dir_)

        dump = find_in_dir(dir_, ".dump")
        prj = find_in_dir(dir_, ".qgs")

        self.__iface.messageBar().pushInfo(
            "Albion", "loading {} from {}".format(project_name, dump)
        )

        dbname = os.path.splitext(os.path.basename(dump))[0]

        if Project.exists(dbname):
            if (
                QMessageBox.Yes
                != QMessageBox(
                    QMessageBox.Information,
                    "Delete existing DB",
                    "Database {} exits, to you want to delete it ?".format(
                        dbname
                    ),
                    QMessageBox.Yes | QMessageBox.No,
                ).exec_()
            ):
                return
            Project.delete(dbname)

        project = Project.import_(dbname, dump)

        QgsProject.instance().read(prj) 
开发者ID:Oslandia,项目名称:albion,代码行数:51,代码来源:plugin.py

示例11: check_oldFields

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [as 别名]
def check_oldFields(self):
        buildings_layer = QgsProject.instance().mapLayersByName(self.buildings_layer_comboBox.currentText())[0]
        buildings_layer = self.buildings_layer_comboBox.currentLayer()
        buildings_layer_fields = buildings_layer.fields()
        fields = [x.name() for x in buildings_layer_fields.toList()]

        # get period to assign
        fields_to_calculate = []
        if self.level_1_comboBox.currentText() != "":
            fields_to_calculate.append(self.level_1_comboBox.currentText())
        if self.level_2_comboBox.currentText() != "":
            fields_to_calculate.append(self.level_2_comboBox.currentText())
        if self.level_3_comboBox.currentText() != "":
            fields_to_calculate.append(self.level_3_comboBox.currentText())
        if self.level_4_comboBox.currentText() != "":
            fields_to_calculate.append(self.level_4_comboBox.currentText())
        if self.level_5_comboBox.currentText() != "":
            fields_to_calculate.append(self.level_5_comboBox.currentText())

        #print("fields_to_calculate",fields_to_calculate)
        #personal_fields = ['gen', 'day', 'eve', 'nig','den']
        fields_already_present = list(set(fields_to_calculate) & set(fields))
        if fields_already_present:
            overwrite_begin = self.tr("In buildings layer you already have the fields: ")
            overwrite_end = self.tr(" . Do you want to overwrite data in attribute table?")
            reply = QMessageBox.question(self, self.tr("opeNoise - Assign Levels To Buildings"),
                                           overwrite_begin + '\n' + str(fields_already_present) + overwrite_end, QMessageBox.Yes, QMessageBox.No)
            if reply == QMessageBox.No:
                reply2 = QMessageBox.question(self, self.tr("opeNoise - Assign Levels To Buildings"),
                                               self.tr("To mantain old data, copy them in a new field."), QMessageBox.Ok)
                return False
            else:
                fList = []
                for field_to_delete in fields_already_present:
                    idx_field = buildings_layer.dataProvider().fieldNameIndex(field_to_delete)
                    fList.append(idx_field)

                buildings_layer.dataProvider().deleteAttributes(fList)
                buildings_layer.updateFields()
                return True
        else:
            return True 
开发者ID:Arpapiemonte,项目名称:openoise-map,代码行数:44,代码来源:do_AssignLevelsToBuildings.py

示例12: check_oldFields

# 需要导入模块: from qgis.PyQt.QtWidgets import QMessageBox [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QMessageBox import No [as 别名]
def check_oldFields(self):
        receiver_layer = self.receivers_layer_comboBox.currentLayer()
        receiver_fields = receiver_layer.fields()
        fields = [x.name() for x in receiver_fields.toList()]

        # get period to calculate
        settings = on_Settings.getAllSettings()
        fields_to_calculate = []

        if self.sources_pts_layer_checkBox.isChecked():
            if settings['period_pts_gen'] == 'True':
                fields_to_calculate.append('gen')
            if settings['period_pts_day'] == 'True':
                fields_to_calculate.append('day')
            if settings['period_pts_eve'] == 'True':
                fields_to_calculate.append('eve')
            if settings['period_pts_nig'] == 'True':
                fields_to_calculate.append('nig')

        if self.sources_roads_layer_checkBox.isChecked():
            if settings['period_roads_gen'] == 'True':
                fields_to_calculate.append('gen')
            if settings['period_roads_day'] == 'True':
                fields_to_calculate.append('day')
            if settings['period_roads_eve'] == 'True':
                fields_to_calculate.append('eve')
            if settings['period_roads_nig'] == 'True':
                fields_to_calculate.append('nig')

        if ('day' in fields_to_calculate) and ('eve' in fields_to_calculate) and ('nig' in fields_to_calculate):
            fields_to_calculate.append('den')

        #print("fields_to_calculate",fields_to_calculate)
        #personal_fields = ['gen', 'day', 'eve', 'nig','den']
        fields_already_present = list(set(fields_to_calculate) & set(fields))
        if fields_already_present:
            overwrite_begin = self.tr("In the receivers point layer the following fields already exist: ")
            overwrite_end = self.tr(" . Do you want to overwrite them?")
            reply = QMessageBox.question(self, self.tr("opeNoise - Calculate Noise Levels"),
                                           overwrite_begin + '\n' + str(fields_already_present) + overwrite_end, QMessageBox.Yes, QMessageBox.No)
            if reply == QMessageBox.No:
                reply2 = QMessageBox.question(self, self.tr("opeNoise - Calculate Noise Levels"),
                                               self.tr("To mantain old data, copy them in a new field."), QMessageBox.Ok)
                return False
            else:
                fList = []
                for field_to_delete in fields_already_present:
                    idx_field = receiver_layer.dataProvider().fieldNameIndex(field_to_delete)
                    fList.append(idx_field)

                receiver_layer.dataProvider().deleteAttributes(fList)
                receiver_layer.updateFields()
                return True
        else:
            return True 
开发者ID:Arpapiemonte,项目名称:openoise-map,代码行数:57,代码来源:do_CalculateNoiseLevels.py


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