status_bar
_status_bar
¶
Custom status bar widget.
Classes:
| Name | Description |
|---|---|
FXStatusBar |
Customized QStatusBar class. |
Classes¶
FXStatusBar
¶
FXStatusBar(
parent: Optional[QWidget] = None,
project: Optional[str] = None,
version: Optional[str] = None,
company: Optional[str] = None,
)
Bases: FXThemeAware, QStatusBar
flowchart TD
fxgui.fxwidgets._status_bar.FXStatusBar[FXStatusBar]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._status_bar.FXStatusBar
click fxgui.fxwidgets._status_bar.FXStatusBar href "" "fxgui.fxwidgets._status_bar.FXStatusBar"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
Customized QStatusBar class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
QWidget
|
Parent widget. Defaults to |
None
|
|
str
|
Project name. Defaults to |
None
|
|
str
|
Version information. Defaults to |
None
|
|
str
|
Company name. Defaults to |
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. |
Functions¶
clearMessage
¶
Clears the message from the status bar.
Note
Overrides the base class method.
resizeEvent
¶
Handle resize to position the status line and border correctly.
set_status_line_colors
¶
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 |
4
|
duration
¶ |
float
|
The duration in seconds for which
the message should be displayed. Defaults to |
2.5
|
time
¶ |
bool
|
Whether to display the current time before
the message. Defaults to |
True
|
logger
¶ |
Logger
|
A logger object to log the message.
Defaults to |
None
|
set_color
¶ |
bool
|
Whether to set the status bar color depending on
the log verbosity. Defaults to |
True
|
pixmap
¶ |
QPixmap
|
A custom pixmap to be displayed in the
status bar. Defaults to |
None
|
background_color
¶ |
str
|
A custom background color for
the status bar. Defaults to |
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.