@@ -325,7 +325,8 @@ def block_detect(self, load_rects: bool = True):
325
325
self .disable_hbutton_group ()
326
326
self .run_threaded (self .pipeline .detect_blocks , self .pipeline .on_blk_detect_complete ,
327
327
self .default_error_handler , self .on_manual_finished , load_rects )
328
-
328
+ self .menu_highlight (0 )
329
+
329
330
def clear_text_edits (self ):
330
331
self .current_text_block = None
331
332
self .current_text_block_item = None
@@ -346,6 +347,7 @@ def ocr(self):
346
347
self .loading .setVisible (True )
347
348
self .disable_hbutton_group ()
348
349
self .run_threaded (self .pipeline .OCR_image , None , self .default_error_handler , self .finish_ocr_translate )
350
+ self .menu_highlight (1 )
349
351
350
352
def translate_image (self ):
351
353
source_lang = self .s_combo .currentText ()
@@ -355,6 +357,7 @@ def translate_image(self):
355
357
self .loading .setVisible (True )
356
358
self .disable_hbutton_group ()
357
359
self .run_threaded (self .pipeline .translate_image , None , self .default_error_handler , self .finish_ocr_translate )
360
+ self .menu_highlight (2 )
358
361
359
362
def inpaint_and_set (self ):
360
363
if self .image_viewer .hasPhoto () and self .image_viewer .has_drawn_elements ():
@@ -363,6 +366,7 @@ def inpaint_and_set(self):
363
366
self .disable_hbutton_group ()
364
367
self .run_threaded (self .pipeline .inpaint , self .pipeline .inpaint_complete ,
365
368
self .default_error_handler , self .on_manual_finished )
369
+ self .menu_highlight (4 )
366
370
367
371
def load_images_threaded (self , file_paths : List [str ]):
368
372
self .file_handler .file_paths = file_paths
@@ -418,6 +422,12 @@ def on_images_loaded(self, loaded_images: List[Tuple[str, np.ndarray]]):
418
422
self .image_viewer .resetTransform ()
419
423
self .image_viewer .fitInView ()
420
424
425
+ for button in self .hbutton_group .get_button_group ().buttons ():
426
+ button .default ()
427
+
428
+ def menu_highlight (self , button_index : int ):
429
+ self .hbutton_group .get_button_group ().buttons ()[button_index ].success ()
430
+
421
431
def update_image_cards (self ):
422
432
# Clear existing cards
423
433
for i in reversed (range (self .image_card_layout .count ())):
@@ -529,7 +539,7 @@ def load_segmentation_points(self):
529
539
self .image_viewer .draw_segmentation_lines (bboxes )
530
540
531
541
self .enable_hbutton_group ()
532
-
542
+ self . menu_highlight ( 3 )
533
543
else :
534
544
self .loading .setVisible (True )
535
545
self .disable_hbutton_group ()
@@ -700,6 +710,7 @@ def render_text(self):
700
710
self .run_threaded (manual_wrap , self .on_render_complete , self .default_error_handler ,
701
711
None , self , self .blk_list , font_family , line_spacing , outline_width ,
702
712
bold , italic , underline , max_font_size , min_font_size )
713
+ self .menu_highlight (5 )
703
714
704
715
def handle_rectangle_change (self , new_rect : QtCore .QRectF ):
705
716
# Find the corresponding TextBlock in blk_list
0 commit comments