eric6/E5Gui/E5ErrorMessageFilterDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8157
800c09ec0956
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

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

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

"""
Module implementing a dialog to manage the list of messages to be ignored.
"""

from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QDialog

from .Ui_E5ErrorMessageFilterDialog import Ui_E5ErrorMessageFilterDialog


class E5ErrorMessageFilterDialog(QDialog, Ui_E5ErrorMessageFilterDialog):
    """
    Class implementing a dialog to manage the list of messages to be ignored.
    """
    def __init__(self, messageFilters, defaultFilters, parent=None):
        """
        Constructor
        
        @param messageFilters list of message filters to be edited
        @type list of str
        @param defaultFilters list of default message filters
        @type list of str
        @param parent reference to the parent widget
        @type QWidget
        """
        super(E5ErrorMessageFilterDialog, self).__init__(parent)
        self.setupUi(self)
        
        self.__defaultFilters = defaultFilters[:]
        
        self.filtersEditWidget.setList(messageFilters)
        self.filtersEditWidget.setListWhatsThis(self.tr(
            "<b>Error Message Filters</b>"
            "<p>This list shows the configured message filters used to"
            " suppress error messages from within Qt.</p>"
        ))
        
        self.filtersEditWidget.setDefaultVisible(True)
        self.filtersEditWidget.setToDefault.connect(self.__setToDefault)
    
    @pyqtSlot()
    def __setToDefault(self):
        """
        Private slot to set the message list to the default values.
        """
        self.filtersEditWidget.setList(self.__defaultFilters)
    
    def getFilters(self):
        """
        Public method to get the list of message filters.
        
        @return error message filters (list of strings)
        """
        return self.filtersEditWidget.getList()

eric ide

mercurial