src/eric7/UI/DeleteFilesConfirmationDialog.py

Thu, 11 Jul 2024 14:21:34 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 11 Jul 2024 14:21:34 +0200
branch
eric7
changeset 10840
c8045d0dbaa7
parent 10439
21c28b0f9e41
child 11090
f5f5f5803935
permissions
-rw-r--r--

MicroPython
- Updated the list of known CircuitPython boards for CPy 9.1.0.
- Updated the list of known UF2 capable boards.

# -*- coding: utf-8 -*-

# Copyright (c) 2004 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing a dialog to confirm deletion of multiple files.
"""

from PyQt6.QtWidgets import QDialog, QDialogButtonBox

from .Ui_DeleteFilesConfirmationDialog import Ui_DeleteFilesConfirmationDialog


class DeleteFilesConfirmationDialog(QDialog, Ui_DeleteFilesConfirmationDialog):
    """
    Class implementing a dialog to confirm deletion of multiple files.
    """

    def __init__(self, parent, caption, message, files):
        """
        Constructor

        @param parent parent of this dialog
        @type QWidget
        @param caption window title for the dialog
        @type str
        @param message message to be shown
        @type str
        @param files list of filenames to be shown
        @type list of str
        """
        super().__init__(parent)
        self.setupUi(self)
        self.setModal(True)

        self.buttonBox.button(QDialogButtonBox.StandardButton.Yes).setAutoDefault(False)
        self.buttonBox.button(QDialogButtonBox.StandardButton.No).setDefault(True)
        self.buttonBox.button(QDialogButtonBox.StandardButton.No).setFocus()

        self.setWindowTitle(caption)
        self.message.setText(message)

        self.filesList.addItems(files)

    def on_buttonBox_clicked(self, button):
        """
        Private slot called by a button of the button box clicked.

        @param button button that was clicked
        @type QAbstractButton
        """
        if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Yes):
            self.accept()
        elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.No):
            self.reject()

eric ide

mercurial