@@ -698,6 +698,126 @@ Classifiers wrap scikit-learn or XGBoost models:
698698
699699The GUI uses Qt's signal/slot mechanism for communication between components.
700700
701+ ##### MessageDialog - Custom Error/Warning/Info Dialogs
702+
703+ JABS provides a custom ` MessageDialog ` class for displaying errors, warnings, and informational messages throughout the application. This dialog should be ** preferred over PySide6's default dialogs** (` QMessageBox ` ) for consistency and enhanced functionality.
704+
705+ ** Location:** ` src/jabs/ui/message_dialog.py `
706+
707+ ** Why use MessageDialog instead of QMessageBox?**
708+
709+ 1 . ** Consistent branding** : Matches JABS visual design and theming
710+ 2 . ** Expandable details** : Supports collapsible stack traces and debug information
711+ 3 . ** Rich text support** : Messages can include HTML formatting
712+ 4 . ** Custom icons** : Can display JABS-specific icons with tooltips
713+
714+ ** Qt-Style API:**
715+
716+ The MessageDialog follows Qt's classmethod pattern (like ` QMessageBox.critical() ` ):
717+
718+ ``` python
719+ from jabs.ui import MessageDialog
720+
721+ # Error dialog
722+ MessageDialog.error(
723+ self , # parent widget
724+ title = " Load Error" ,
725+ message = " Failed to load the project file." ,
726+ )
727+
728+ # Error with expandable stack trace
729+ import traceback
730+ try :
731+ load_project(path)
732+ except Exception as e:
733+ MessageDialog.error(
734+ self ,
735+ title = " Project Load Error" ,
736+ message = f " An error occurred: { str (e)} " ,
737+ details = traceback.format_exc(), # Expandable section
738+ )
739+
740+ # Warning dialog
741+ MessageDialog.warning(
742+ self ,
743+ title = " Feature Recomputation Required" ,
744+ message = " The selected window size has not been used before. Features will be computed during training." ,
745+ )
746+
747+ # Info dialog
748+ MessageDialog.information(
749+ self ,
750+ title = " Success" ,
751+ message = " Project loaded successfully!" ,
752+ )
753+ ```
754+
755+ ** When to use each type:**
756+
757+ - ** ` MessageDialog.error() ` ** : Critical errors that prevent operation (file not found, invalid data, exceptions)
758+ - ** ` MessageDialog.warning() ` ** : Non-critical issues that the user should be aware of (performance impacts, missing optional data)
759+ - ** ` MessageDialog.information() ` ** : Successful operations, status updates, helpful tips
760+
761+ ** Features:**
762+
763+ 1 . ** Automatic title defaults** : If no title is provided, defaults based on message type ("Error", "Warning", "Information")
764+
765+ 2 . ** Expandable details section** :
766+ - Initially collapsed to keep dialog compact
767+ - Toggle button: "▶ Show Details" / "▼ Hide Details"
768+ - Monospace font suitable for stack traces and logs
769+ - Scrollable if content is long
770+
771+ 3 . ** Rich text messages** :
772+ ``` python
773+ MessageDialog.warning(
774+ self ,
775+ message = " Window size <b>60 frames</b> has not been used.<br><br>First training may be slow."
776+ )
777+ ```
778+
779+ 4 . ** Custom icons with tooltips** :
780+ - Icons can display tooltips on hover
781+ - Configured in ` _get_icon_path() ` method
782+
783+ ** Migration from QMessageBox:**
784+
785+ ** Before:**
786+ ``` python
787+ QMessageBox.critical(self , " Error" , " Something went wrong" )
788+ QMessageBox.warning(self , " Warning" , " Be careful" )
789+ QMessageBox.information(self , " Info" , " Success!" )
790+ ```
791+
792+ ** After:**
793+ ``` python
794+ MessageDialog.error(self , title = " Error" , message = " Something went wrong" )
795+ MessageDialog.warning(self , title = " Warning" , message = " Be careful" )
796+ MessageDialog.information(self , title = " Info" , message = " Success!" )
797+ ```
798+
799+ ** Best Practices:**
800+
801+ 1 . ** Always include parent widget** : Pass ` self ` as first parameter for proper dialog centering and modality
802+
803+ 2 . ** Use details for technical info** : Put user-friendly messages in ` message ` , technical details (stack traces, debug info) in ` details `
804+
805+ 3 . ** Be concise in messages** : Keep main message short and actionable; use ` details ` for verbose information
806+
807+ 4 . ** Provide context in titles** : Use specific titles like "Project Load Error" instead of just "Error"
808+
809+ 5 . ** Include actionable information** : Tell users what went wrong AND what they can do about it
810+
811+ ** Testing MessageDialog:**
812+
813+ A test/demo script is available:
814+
815+ ``` bash
816+ python -m jabs.ui.message_dialog
817+ ```
818+
819+ This opens a window with buttons to demonstrate all dialog types.
820+
701821### Data Flow
702822
7038231 . ** Input** : Video files + Pose estimation HDF5 files
0 commit comments