@@ -135,7 +135,13 @@ def _deprecation_check(self):
135135 def open_cocktail_selection (self , cocktail : Cocktail ):
136136 """Open the cocktail selection screen."""
137137 if self .cocktail_selection is not None :
138+ # Clean up all internal layouts and widgets recursively
139+ DP_CONTROLLER .delete_items_of_layout (self .cocktail_selection .layout ())
140+ # Remove from stacked widget
138141 self .container_maker .removeWidget (self .cocktail_selection )
142+ # Schedule for deletion and remove reference
143+ self .cocktail_selection .deleteLater ()
144+ self .cocktail_selection = None
139145 self .cocktail_selection = CocktailSelection (
140146 self , cocktail , lambda : self .container_maker .setCurrentWidget (self .cocktail_view )
141147 )
@@ -163,7 +169,9 @@ def open_keyboard(self, le_to_write, max_char_len=30):
163169
164170 def open_progression_window (self , cocktail_type : str = "Cocktail" ):
165171 """Open up the progression window to show the Cocktail status."""
166- self .progress_window = ProgressScreen (self , cocktail_type )
172+ if self .progress_window is None :
173+ self .progress_window = ProgressScreen (self , cocktail_type )
174+ self .progress_window .show_screen (cocktail_type )
167175
168176 def change_progression_window (self , pb_value : int ):
169177 """Change the value of the progression bar of the ProBarWindow."""
@@ -175,7 +183,7 @@ def close_progression_window(self):
175183 """Close the progression window at the end of the cycle."""
176184 if self .progress_window is None :
177185 return
178- self .progress_window .close ()
186+ self .progress_window .hide ()
179187
180188 def open_team_window (self ):
181189 self .team_window = TeamScreen (self )
0 commit comments