Skip to content

Commit 645b558

Browse files
author
Tolkachev Aleksei
committed
menu highlight in manual mode
1 parent 94d42df commit 645b558

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

app/ui/dayu_widgets/push_button.py

+5
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,8 @@ def tiny(self):
137137
"""Set MPushButton to tiny size"""
138138
self.set_dayu_size(dayu_theme.tiny)
139139
return self
140+
141+
def default(self):
142+
"""Set MPushButton to DefaultType"""
143+
self.set_dayu_type(MPushButton.DefaultType)
144+
return self

comic.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,8 @@ def block_detect(self, load_rects: bool = True):
325325
self.disable_hbutton_group()
326326
self.run_threaded(self.pipeline.detect_blocks, self.pipeline.on_blk_detect_complete,
327327
self.default_error_handler, self.on_manual_finished, load_rects)
328-
328+
self.menu_highlight(0)
329+
329330
def clear_text_edits(self):
330331
self.current_text_block = None
331332
self.current_text_block_item = None
@@ -346,6 +347,7 @@ def ocr(self):
346347
self.loading.setVisible(True)
347348
self.disable_hbutton_group()
348349
self.run_threaded(self.pipeline.OCR_image, None, self.default_error_handler, self.finish_ocr_translate)
350+
self.menu_highlight(1)
349351

350352
def translate_image(self):
351353
source_lang = self.s_combo.currentText()
@@ -355,6 +357,7 @@ def translate_image(self):
355357
self.loading.setVisible(True)
356358
self.disable_hbutton_group()
357359
self.run_threaded(self.pipeline.translate_image, None, self.default_error_handler, self.finish_ocr_translate)
360+
self.menu_highlight(2)
358361

359362
def inpaint_and_set(self):
360363
if self.image_viewer.hasPhoto() and self.image_viewer.has_drawn_elements():
@@ -363,6 +366,7 @@ def inpaint_and_set(self):
363366
self.disable_hbutton_group()
364367
self.run_threaded(self.pipeline.inpaint, self.pipeline.inpaint_complete,
365368
self.default_error_handler, self.on_manual_finished)
369+
self.menu_highlight(4)
366370

367371
def load_images_threaded(self, file_paths: List[str]):
368372
self.file_handler.file_paths = file_paths
@@ -418,6 +422,12 @@ def on_images_loaded(self, loaded_images: List[Tuple[str, np.ndarray]]):
418422
self.image_viewer.resetTransform()
419423
self.image_viewer.fitInView()
420424

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+
421431
def update_image_cards(self):
422432
# Clear existing cards
423433
for i in reversed(range(self.image_card_layout.count())):
@@ -529,7 +539,7 @@ def load_segmentation_points(self):
529539
self.image_viewer.draw_segmentation_lines(bboxes)
530540

531541
self.enable_hbutton_group()
532-
542+
self.menu_highlight(3)
533543
else:
534544
self.loading.setVisible(True)
535545
self.disable_hbutton_group()
@@ -700,6 +710,7 @@ def render_text(self):
700710
self.run_threaded(manual_wrap, self.on_render_complete, self.default_error_handler,
701711
None, self, self.blk_list, font_family, line_spacing, outline_width,
702712
bold, italic, underline, max_font_size, min_font_size)
713+
self.menu_highlight(5)
703714

704715
def handle_rectangle_change(self, new_rect: QtCore.QRectF):
705716
# Find the corresponding TextBlock in blk_list

0 commit comments

Comments
 (0)