@@ -227,38 +227,36 @@ def __init__(self, parent=None):
227227 # Enable mouse tracking
228228 self .setMouseTracking (True )
229229
230- # Initially semi-transparent
231- self .base_opacity = 0.3
232- self .hover_opacity = 0.8
233- self .icon_base_opacity = 0.5 # Icons start more transparent
234- self .icon_hover_opacity = 1.0 # Icons become fully opaque on hover
235- self .setStyleSheet (f"""
236- ButtonOverlay {{
237- background-color: rgba(0, 0, 0, { int (self .base_opacity * 255 )} );
230+ # Initially semi-transparent
231+ self .base_opacity = 0.15 # Background opacity
232+ self .hover_opacity = 0.5 # Background opacity on hover
233+ self .setStyleSheet ("""
234+ ButtonOverlay {
235+ background-color: rgba(0, 0, 0, 38);
238236 border-radius: 25px;
239- }}
240- ButtonOverlay:hover {{
241- background-color: rgba(0, 0, 0, { int ( self . hover_opacity * 255 ) } );
242- }}
243- QPushButton {{
237+ }
238+ ButtonOverlay:hover {
239+ background-color: rgba(0, 0, 0, 128 );
240+ }
241+ QPushButton {
244242 background: transparent;
245243 border: none;
246- color: rgba(255, 255, 255, { int ( self . icon_base_opacity * 255 ) } ) ;
244+ color: #ffffff ;
247245 font-size: 16px;
248246 padding: 0px;
249247 border-radius: 20px;
250248 min-width: 40px;
251249 min-height: 40px;
252250 text-align: center;
253- }}
254- QPushButton:hover {{
251+ }
252+ QPushButton:hover {
255253 background-color: rgba(255, 255, 255, 30);
256- color: rgba(255, 255, 255, { int ( self . icon_hover_opacity * 255 ) } ) ;
257- }}
258- QPushButton:pressed {{
254+ color: #ffffff ;
255+ }
256+ QPushButton:pressed {
259257 background-color: rgba(255, 255, 255, 50);
260- color: rgba(255, 255, 255, { int ( self . icon_hover_opacity * 255 ) } ) ;
261- }}
258+ color: #ffffff ;
259+ }
262260 """ )
263261
264262 # Create layout
@@ -271,26 +269,44 @@ def __init__(self, parent=None):
271269
272270 # Create buttons with professional geometric icons (all same size)
273271 icon_size = 18 # Consistent size for all icons
274- # Use semi-transparent icons to match button opacity
275- icon_color = f"rgba(255, 255, 255, { int ( self . icon_base_opacity * 255 ) } ) "
272+ # Use solid white and apply opacity to the pixmaps directly
273+ icon_color = "#ffffff "
276274
275+ # Create base icons with transparency applied to pixmap
277276 self .prev_btn = QPushButton ()
278- self .prev_btn .setIcon (create_professional_icon ("skip_previous" , icon_size , icon_color ))
277+ self .prev_btn ._base_icon = self ._create_transparent_icon ("skip_previous" , icon_size , icon_color , 0.7 )
278+ self .prev_btn ._hover_icon = create_professional_icon ("skip_previous" , icon_size , icon_color )
279+ self .prev_btn .setIcon (self .prev_btn ._base_icon )
279280
280281 self .pause_btn = QPushButton ()
281- self .pause_btn .setIcon (create_professional_icon ("pause" , icon_size , icon_color ))
282+ self .pause_btn ._base_icon = self ._create_transparent_icon ("pause" , icon_size , icon_color , 0.7 )
283+ self .pause_btn ._hover_icon = create_professional_icon ("pause" , icon_size , icon_color )
284+ self .pause_btn .setIcon (self .pause_btn ._base_icon )
282285
283286 self .stop_btn = QPushButton ()
284- self .stop_btn .setIcon (create_professional_icon ("stop" , icon_size , icon_color ))
287+ self .stop_btn ._base_icon = self ._create_transparent_icon ("stop" , icon_size , icon_color , 0.7 )
288+ self .stop_btn ._hover_icon = create_professional_icon ("stop" , icon_size , icon_color )
289+ self .stop_btn .setIcon (self .stop_btn ._base_icon )
285290
286291 self .next_btn = QPushButton ()
287- self .next_btn .setIcon (create_professional_icon ("skip_next" , icon_size , icon_color ))
292+ self .next_btn ._base_icon = self ._create_transparent_icon ("skip_next" , icon_size , icon_color , 0.7 )
293+ self .next_btn ._hover_icon = create_professional_icon ("skip_next" , icon_size , icon_color )
294+ self .next_btn .setIcon (self .next_btn ._base_icon )
288295
289296 self .zoom_out_btn = QPushButton ()
290- self .zoom_out_btn .setIcon (create_professional_icon ("zoom_out" , icon_size , icon_color ))
297+ self .zoom_out_btn ._base_icon = self ._create_transparent_icon ("zoom_out" , icon_size , icon_color , 0.7 )
298+ self .zoom_out_btn ._hover_icon = create_professional_icon ("zoom_out" , icon_size , icon_color )
299+ self .zoom_out_btn .setIcon (self .zoom_out_btn ._base_icon )
291300
292301 self .zoom_in_btn = QPushButton ()
293- self .zoom_in_btn .setIcon (create_professional_icon ("zoom_in" , icon_size , icon_color ))
302+ self .zoom_in_btn ._base_icon = self ._create_transparent_icon ("zoom_in" , icon_size , icon_color , 0.7 )
303+ self .zoom_in_btn ._hover_icon = create_professional_icon ("zoom_in" , icon_size , icon_color )
304+ self .zoom_in_btn .setIcon (self .zoom_in_btn ._base_icon )
305+
306+ # Setup hover behavior for each button
307+ for btn in [self .prev_btn , self .pause_btn , self .stop_btn , self .next_btn , self .zoom_out_btn , self .zoom_in_btn ]:
308+ btn .enterEvent = lambda event , button = btn : self ._on_button_enter (event , button )
309+ btn .leaveEvent = lambda event , button = btn : self ._on_button_leave (event , button )
294310
295311 # Connect signals
296312 self .prev_btn .clicked .connect (self .previous_clicked .emit )
@@ -315,15 +331,46 @@ def set_pause_state(self, is_paused, timer_active=True):
315331 # If timer is active, show play when paused, pause when running
316332 icon_type = "play" if (not timer_active or is_paused ) else "pause"
317333 icon_size = 18 # Match the consistent icon size
318- # Use same opacity as other icons
319- icon_color = f"rgba(255, 255, 255, { int (self .icon_base_opacity * 255 )} )"
320- self .pause_btn .setIcon (create_professional_icon (icon_type , icon_size , icon_color ))
334+ icon_color = "#ffffff"
335+
336+ # Update both base and hover icons
337+ self .pause_btn ._base_icon = self ._create_transparent_icon (icon_type , icon_size , icon_color , 0.7 )
338+ self .pause_btn ._hover_icon = create_professional_icon (icon_type , icon_size , icon_color )
339+ self .pause_btn .setIcon (self .pause_btn ._base_icon )
321340
322341 def show (self ):
323342 """Override show to start auto-hide timer."""
324343 super ().show ()
325344 self ._start_auto_hide_timer ()
326345
346+ def _create_transparent_icon (self , icon_type , size , color , opacity ):
347+ """Create an icon with specified opacity applied to the pixmap."""
348+ from ..core .image_utils import create_professional_icon
349+ from PySide6 .QtGui import QIcon , QPixmap , QPainter
350+
351+ # Create the base icon
352+ base_icon = create_professional_icon (icon_type , size , color )
353+
354+ # Get the pixmap and apply opacity
355+ base_pixmap = base_icon .pixmap (size , size )
356+ transparent_pixmap = QPixmap (size , size )
357+ transparent_pixmap .fill (Qt .transparent )
358+
359+ painter = QPainter (transparent_pixmap )
360+ painter .setOpacity (opacity )
361+ painter .drawPixmap (0 , 0 , base_pixmap )
362+ painter .end ()
363+
364+ return QIcon (transparent_pixmap )
365+
366+ def _on_button_enter (self , event , button ):
367+ """Handle button hover - switch to full opacity icon."""
368+ button .setIcon (button ._hover_icon )
369+
370+ def _on_button_leave (self , event , button ):
371+ """Handle button leave - switch back to semi-transparent icon."""
372+ button .setIcon (button ._base_icon )
373+
327374 def enterEvent (self , event ):
328375 """Show controls when mouse enters the overlay."""
329376 super ().enterEvent (event )
0 commit comments