Skip to content

Commit

Permalink
Reload transcriptions and stories when creating new windows
Browse files Browse the repository at this point in the history
  • Loading branch information
octimot committed Feb 16, 2024
1 parent a06aba9 commit 2c8a109
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions storytoolkitai/ui/toolkit_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -12248,6 +12248,9 @@ def open_transcription_window(self, title=None, transcription_file_path=None,
has_menubar=True
):

# reload the transcription object
transcription.reload_from_file(save_first=True)

# add the Transcription object to this window
self.t_edit_obj.set_window_transcription(t_window_id, transcription)

Expand All @@ -12256,6 +12259,14 @@ def open_transcription_window(self, title=None, transcription_file_path=None,
# THE THREE WINDOW COLUMN FRAMES
t_window = self.get_window_by_id(t_window_id)

# if the transcription name is different from the current title, change the title
if transcription.name and transcription.name != title:
# but only if the transcription name is not empty
t_window.title(transcription.name)

# we should also update the main window since the transcription.name is usually displayed there too
self.update_main_window()

# create the left frame
left_frame = ctk.CTkFrame(t_window, name='left_frame', **self.ctk_frame_transparent)
left_frame.grid(row=0, column=0, sticky="ns", **self.ctk_side_frame_button_paddings)
Expand Down Expand Up @@ -16061,6 +16072,17 @@ def open_story_editor_window(self, title=None, story_file_path=None):
# get the window
window = self.get_window_by_id(window_id)

# reload the story object from file just to make sure that we have the latest data
story.reload_from_file(save_first=True)

# if the story name is different from the current title, change the title
if story.name and story.name != title:
# but only if the story name is not empty
window.title(story.name)

# we should also update the main window since the story.name is usually displayed there too
self.update_main_window()

# attach the story object to the window
window.story = story

Expand Down

0 comments on commit 2c8a109

Please sign in to comment.