eric6/UI/DeleteFilesConfirmationDialog.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2004 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to confirm deletion of multiple files.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
13
14 from .Ui_DeleteFilesConfirmationDialog import Ui_DeleteFilesConfirmationDialog
15
16
17 class DeleteFilesConfirmationDialog(QDialog, Ui_DeleteFilesConfirmationDialog):
18 """
19 Class implementing a dialog to confirm deletion of multiple files.
20 """
21 def __init__(self, parent, caption, message, files):
22 """
23 Constructor
24
25 @param parent parent of this dialog (QWidget)
26 @param caption window title for the dialog (string)
27 @param message message to be shown (string)
28 @param files list of filenames to be shown (list of strings)
29 """
30 super(DeleteFilesConfirmationDialog, self).__init__(parent)
31 self.setupUi(self)
32 self.setModal(True)
33
34 self.buttonBox.button(QDialogButtonBox.Yes).setAutoDefault(False)
35 self.buttonBox.button(QDialogButtonBox.No).setDefault(True)
36 self.buttonBox.button(QDialogButtonBox.No).setFocus()
37
38 self.setWindowTitle(caption)
39 self.message.setText(message)
40
41 self.filesList.addItems(files)
42
43 def on_buttonBox_clicked(self, button):
44 """
45 Private slot called by a button of the button box clicked.
46
47 @param button button that was clicked (QAbstractButton)
48 """
49 if button == self.buttonBox.button(QDialogButtonBox.Yes):
50 self.accept()
51 elif button == self.buttonBox.button(QDialogButtonBox.No):
52 self.reject()

eric ide

mercurial