eric6/E5Gui/E5ProgressDialog.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 8043
0acf98cd089a
child 8218
7c09585bd960
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 progress dialog allowing a customized progress bar label.
"""

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QProgressBar, QProgressDialog


class E5ProgressDialog(QProgressDialog):
    """
    Class implementing a progress dialog allowing a customized progress bar
    label.
    """
    def __init__(self, labelText, cancelButtonText, minimum, maximum,
                 labelFormat=None, parent=None, flags=None):
        """
        Constructor
        
        @param labelText text of the dialog label (string)
        @param cancelButtonText text of the cancel button (string)
        @param minimum minimum value (integer)
        @param maximum maximum value (integer)
        @param labelFormat label format of the progress bar (string)
        @param parent reference to the parent widget (QWidget)
        @param flags window flags of the dialog (Qt.WindowFlags)
        """
        if flags is None:
            flags = Qt.WindowFlags()
        super(E5ProgressDialog, self).__init__(
            labelText, cancelButtonText, minimum, maximum, parent, flags)
        
        self.__progressBar = QProgressBar(self)
        self.__progressBar.setMinimum(minimum)
        self.__progressBar.setMaximum(maximum)
        if labelFormat:
            self.__progressBar.setFormat(labelFormat)
        
        self.setBar(self.__progressBar)
    
    def format(self):
        """
        Public method to get the progress bar format.
        
        @return progress bar format (string)
        """
        return self.__progressBar.format()
    
    def setFormat(self, labelFormat):
        """
        Public method to set the progress bar format.
        
        @param labelFormat progress bar format (string)
        """
        self.__progressBar.setFormat(labelFormat)

eric ide

mercurial