5555
5656
5757from src .ui .frameless_window import FramelessWindow
58+ from src .ui .controllers .navigation_controller import NavigationController
59+ from src .ui .controllers .installation_controller import InstallationController
5860
5961class MainWindow (FramelessWindow ):
6062 EXIT_CODE_REBOOT = 2506
@@ -161,9 +163,6 @@ def center_on_screen(self):
161163 self .build_ui_content ()
162164 self .apply_styles ()
163165
164- # Connect installed tab signals for advanced features
165- self .installed_tab .custom_context_requested .connect (self .show_installed_context_menu )
166- self .installed_tab .filter_collection_requested .connect (self .installed_tab .filter_by_collection )
167166 # Connect installed tab signals for advanced features
168167 self .installed_tab .custom_context_requested .connect (self .show_installed_context_menu )
169168 self .installed_tab .filter_collection_requested .connect (self .installed_tab .filter_by_collection )
@@ -188,6 +187,10 @@ def center_on_screen(self):
188187 # Start File Watcher
189188 self .character_service .start_watcher (self .on_files_changed_externally )
190189
190+ # --- Controllers ---
191+ self .navigation = NavigationController (self )
192+ self .installation_controller = InstallationController (self .character_service , self )
193+
191194 # Automation Service
192195 self .automation_service = AutomationService (self .config_manager , self .character_service )
193196 self .automation_service .log_message .connect (self .activity_panel .add_log_message )
@@ -327,12 +330,23 @@ def build_ui_content(self):
327330 self .toast = ToastNotification (self )
328331
329332 def on_tab_changed (self , index ):
333+ """Unified tab change handler."""
334+ # Notify Controller
335+ if hasattr (self , 'navigation' ):
336+ # We could delegate this entirely to navigation, but for now we sync logic here
337+ pass
338+
330339 tab_name = self .tabs .tabText (index )
340+
341+ # Logic from original on_tab_changed (Discord)
331342 if index == 0 : # Online
332343 self .discord_manager .update_presence ("Browsing Online Characters" , "Looking for a new face" )
333344 elif index == 1 : # Create
334345 self .discord_manager .update_presence ("Creating Character" , "Using StarChar.app" )
335346 elif index == 2 : # Installed
347+ # Logic from duplicate on_tab_changed (Load Data)
348+ self .installed_tab .load_characters ()
349+
336350 count = len (self .installed_character_widgets )
337351 self .discord_manager .update_presence ("Managing Fleet" , f"{ count } Characters Installed" )
338352 elif index == 3 : # About
@@ -498,9 +512,7 @@ def showEvent(self, event):
498512 if getattr (self , 'splash_overlay' , None ) and self .splash_overlay .isVisible ():
499513 self .splash_overlay .resize (self .size ())
500514
501- def on_tab_changed (self , index ):
502- if index == 2 : # Installed tab
503- self .installed_tab .load_characters ()
515+ # Duplicate on_tab_changed removed and merged into the main one above.
504516
505517 def open_website (self ):
506518 webbrowser .open ("https://www.star-citizen-characters.com" )
0 commit comments