@@ -353,25 +353,6 @@ def on_container_destroy(container):
353
353
# Agregamos el contenido principal al hist_box
354
354
hist_box .add (content_box )
355
355
356
- # Si hay acciones, creamos y agregamos los botones
357
- if notification_box .notification .actions :
358
- action_buttons = Box (
359
- name = "notification-action-buttons" ,
360
- spacing = 4 ,
361
- h_expand = True ,
362
- children = [
363
- HistoryActionButton (
364
- action ,
365
- i ,
366
- len (notification_box .notification .actions ),
367
- container ,
368
- on_destroy = lambda : on_container_destroy (container )
369
- )
370
- for i , action in enumerate (notification_box .notification .actions )
371
- ],
372
- )
373
- hist_box .add (action_buttons )
374
-
375
356
# Modificar el botón de cerrar para que use nuestro método personalizado
376
357
content_box .get_children ()[3 ].get_children ()[0 ].connect ( # Box con botón de cerrar
377
358
"clicked" ,
@@ -524,6 +505,8 @@ def on_new_notification(self, fabric_notif, id):
524
505
# Limitar a 5 notificaciones
525
506
while len (self .notifications ) >= 5 :
526
507
oldest_notification = self .notifications [0 ]
508
+ # Enviar al historial en lugar de marcar como expirada
509
+ self .notch .notification_history .add_notification (oldest_notification )
527
510
self .stack .remove (oldest_notification )
528
511
self .notifications .pop (0 )
529
512
if self .current_index > 0 :
@@ -677,25 +660,3 @@ def close_all_notifications(self, *args):
677
660
notifications_to_close = self .notifications .copy ()
678
661
for notification_box in notifications_to_close :
679
662
notification_box .notification .close ("dismissed-by-user" )
680
-
681
- class HistoryActionButton (Button ):
682
- def __init__ (self , action : NotificationAction , index : int , total : int , hist_box , on_destroy = None ):
683
- super ().__init__ (
684
- name = "action-button" ,
685
- h_expand = True ,
686
- on_clicked = self .on_clicked ,
687
- child = Label (name = "button-label" , label = action .label ),
688
- )
689
- self .action = action
690
- self .hist_box = hist_box
691
- self .on_destroy = on_destroy if on_destroy else lambda : self .hist_box .destroy () # Valor por defecto
692
- style_class = (
693
- "start-action" if index == 0
694
- else "end-action" if index == total - 1
695
- else "middle-action"
696
- )
697
- self .add_style_class (style_class )
698
-
699
- def on_clicked (self , * _ ):
700
- self .action .invoke ()
701
- self .on_destroy ()
0 commit comments