Skip to content

Commit

Permalink
Added Ingest Metadata to Preferences window
Browse files Browse the repository at this point in the history
  • Loading branch information
octimot committed Feb 20, 2024
1 parent cddc791 commit e5ae0cd
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions storytoolkitai/ui/toolkit_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,11 @@ def open_preferences_window(self, **kwargs):
analysis_form_vars = self.toolkit_UI_obj.add_analysis_form_elements(
ingest_tab_scrollable_frame)

# add the metadata form elements
metadata_form_vars = self.toolkit_UI_obj.add_metadata_form_elements(
ingest_tab_scrollable_frame
)

# add the other ingest form elements
other_ingest_form_vars = self.add_other_ingest_prefs(
ingest_tab_scrollable_frame)
Expand All @@ -266,7 +271,7 @@ def open_preferences_window(self, **kwargs):

# create the giant dictionary that contains all the form variables
form_vars = {**general_prefs_form_vars,
**audio_form_vars, **video_form_vars, **analysis_form_vars,
**audio_form_vars, **video_form_vars, **analysis_form_vars, **metadata_form_vars,
**other_ingest_form_vars, **integrations_form_vars, **search_form_vars,
**assistant_form_vars}

Expand Down Expand Up @@ -1159,21 +1164,12 @@ def save_preferences(self, input_variables: dict) -> bool:
self.stAI.config['transcription_group_questions'] = input_variables['group_questions_var'].get()
del input_variables['group_questions_var']



if input_variables['video_indexing_index_candidate_var'].get() == 'the first frame':
self.stAI.config['video_indexing_index_candidate'] = 'first'
else:
self.stAI.config['video_indexing_index_candidate'] = 'sharp'
del input_variables['video_indexing_index_candidate_var']

# the video sensitivity needs a bit of conversion
# sensitivity = input_variables['clip_shot_change_sensitivity_var'].get()
# del input_variables['clip_shot_change_sensitivity_var']

# the sensitivity is between 0 and 100, but the encoder expects a value between 255 (lowest) and 0 (highest)
# self.stAI.config['clip_shot_change_sensitivity'] = 255 - int(sensitivity * 255 / 100)

# SAVE THE VARIABLES FROM HERE ON

# save all the variables to the config file
Expand All @@ -1197,7 +1193,6 @@ def save_preferences(self, input_variables: dict) -> bool:
message_log='Preferences saved, need restart for full effect',
parent=self.toolkit_UI_obj.get_window_by_id('preferences'))


# close the window
self.toolkit_UI_obj.destroy_window_(window_id='preferences')
return True
Expand All @@ -1213,21 +1208,21 @@ def save_preferences(self, input_variables: dict) -> bool:

def open_about_window(self):
"""
Open the about window
Open the "about window"
:return:
"""

# open the about window
# open the "about" window"

# create a window for the about window if one doesn't already exist
# create a window for the "about window" if one doesn't already exist
if about_window := self.toolkit_UI_obj.create_or_open_window(parent_element=self.root,
window_id='about',
title='About StoryToolkitAI', resizable=False,
return_window=True):
# the text justify
justify = {'justify': ctk.LEFT}

# create a frame for the about window
# create a frame for the "about window"
about_frame = ctk.CTkFrame(about_window, **toolkit_UI.ctk_frame_transparent)
about_frame.pack(**toolkit_UI.ctk_full_window_frame_paddings)

Expand Down Expand Up @@ -7020,7 +7015,7 @@ def add_metadata_form_elements(self, parent: tk.Widget, **kwargs) -> dict or Non
ingest_link_to_project_label.grid(row=1, column=0, sticky="w", **self.ctk_form_paddings)
ingest_link_to_project_input.grid(row=1, column=1, sticky="w", **self.ctk_form_paddings)

if not self.current_project:
if not self.current_project and kwargs.get('ingest_window_id', None):
ingest_link_to_project_label.grid_forget()
ingest_link_to_project_input.grid_forget()

Expand All @@ -7046,6 +7041,10 @@ def ingesting_multiple_files():
- None if there's no file_path_var
"""

# we're not doing this if we don't have an ingest_window_id
if not kwargs.get('ingest_window_id', None):
return True

if file_path_var:
# get the file path from the file_path_var
file_path_str = file_path_var.get()
Expand Down

0 comments on commit e5ae0cd

Please sign in to comment.