Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Commit

Permalink
v3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
xayam authored Sep 17, 2023
1 parent 1e057b0 commit 8a71888
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 20 deletions.
14 changes: 7 additions & 7 deletions src/controller/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def left_listbox_onselect(self, evt):
self.current_select = text
self.current_dir = "../data/" + text + "/"

self.pause_len = float(self.app.options[POSITIONS][self.current_select][POSI].split("\n")[0])
self.pause_len = float(self.app.option[POSITIONS][self.current_select][POSI].split("\n")[0])

self.app.pre_load()
self.app.show_view()
Expand All @@ -58,13 +58,13 @@ def annotation_click(self, event):
index = self.app.annotation_text_area_other.index("current")
txt = self.app.book_other
self.app.root.update()
if self.app.options[POSITIONS][self.app.current_select][AUDIO] == EN:
self.app.options[POSITIONS][self.app.current_select][AUDIO] = RU
if self.app.option[POSITIONS][self.app.current_select][AUDIO] == EN:
self.app.option[POSITIONS][self.app.current_select][AUDIO] = RU
self.app.russian_click()
else:
self.app.options[POSITIONS][self.app.current_select][AUDIO] = EN
self.app.option[POSITIONS][self.app.current_select][AUDIO] = EN
self.app.english_click()
if self.app.options[POSITIONS][self.app.current_select][AUDIO] == EN:
if self.app.option[POSITIONS][self.app.current_select][AUDIO] == EN:
curr = R_POS
curr_other = L_POS
self.app.sync_other = self.app.rus_sync
Expand Down Expand Up @@ -112,8 +112,8 @@ def scroll_other(self):
self.app.annotation_text_area_other.tag_remove("start", "1.0", "end")
self.app.annotation_text_area_other.tag_add("start", f"1.0", f"{count_lines}.{count_chars}")
self.app.annotation_text_area_other.tag_config("start",
background=self.app.options[SEL],
foreground=self.app.options[FG])
background=self.app.option[SEL],
foreground=self.app.option[FG])
self.centered_insert(center=True)

def centered_insert(self, center=False):
Expand Down
10 changes: 6 additions & 4 deletions src/controller/createsync.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,13 @@
for d in del_me:
if os.path.exists(d):
os.remove(d)
recognizer_eng = recognizer.RecognizerClass(model_path=f"../eng",
output=f"{data}/{book}", language="eng")
recognizer_eng = recognizer.RecognizerClass(model_path=f"../../recognize/eng",
output=f"{data}/{book}",
language="eng", config=config)
recognizer_eng.create_map()
recognizer_rus = recognizer.RecognizerClass(model_path=f"../rus",
output=f"{data}/{book}", language="rus")
recognizer_rus = recognizer.RecognizerClass(model_path=f"../../recognize/rus",
output=f"{data}/{book}",
language="rus", config=config)
recognizer_rus.create_map()

if not os.path.exists(f"{data}/{book}/{config.RUS_SYNC}"):
Expand Down
10 changes: 5 additions & 5 deletions src/controller/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def language_click(self, textarea, flac):
self.app.pause()
self.app.statusbar_label1.configure(
text=STATUS_AUDIO[self.app.locale] + ": " +
self.app.options[POSITIONS][self.app.current_select][AUDIO])
self.app.option[POSITIONS][self.app.current_select][AUDIO])
self.app.annotation_text_area1.tag_remove("start", "1.0", "end")
self.app.annotation_text_area2.tag_remove("start", "1.0", "end")
pygame.mixer.music.load(flac)
Expand All @@ -81,7 +81,7 @@ def play_timer(self):
return
self.app.annotation_text_area1.tag_remove("start", "1.0", "end")
self.app.annotation_text_area2.tag_remove("start", "1.0", "end")
if self.app.options[POSITIONS][self.app.current_select][AUDIO] == EN:
if self.app.option[POSITIONS][self.app.current_select][AUDIO] == EN:
curr = R_POS
curr_other = L_POS
self.app.annotation_text_area = self.app.annotation_text_area1
Expand Down Expand Up @@ -116,8 +116,8 @@ def play_timer(self):
self.app.annotation_text_area.mark_set("insert", f"{count_lines}.{count_chars}")
self.app.annotation_text_area.tag_add("start", f"1.0", f"{count_lines}.{count_chars}")
self.app.annotation_text_area.tag_config("start",
background=self.app.options[SEL],
foreground=self.app.options[FG])
background=self.app.option[SEL],
foreground=self.app.option[FG])
if self.app.flag_pause:
self.app.annotation_text_area.see("insert")
self.app.centered_insert()
Expand All @@ -137,7 +137,7 @@ def play_timer(self):
text=STATUS_POSITION[self.app.locale] + ": " +
self.app.annotation_text_area1.index("current") + "/" +
self.app.annotation_text_area2.index("current"))
self.app.options[POSITIONS][self.app.current_select][POSI] = \
self.app.option[POSITIONS][self.app.current_select][POSI] = \
str(self.app.pause_len + pygame.mixer.music.get_pos()) + \
"\n" + f"{count_lines}.{count_chars}" + \
"\n" + str(self.app.start)
Expand Down
2 changes: 1 addition & 1 deletion src/controller/realization.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def menu_service_language(self, event=None):
if self.app.locale == event:
return
self.app.set_locale(event)
self.app.options[LOCALE] = self.app.locale
self.app.option[LOCALE] = self.app.locale
self.app.save_options()
showinfo(MENU_SERVICE[self.app.locale], MENU_SERVICE_RESTART[self.app.locale])
os.execv(sys.executable, [sys.executable, __file__] + sys.argv)
Expand Down
10 changes: 7 additions & 3 deletions src/controller/recognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@


class RecognizerClass:
def __init__(self, model_path, output, language):
def __init__(self, model_path, output, language, config):
self.language = language
self.MAPJSON = f"{output}/{language}.map.json"
self.WAV = f"{output}/{language}.wav"
if self.language == "rus":
self.MAPJSON = f"{output}/{config.RUS_MAP}"
self.WAV = f"{output}/{config.RUS_WAV}"
else:
self.MAPJSON = f"{output}/{config.ENG_MAP}"
self.WAV = f"{output}/{config.ENG_WAV}"
self.MODEL_PATH = model_path

def create_map(self):
Expand Down

0 comments on commit 8a71888

Please sign in to comment.