main_window
_main_window
¶
Custom main window widget.
Classes:
| Name | Description |
|---|---|
FXMainWindow |
Customized QMainWindow class. |
Classes¶
FXMainWindow
¶
FXMainWindow(
parent: Optional[QWidget] = None,
icon: Optional[str] = None,
title: Optional[str] = None,
size: Optional[Tuple[int, int]] = None,
documentation: Optional[str] = None,
project: Optional[str] = None,
version: Optional[str] = None,
company: Optional[str] = None,
ui_file: Optional[str] = None,
set_stylesheet: bool = True,
)
Bases: FXThemeAware, QMainWindow
flowchart TD
fxgui.fxwidgets._main_window.FXMainWindow[FXMainWindow]
fxgui.fxstyle.FXThemeAware[FXThemeAware]
fxgui.fxstyle.FXThemeAware --> fxgui.fxwidgets._main_window.FXMainWindow
click fxgui.fxwidgets._main_window.FXMainWindow href "" "fxgui.fxwidgets._main_window.FXMainWindow"
click fxgui.fxstyle.FXThemeAware href "" "fxgui.fxstyle.FXThemeAware"
Customized QMainWindow class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
QWidget
|
Parent widget. Defaults to |
None
|
|
str
|
Path to the window icon image. Defaults to |
None
|
|
str
|
Title of the window. Defaults to |
None
|
|
Tuple[int, int]
|
Window size as width and height.
Defaults to |
None
|
|
str
|
URL to the tool's documentation.
Defaults to |
None
|
|
str
|
Version label for the window.
Defaults to |
None
|
|
str
|
Company name for the window.
Defaults to |
None
|
|
str
|
Path to the UI file for loading.
Defaults to |
None
|
|
bool
|
Whether to set the default stylesheet.
Defaults to |
True
|
Methods:
| Name | Description |
|---|---|
center_on_screen |
Center the window on the primary screen. |
closeEvent |
Handle the window close event. |
get_available_themes |
Get a list of all available theme names. |
hide_banner |
Hides the banner. |
hide_status_line |
Hides the status line. |
setCentralWidget |
Override the QMainWindow's setCentralWidget method. |
setWindowTitle |
Override the setWindowTitle method. |
set_banner_icon |
Sets the icon of the banner. |
set_banner_text |
Sets the text of the banner. |
set_company_label |
Sets the company label in the status bar. |
set_project_label |
Sets the project label in the status bar. |
set_status_line_colors |
Set the colors of the status line. |
set_theme |
Set the theme of the window. |
set_ui_file |
Sets the UI file and loads the UI. |
set_version_label |
Sets the version label in the status bar. |
show_banner |
Shows the banner. |
show_status_line |
Shows the status line. |
statusBar |
Returns the FXStatusBar instance associated with this window. |
toggle_theme |
Toggle the theme of the window to the next available theme. |
Functions¶
center_on_screen
¶
closeEvent
¶
closeEvent(event: QCloseEvent) -> None
Handle the window close event.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
event
¶ |
QCloseEvent
|
The close event. |
required |
get_available_themes
¶
setCentralWidget
¶
setCentralWidget(widget: QWidget) -> None
Override the QMainWindow's setCentralWidget method.
Ensures that the status line is always at the bottom of the window and the banner is always at the top.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
widget
¶ |
QWidget
|
The widget to set as the central widget. |
required |
Note
Overrides the base class method.
setWindowTitle
¶
set_banner_icon
¶
Sets the icon of the banner.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
icon
¶ |
Optional[Union[QIcon, str]]
|
The icon to set in the banner. Can be a QIcon or an icon name string for theme-aware icons. |
required |
size
¶ |
int
|
The size of the icon. Defaults to 20. |
20
|
Note
Using an icon name string (e.g., "widgets") is recommended for theme-aware icons that automatically update when the theme changes.
set_banner_text
¶
set_company_label
¶
set_project_label
¶
set_status_line_colors
¶
set_theme
¶
Set the theme of the window.
This method can be called from external code to apply a specific theme, including when running inside a DCC like Houdini, Maya, or Nuke where you don't have direct access to QApplication.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
theme
¶ |
str
|
The theme name to apply (e.g., "dark", "light", or custom). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The theme that was applied. |
Examples:
set_ui_file
¶
set_version_label
¶
statusBar
¶
statusBar() -> FXStatusBar
Returns the FXStatusBar instance associated with this window.
Returns:
| Name | Type | Description |
|---|---|---|
FXStatusBar |
FXStatusBar
|
The FXStatusBar instance associated with this window. |
Note
Overrides the base class method.
toggle_theme
¶
toggle_theme() -> str
Toggle the theme of the window to the next available theme.
This method can be called from external code to cycle through themes, including when running inside a DCC like Houdini, Maya, or Nuke where you don't have direct access to QApplication.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The new theme that was applied. |
Examples: