Skip to content

Commit

Permalink
small bugfix (unbound variable)
Browse files Browse the repository at this point in the history
some comments/tidying up
  • Loading branch information
seidnerj committed Dec 12, 2024
1 parent 209724a commit c271c3d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,7 +963,8 @@ def layout_review(self):
translation_text.ensureCursorVisible)

def refresh_translation(paragraph):
# TODO: how can this happen and what should we do in case it does?

# TODO: check - why/how can "paragraph" be None and what should we do in such case?
if paragraph is not None:
raw_text.setPlainText(paragraph.raw.strip())
original_text.setPlainText(paragraph.original.strip())
Expand Down Expand Up @@ -1075,20 +1076,25 @@ def modify_translation():
if self.trans_worker.on_working and \
self.table.selected_count() > 1:
return

paragraph = self.table.current_paragraph()

# TODO: check - why/how can "paragraph" be None and what should we do in such case?
if paragraph is not None:
translation = translation_text.toPlainText()
save_button.setDisabled(
translation == (paragraph.translation or ''))

translation_text.textChanged.connect(modify_translation)

self.editor_worker.show.connect(save_status.setText)

def save_translation():
# TODO: how can this happen and what should we do in case it does?
paragraph = self.table.current_paragraph()

# TODO: check - why/how can "paragraph" be None and what should we do in such case?
if paragraph is not None:
save_button.setDisabled(True)
paragraph = self.table.current_paragraph()
translation = translation_text.toPlainText()
paragraph.translation = translation
paragraph.engine_name = self.current_engine.name
Expand Down

0 comments on commit c271c3d

Please sign in to comment.