14 |
14 |
15 class DeleteFilesConfirmationDialog(QDialog, Ui_DeleteFilesConfirmationDialog): |
15 class DeleteFilesConfirmationDialog(QDialog, Ui_DeleteFilesConfirmationDialog): |
16 """ |
16 """ |
17 Class implementing a dialog to confirm deletion of multiple files. |
17 Class implementing a dialog to confirm deletion of multiple files. |
18 """ |
18 """ |
|
19 |
19 def __init__(self, parent, caption, message, files): |
20 def __init__(self, parent, caption, message, files): |
20 """ |
21 """ |
21 Constructor |
22 Constructor |
22 |
23 |
23 @param parent parent of this dialog (QWidget) |
24 @param parent parent of this dialog (QWidget) |
24 @param caption window title for the dialog (string) |
25 @param caption window title for the dialog (string) |
25 @param message message to be shown (string) |
26 @param message message to be shown (string) |
26 @param files list of filenames to be shown (list of strings) |
27 @param files list of filenames to be shown (list of strings) |
27 """ |
28 """ |
28 super().__init__(parent) |
29 super().__init__(parent) |
29 self.setupUi(self) |
30 self.setupUi(self) |
30 self.setModal(True) |
31 self.setModal(True) |
31 |
32 |
32 self.buttonBox.button( |
33 self.buttonBox.button(QDialogButtonBox.StandardButton.Yes).setAutoDefault(False) |
33 QDialogButtonBox.StandardButton.Yes).setAutoDefault(False) |
34 self.buttonBox.button(QDialogButtonBox.StandardButton.No).setDefault(True) |
34 self.buttonBox.button( |
35 self.buttonBox.button(QDialogButtonBox.StandardButton.No).setFocus() |
35 QDialogButtonBox.StandardButton.No).setDefault(True) |
36 |
36 self.buttonBox.button( |
|
37 QDialogButtonBox.StandardButton.No).setFocus() |
|
38 |
|
39 self.setWindowTitle(caption) |
37 self.setWindowTitle(caption) |
40 self.message.setText(message) |
38 self.message.setText(message) |
41 |
39 |
42 self.filesList.addItems(files) |
40 self.filesList.addItems(files) |
43 |
41 |
44 def on_buttonBox_clicked(self, button): |
42 def on_buttonBox_clicked(self, button): |
45 """ |
43 """ |
46 Private slot called by a button of the button box clicked. |
44 Private slot called by a button of the button box clicked. |
47 |
45 |
48 @param button button that was clicked (QAbstractButton) |
46 @param button button that was clicked (QAbstractButton) |
49 """ |
47 """ |
50 if button == self.buttonBox.button( |
48 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Yes): |
51 QDialogButtonBox.StandardButton.Yes |
|
52 ): |
|
53 self.accept() |
49 self.accept() |
54 elif button == self.buttonBox.button( |
50 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.No): |
55 QDialogButtonBox.StandardButton.No |
|
56 ): |
|
57 self.reject() |
51 self.reject() |