Skip to content

Commit

Permalink
fix: Properly showing item status after saving the editing.
Browse files Browse the repository at this point in the history
  • Loading branch information
bookfere committed Apr 12, 2024
1 parent a6e4651 commit a69939c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def __init__(self):
@pyqtSlot(str, object)
def show_message(self, message, callback=None):
self.show.emit(message)
time.sleep(0.1)
time.sleep(1)
self.show.emit('')
callback and callback()
self.finished.emit()
Expand Down Expand Up @@ -219,7 +219,7 @@ def translate_paragraphs(self, paragraphs=[], fresh=False):
self.on_working = False
self.finished.emit()
if self.need_close:
time.sleep(1)
time.sleep(0.5)
self.close.emit(0)


Expand Down Expand Up @@ -904,7 +904,10 @@ def auto_open_close_splitter():
layout.addWidget(splitter)
layout.addWidget(control)

def update_translation_status(paragraph):
def update_translation_status(row):
paragraph = self.table.paragraph(row)
if paragraph is None:
return
if not paragraph.translation:
if paragraph.error is not None:
status_indicator.set_color(
Expand All @@ -915,7 +918,7 @@ def update_translation_status(paragraph):
status_indicator.set_color(StatusColor('yellow'))
else:
status_indicator.set_color(StatusColor('green'))
self.paragraph_sig.connect(update_translation_status)
self.table.row.connect(update_translation_status)

def change_selected_item():
if self.trans_worker.on_working:
Expand All @@ -924,6 +927,7 @@ def change_selected_item():
if paragraph is None:
return
self.paragraph_sig.emit(paragraph)
self.table.row.emit(paragraph.row)
self.table.itemSelectionChanged.connect(change_selected_item)
self.table.setCurrentItem(self.table.item(0, 0))
change_selected_item()
Expand Down
2 changes: 1 addition & 1 deletion translations/zh_CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ msgid "CSS selectors to reserve elements. One rule per line:"
msgstr "用来保留元素的 CSS 选择器。一行一条规则:"

msgid "Keep elements that match these rules for extraction."
msgstr "保留抽取元素中匹配这些规则的元素。"
msgstr "保留已抽取元素中匹配这些规则的元素。"

msgid "Ebook Metadata"
msgstr "电子书元数据"
Expand Down

0 comments on commit a69939c

Please sign in to comment.