From 651653e4f1ce160770dfed8778dbcdbc30e73db2 Mon Sep 17 00:00:00 2001 From: Augustin Date: Wed, 1 Nov 2023 14:54:00 +0800 Subject: [PATCH 1/2] fix: kana vocabulary lesson display --- hebikani/hebikani.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hebikani/hebikani.py b/hebikani/hebikani.py index 136865b..3a147b0 100755 --- a/hebikani/hebikani.py +++ b/hebikani/hebikani.py @@ -1391,7 +1391,7 @@ def ask_answer(self, question: Question): Returns: AnswerType: The answer type. """ - prompt = f"{question.subject.object} - {question.question_type}: " + prompt = f"{question.subject.object.replace('_', ' ')} - {question.question_type}: " # Display the number of answers for the question in hard mode. # Some kanji require multiple answers while their vocabulary only need one. @@ -1488,7 +1488,7 @@ def lesson_interface(self, subject: Subject): tab_index = 0 while True: clear_terminal() - print(f"{subject.object.capitalize()}:\n\n{subject.characters}\n") + print(f"{subject.object.capitalize().replace('_', ' ')}:\n\n{subject.characters}\n") tabs = ["composition", "meaning", "reading", "context"] if ( subject.object == SubjectObject.VOCABULARY @@ -1500,6 +1500,8 @@ def lesson_interface(self, subject: Subject): tabs = ["meaning"] elif subject.object == SubjectObject.KANJI: tabs = ["composition", "meaning", "reading"] + elif subject.object == SubjectObject.KANA_VOCABULARY: + tabs = ["meaning"] print(self.beautify_tabs_display(tabs, tab_index)) print("\n") @@ -1538,7 +1540,7 @@ def tab_composition(self, subject: Subject) -> str: if subject.component_subject_ids: subjects = self.client._subject_per_ids(subject.component_subject_ids) res = ( - f"This {subject.object} is made of {len(subjects)} {subjects[0].object}" + f"This {subject.object.replace('_', ' ')} is made of {len(subjects)} {subjects[0].object}" + ":\n" + "\n".join( f"- {s.characters}: {s.meanings.primary.value}" for s in subjects From f4305777a8dc7abf40f38b0b3b0a1ea1e3626db7 Mon Sep 17 00:00:00 2001 From: Augustin Date: Wed, 1 Nov 2023 14:58:46 +0800 Subject: [PATCH 2/2] ci: black --- hebikani/hebikani.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/hebikani/hebikani.py b/hebikani/hebikani.py index 3a147b0..bc346d2 100755 --- a/hebikani/hebikani.py +++ b/hebikani/hebikani.py @@ -1391,7 +1391,9 @@ def ask_answer(self, question: Question): Returns: AnswerType: The answer type. """ - prompt = f"{question.subject.object.replace('_', ' ')} - {question.question_type}: " + prompt = ( + f"{question.subject.object.replace('_', ' ')} - {question.question_type}: " + ) # Display the number of answers for the question in hard mode. # Some kanji require multiple answers while their vocabulary only need one. @@ -1488,7 +1490,10 @@ def lesson_interface(self, subject: Subject): tab_index = 0 while True: clear_terminal() - print(f"{subject.object.capitalize().replace('_', ' ')}:\n\n{subject.characters}\n") + print( + f"{subject.object.capitalize().replace('_', ' ')}:" + f"\n\n{subject.characters}\n" + ) tabs = ["composition", "meaning", "reading", "context"] if ( subject.object == SubjectObject.VOCABULARY @@ -1540,7 +1545,8 @@ def tab_composition(self, subject: Subject) -> str: if subject.component_subject_ids: subjects = self.client._subject_per_ids(subject.component_subject_ids) res = ( - f"This {subject.object.replace('_', ' ')} is made of {len(subjects)} {subjects[0].object}" + f"This {subject.object.replace('_', ' ')} is made of " + + f"{len(subjects)} {subjects[0].object}" + ":\n" + "\n".join( f"- {s.characters}: {s.meanings.primary.value}" for s in subjects