examples
Example implementations demonstrating fxgui module usage.
This module contains various example functions showcasing how to use the fxgui framework for creating Qt-based applications, including:
- Basic window creation and subclassing
- Splash screens with progress bars
- Login dialogs with password input
- Custom delegates for tree/list/table widgets
- Collapsible widgets with animation
- Input validators (camelCase, lowercase, etc.)
- Output log widget with search functionality
- Singleton pattern for windows
- System tray integration
- DCC-specific implementations for Houdini
Functions:
| Name | Description |
|---|---|
main |
Main example function showing complete application setup. |
show_window |
Simple window example with UI file. |
show_splash_screen |
Display a customizable splash screen. |
show_login_dialog |
Modal login dialog example. |
show_collapsible_widget |
Expandable/collapsible content example. |
show_validators |
Input validation examples. |
show_output_log |
Log output widget example. |
show_singleton_window |
Singleton window pattern example. |
show_elided_label |
Text elision example. |
show_window_houdini |
Example for Houdini integration. |
show_floating_dialog_houdini |
Floating dialog in Houdini. |
Usage
Run this module directly to see the full example:
python -m fxgui.examples
Or import specific examples:
from fxgui.examples import show_window show_window()
configure_window
configure_window(window: FXMainWindow)
Configure the main window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FXMainWindow
|
The main window instance. |
required |
Source code in fxgui/examples.py
finish_splash_screen
finish_splash_screen(
splashscreen: FXSplashScreen, window: FXMainWindow, show_delayed: bool
) -> None
Finish the splash screen and show the main window.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FXSplashScreen
|
The splash screen instance. |
required |
|
FXMainWindow
|
The main window instance. |
required |
|
bool
|
Whether to show the window after a delay. |
required |
Source code in fxgui/examples.py
get_colors
Get the colors for the FXColorLabelDelegate class.
Returns:
| Type | Description |
|---|---|
Dict[str, Tuple[QColor, QColor, QColor, QIcon, bool]]
|
A dictionary mapping item texts to `(background_color, |
Dict[str, Tuple[QColor, QColor, QColor, QIcon, bool]]
|
border_color, text_icon_color, icon, color_icon)`. |
Source code in fxgui/examples.py
main
main(show_delayed: bool = True)
Main example function.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
bool
|
Whether to show the window after a delay. |
True
|
Source code in fxgui/examples.py
set_button_icons
set_button_icons(window: FXMainWindow) -> None
Set icons for the status buttons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FXMainWindow
|
The main window instance. |
required |
Source code in fxgui/examples.py
set_tooltips
set_tooltips(window: FXMainWindow) -> None
Set tooltips for the buttons.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FXMainWindow
|
The main window instance. |
required |
Source code in fxgui/examples.py
setup_list_widget
setup_list_widget(window: FXMainWindow) -> None
Setup the list widget with a custom delegate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FXMainWindow
|
The main window instance. |
required |
Source code in fxgui/examples.py
setup_refresh_action
setup_refresh_action(window: FXMainWindow) -> None
Setup the refresh action in the toolbar.
Source code in fxgui/examples.py
setup_status_buttons
setup_status_buttons(window: FXMainWindow)
Connect status buttons to display messages.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FXMainWindow
|
The main window instance. |
required |
Source code in fxgui/examples.py
setup_table_widget
setup_table_widget(window: FXMainWindow) -> None
Setup the table widget with a custom delegate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FXMainWindow
|
The main window instance. |
required |
Source code in fxgui/examples.py
setup_tree_widget
setup_tree_widget(window: FXMainWindow) -> None
Setup the tree widget with a custom delegate and a context menu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FXMainWindow
|
The main window instance. |
required |
Source code in fxgui/examples.py
show_collapsible_widget
Show a collapsible widget with animated expand/collapse.
Demonstrates
- FXCollapsibleWidget for expandable sections
- Animation effects
- Nested content layouts
Source code in fxgui/examples.py
show_context_menu
Show the context menu when right-clicking on an item.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
QTreeWidget
|
The tree widget to show the context menu in. |
required |
|
QPoint
|
The position of the right-click. |
required |
Source code in fxgui/examples.py
show_elided_label
Show the elided label that truncates text with ellipsis.
Demonstrates
- FXElidedLabel for automatic text elision
- Responsive text truncation on resize
Source code in fxgui/examples.py
show_floating_dialog_houdini
An example FXFloatingDialog launched from inside Houdini.
Demonstrates
- FXFloatingDialog popup at cursor position
- Adding custom widgets to the dialog
Source code in fxgui/examples.py
show_login_dialog
Show a login dialog with password input.
Demonstrates
- FXPasswordLineEdit for secure password input
- FXApplication for styling
- Modal dialog creation
Source code in fxgui/examples.py
show_output_log
Show the output log widget with logging capture.
Demonstrates
- FXOutputLogWidget for displaying logs
- Log capture from Python's logging module
- Search functionality with Ctrl+F
- ANSI color code support
- FXIconButton for theme-aware button icons
Source code in fxgui/examples.py
show_singleton_window
Show a singleton window that can only have one instance.
Demonstrates
- FXSingleton metaclass for single-instance windows
- Automatic window focusing when trying to create a second instance
Source code in fxgui/examples.py
show_splash_screen
show_splash_screen(
opacity: float = 0.75,
project: str = "fxgui",
version: str = "0.1.0",
company: str = "© Valentin Beaumont",
) -> FXSplashScreen
Show the splash screen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float
|
The overlay opacity (0.0 to 1.0). Defaults to 0.75. |
0.75
|
|
str
|
The project name. Defaults to "fxgui". |
'fxgui'
|
|
str
|
The version string. Defaults to "0.1.0". |
'0.1.0'
|
|
str
|
The company name. Defaults to copyright Valentin Beaumont. |
'© Valentin Beaumont'
|
Returns:
| Type | Description |
|---|---|
FXSplashScreen
|
The splash screen instance. |
Source code in fxgui/examples.py
show_validators
Show input validators for different text formats.
Demonstrates
- FXCamelCaseValidator for camelCase input
- FXLowerCaseValidator for lowercase input
- FXLettersUnderscoreValidator for identifiers
- FXCapitalizedLetterValidator for names
Source code in fxgui/examples.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
show_window
Show a basic window with status bar messages.
Demonstrates
- FXApplication and FXMainWindow basics
- Status bar with different severity levels
- Icon usage from fxicons
Source code in fxgui/examples.py
show_window_houdini
An example FXMainWindow instance launched from inside Houdini.
Demonstrates
- DCC parent window detection
- Proper window parenting for DCC integration
Source code in fxgui/examples.py
simulate_loading
simulate_loading(
splashscreen: FXSplashScreen, application: FXApplication
) -> None
Simulate a loading process on the splash screen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
FXSplashScreen
|
The splash screen instance. |
required |
|
FXApplication
|
The application instance. |
required |
Source code in fxgui/examples.py
subclass_window
Show a subclassed FXMainWindow with custom widgets.
Demonstrates
- Subclassing FXMainWindow
- Creating custom central widgets