@@ -394,9 +394,11 @@ def analyze_move(self, num_move, num_variation, num_move_variation):
394394 )
395395
396396 def remove_line (self ):
397- if QTUtil2 .pregunta (self , _ ("Are you sure you want to delete this line?" )):
398- li_variation_move = self .selected_link .split ("|" )
399- num_line = int (li_variation_move [- 2 ])
397+ li_variation_move = self .selected_link .split ("|" )
398+ num_line = int (li_variation_move [- 2 ])
399+ game : Game .Game = self .move .variations .li_variations [num_line ]
400+ pgn = game .pgn_base_raw (translated = True )
401+ if QTUtil2 .pregunta (self , pgn + "<br><br>" + _ ("Are you sure you want to delete this line?" )):
400402
401403 li_variation_move = li_variation_move [:- 2 ]
402404 selected_link = "|" .join (li_variation_move )
@@ -493,17 +495,21 @@ def mostrar(self):
493495 num_variation = int (self .selected_link .split ("|" )[1 ])
494496 self .em .ensure_visible (num_variation )
495497
496- def select (self ):
498+ def select (self , with_all ):
497499 li_variations = self .li_variations ()
498500 n_variations = len (li_variations )
499501 if n_variations == 0 :
500502 return None
501503 if n_variations == 1 :
502504 return 0
503505 menu = QTVarios .LCMenuRondo (self )
506+ menu .opcion (None , _ ("Remove" ))
504507 for num , variante in enumerate (li_variations ):
505508 move = variante .move (0 )
506509 menu .opcion (num , move .pgn_translated ())
510+ if with_all :
511+ menu .separador ()
512+ menu .opcion (- 1 , _ ("All variations" ))
507513 return menu .lanza ()
508514
509515 def edit (self , number , with_engine_active = False ):
@@ -544,13 +550,25 @@ def tb_mas_variation_r(self):
544550 self .edit (- 1 , True )
545551
546552 def tb_edit_variation (self ):
547- num = self .select ()
553+ num = self .select (False )
548554 if num is not None :
549555 self .edit (num )
550556
551557 def tb_remove_variation (self ):
552- num = self .select ()
553- if num is not None :
554- self .move .variations .remove (num )
555- self .mostrar ()
556- self .get_manager ().refresh_pgn ()
558+ num = self .select (True )
559+ if num is None :
560+ return
561+ elif num == - 1 :
562+ pregunta = _ ("Remove" ) + ":<br><br> " + _ ("All variations" ) + "<br><br>" + _ ("Are you sure?" )
563+ if QTUtil2 .pregunta (self , pregunta ):
564+ self .move .variations .clear ()
565+ self .mostrar ()
566+ self .get_manager ().refresh_pgn ()
567+
568+ else :
569+ game : Game .Game = self .move .variations .li_variations [num ]
570+ pgn = game .pgn_base_raw (translated = True )
571+ if QTUtil2 .pregunta (self , pgn + "<br><br>" + _ ("Are you sure you want to delete this line?" )):
572+ self .move .variations .remove (num )
573+ self .mostrar ()
574+ self .get_manager ().refresh_pgn ()
0 commit comments