Skip to content

progress_dialog

Mihaly Konda edited this page Jul 9, 2025 · 2 revisions

progress_dialog

version: v1.0.2

A cancellable, optionally nested progress dialog, reporting on a compatible process ran by a QObject-subclass on a separate thread.

function icon_file_path()

def icon_file_path() -> str

Returns the path for the icon file to be used in the dialogs.


function set_icon_file_path()

def set_icon_file_path(new_path: str = '') -> None

Sets the path for the icon file to be used in the dialogs.

Parameters:

  • new_path: The new path to set for the windows. The default is an empty string, leading to the default icon.

class _Threaded(QObject)

An example, progress dialog compatible class. Worker objects of simple (not nested) PDs do not need sub-signals.


Signals:

  • sig_new_process_unit: A signal carrying a string identifier of the new main process unit.
  • sig_new_subprocess_unit: A signal carrying a string identifier of the new subprocess unit.
  • sig_main_progress: A signal carrying the progress (integer percentage) of the main process.
  • sig_sub_progress: A signal carrying the progress (integer percentage) of the subprocess.
  • sig_finished: The signal emitted when the process finishes.
  • sig_start: The signal that starts the process execution.
  • sig_cancel: A signal for external cancellation of the process execution.

def __init__(self, nested=False) -> None

Initializer for the class.

Parameters:

  • nested: A flag marking whether the progress dialog should be nested. The default is False.

@property
def nested(self) -> bool

Returns whether the associated progress dialog is nested.


@Slot()
def _process(self) -> None

The slot connected to the start signal. Emits sig_finished when the process finishes.


@Slot()
def _cancel_process(self) -> None

The slot connected to the cancel signal. Needs the button press event to be processed beforehand.


class _ProgressMixin

A window reporting on the progress of a process running on a separate thread.


def __init__(self, worker, title, widget_theme=None) -> None

Initializer for the class.

Parameters:

  • worker: A worker subclassing QObject, handling a process.
  • title: The title to set for the window.
  • widget_theme: A widget theme from the 'theme' module. The default is None, for the Qt-default theme.

def _setup_ui(self) -> None

Sets up the user interface: GUI objects and layouts.


def _setup_connections(self) -> None

Sets up the connections of the GUI objects.


@property
def theme(self) -> ThemeParameters

Returns the parameters of the theme set for this object.


@theme.setter
def theme(self, new_theme: ThemeParameters) -> None

Sets a new set of parameters defining a theme to this object.


def _create_worker_thread(self) -> None

Creates a new thread and moves the worker there.


def _quit_thread(self) -> None

Closes the thread after the worker has finished.


def _cancel_process(self) -> None

Asks for confirmation to cancel the process.


class ProgressDialog(_ProgressMixin, QDialog)

A dialog reporting on the progress of a process running on a separate thread.


def __init__(self, worker: QObject, title="Progress report", widget_theme=None) -> None

Initializer for the class.

Parameters:

  • worker: A worker subclassing QObject, handling a process.
  • title: The title to set for the dialog. The default is "Progress report".
  • widget_theme: A widget theme from the 'theme' module. The default is None, for the Qt-default theme.

class ProgressDW(_ProgressMixin, QDockWidget)

A dock widget reporting on the progress of a process running on a separate thread.


def __init__(self, worker: QObject, title="Progress report", widget_theme=None) -> None

Initializer for the class.

Parameters:

  • worker: A worker subclassing QObject, handling a process.
  • title: The title to set for the dialog. The default is "Progress report".
  • widget_theme: A widget theme from the 'theme' module. The default is None, for the Qt-default theme.

API reference

Base/technical modules:

Other modules

Clone this wiki locally