Skip to content

Status Bar

An enhanced status bar with additional features and styling.

Preview

FXStatusBar

FXStatusBar

Bases: FXThemeAware, QStatusBar

Customized QStatusBar class.

Parameters:

Name Type Description Default

parent

QWidget

Parent widget. Defaults to None.

None

project

str

Project name. Defaults to None.

None

version

str

Version information. Defaults to None.

None

company

str

Company name. Defaults to None.

None

Attributes:

Name Type Description
project str

The project name.

version str

The version string.

company str

The company name.

icon_label QLabel

The icon label.

message_label QLabel

The message label.

project_label QLabel

The project label.

version_label QLabel

The version label.

company_label QLabel

The company label.

Methods:

Name Description
clearMessage

Clears the message from the status bar.

hide_status_line

Hide the status line and border line.

resizeEvent

Handle resize to position the status line and border correctly.

set_status_line_colors

Set the status line gradient colors.

showMessage

Display a message in the status bar with a specified severity.

show_status_line

Show the status line and border line.

clearMessage

clearMessage()

Clears the message from the status bar.

Note

Overrides the base class method.

hide_status_line

hide_status_line() -> None

Hide the status line and border line.

resizeEvent

resizeEvent(event) -> None

Handle resize to position the status line and border correctly.

set_status_line_colors

set_status_line_colors(color_a: str, color_b: str) -> None

Set the status line gradient colors.

Parameters:

Name Type Description Default

color_a

str

The first color of the gradient.

required

color_b

str

The second color of the gradient.

required

showMessage

showMessage(
    message: str,
    severity_type: int = 4,
    duration: float = 2.5,
    time: bool = True,
    logger: Optional[Logger] = None,
    set_color: bool = True,
    pixmap: Optional[QPixmap] = None,
    background_color: Optional[str] = None,
)

Display a message in the status bar with a specified severity.

Parameters:

Name Type Description Default

message

str

The message to be displayed.

required

severity_type

int

The severity level of the message. Should be one of CRITICAL, ERROR, WARNING, SUCCESS, INFO, or DEBUG. Defaults to INFO.

4

duration

float

The duration in seconds for which the message should be displayed. Defaults to2.5.

2.5

time

bool

Whether to display the current time before the message. Defaults to True.

True

logger

Logger

A logger object to log the message. Defaults to None.

None

set_color

bool

Whether to set the status bar color depending on the log verbosity. Defaults to True.

True

pixmap

QPixmap

A custom pixmap to be displayed in the status bar. Defaults to None.

None

background_color

str

A custom background color for the status bar. Defaults to None.

None

Examples:

To display a critical error message with a red background

>>> self.showMessage(
...     "Critical error occurred!",
...     severity_type=self.CRITICAL,
...     duration=5,
...     logger=my_logger,
... )
Note

You can either use the FXMainWindow instance to retrieve the verbosity constants, or the fxwidgets module. Overrides the base class method.

show_status_line

show_status_line() -> None

Show the status line and border line.