UI/DeleteFilesConfirmationDialog.py

Sun, 05 Jan 2014 23:22:17 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Sun, 05 Jan 2014 23:22:17 +0100
branch
Py2 comp.
changeset 3178
f25fc1364c88
parent 3161
06f57a834adf
parent 3160
209a07d7e401
child 3656
441956d8fce5
permissions
-rw-r--r--

Merge with default branch.

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

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

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

from __future__ import unicode_literals

from PyQt4.QtGui 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 (QWidget)
        @param caption window title for the dialog (string)
        @param message message to be shown (string)
        @param files list of filenames to be shown (list of strings)
        """
        super(DeleteFilesConfirmationDialog, self).__init__(parent)
        self.setupUi(self)
        self.setModal(True)
        
        self.buttonBox.button(QDialogButtonBox.Yes).setAutoDefault(False)
        self.buttonBox.button(QDialogButtonBox.No).setDefault(True)
        self.buttonBox.button(QDialogButtonBox.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 (QAbstractButton)
        """
        if button == self.buttonBox.button(QDialogButtonBox.Yes):
            self.accept()
        elif button == self.buttonBox.button(QDialogButtonBox.No):
            self.reject()

eric ide

mercurial