Update Uptated-Prototype/PiperTTS-GUI-Test.py
Small Exception updates
This commit is contained in:
@@ -31,10 +31,13 @@ style.configure("My.TLabel", foreground="white", background="#404040")
|
||||
try:
|
||||
with open("voices/voices.json","r") as file:
|
||||
data = json.load(file)
|
||||
print("Loop!")
|
||||
# Failed at loading voices.json
|
||||
except FileNotFoundError:
|
||||
print("Error: The file 'voises.json' was not found.")
|
||||
print("Exception: The file 'voices/voices.json' was not found.")
|
||||
except Exception as e:
|
||||
print(f"An Exception has occurred - when attempting to load - 'voices/voices.json'\nException: {e}\nClass: {type(e)}")
|
||||
else:
|
||||
print("The file 'voices/voices.json' was loaded successfully!")
|
||||
|
||||
# Create a list for Languages
|
||||
mylist = ["Languages"]
|
||||
@@ -60,20 +63,17 @@ mylist_String_Three = StringVar(value = "Quality")
|
||||
try:
|
||||
Input_Box_Frame = ttk.Frame(Root_Window)
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when creating input Frame.")
|
||||
print(f"An exception occurred - when creating input Frame.\nException: {e}\nClass: {type(e)}")
|
||||
# Attempts to create a Controls Frame
|
||||
try:
|
||||
Controls_Box_Frame = ttk.Frame(Root_Window, style="My.TLabel")
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when creating Controls Frame.")
|
||||
print(f"An exception occurred - when creating Controls Frame.\nException: {e}\nClass: {type(e)}")
|
||||
# Attempts to create a Prefrences Frame
|
||||
try:
|
||||
Prefrences_Frame = ttk.Frame(Root_Window)
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when creating Controls Frame.")
|
||||
print(f"An exception occurred - when creating Prefrence Frame.\nException: {e}\nClass: {type(e)}")
|
||||
# Attempts to Place Input and Controls frames
|
||||
try:
|
||||
#Input_Box_Frame.place(x = 0, y = 0, relwidth = 1, relheight = 0.7)
|
||||
@@ -81,8 +81,7 @@ try:
|
||||
Input_Box_Frame.pack(fill = "both", expand = True, anchor = "center")
|
||||
Controls_Box_Frame.pack(expand = True, anchor = "center")
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when placing Frames.")
|
||||
print(f"An exception occurred - when placing Frames.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
# Attempts to create a Input box
|
||||
try:
|
||||
@@ -90,8 +89,7 @@ try:
|
||||
#Input_Box.pack(padx=5, pady=5, expand = True, fill = "both")
|
||||
Input_Box.pack(side = "left", padx=5, pady=5, expand = True, fill = "both")
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when creating input box.")
|
||||
print(f"An exception occurred - when creating input box.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
# Attempts to create a scrollbar for the Input box
|
||||
try:
|
||||
@@ -101,8 +99,7 @@ try:
|
||||
Main_Text_Scrollbar.pack(side = "left", fill = "y")
|
||||
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when creating a scroll bar.")
|
||||
print(f"An exception occurred - when creating a scroll bar.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Play():
|
||||
@@ -111,8 +108,7 @@ def PiperTTS_GUI_Play():
|
||||
C_Button_Pause["state"] == "normal"
|
||||
C_Button_Play["state"] = "disabled"
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Play Button.")
|
||||
print(f"An exception occurred - when pressing Play Button.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Pause():
|
||||
@@ -121,8 +117,7 @@ def PiperTTS_GUI_Pause():
|
||||
C_Button_Pause["state"] == "disabled"
|
||||
C_Button_Play["state"] = "normal"
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Pause Button.")
|
||||
print(f"An exception occurred - when pressing Pause Button.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Stop():
|
||||
@@ -131,24 +126,21 @@ def PiperTTS_GUI_Stop():
|
||||
C_Button_Pause["state"] == "disabled"
|
||||
C_Button_Play["state"] = "normal"
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Stop Button.")
|
||||
print(f"An exception occurred - when pressing Stop Button.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Previous():
|
||||
try:
|
||||
My_Test_Label["text"] = "Previous?"
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Previous Button.")
|
||||
print(f"An exception occurred - when pressing Previous Button.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Next():
|
||||
try:
|
||||
My_Test_Label["text"] = "Next?"
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing Next Button.")
|
||||
print(f"An exception occurred - when pressing Next Button.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_New_File():
|
||||
@@ -156,8 +148,7 @@ def PiperTTS_GUI_New_File():
|
||||
My_Test_Label["text"] = "New File?"
|
||||
Input_Box.delete("1.0", "end-1c")
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when pressing New File Button.")
|
||||
print(f"An exception occurred - when pressing New File Button.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Get_Selection():
|
||||
@@ -169,8 +160,7 @@ def PiperTTS_GUI_Get_Selection():
|
||||
Cursor_Position = Input_Box.index(INSERT)
|
||||
Input_Box.insert(Cursor_Position, Selected)
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when grabbing Selection.")
|
||||
print(f"An exception occurred - when grabbing Selection.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
#
|
||||
def PiperTTS_GUI_Get_Clipboard():
|
||||
@@ -182,8 +172,7 @@ def PiperTTS_GUI_Get_Clipboard():
|
||||
Cursor_Position = Input_Box.index(INSERT)
|
||||
Input_Box.insert(Cursor_Position, Selected)
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when grabbing Clipboard.")
|
||||
print(f"An exception occurred - when grabbing Clipboard.\nException: {e}\nClass: {type(e)}")
|
||||
#
|
||||
def PiperTTS_GUI_TextFile_Open():
|
||||
try:
|
||||
@@ -199,8 +188,7 @@ def PiperTTS_GUI_TextFile_Open():
|
||||
else:
|
||||
print("Canceled file dialog.")
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when Opening Text File.")
|
||||
print(f"An exception occurred - when Opening Text File.\nException: {e}\nClass: {type(e)}")
|
||||
#
|
||||
def PiperTTS_GUI_Reverse_Text():
|
||||
try:
|
||||
@@ -208,8 +196,7 @@ def PiperTTS_GUI_Reverse_Text():
|
||||
Input_Box.delete("1.0", "end-1c")
|
||||
Input_Box.insert("1.0", TempText[::-1])
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when reversing text.")
|
||||
print(f"An exception occurred - when reversing text.\nException: {e}\nClass: {type(e)}")
|
||||
#
|
||||
def PiperTTS_GUI_Randomize_Text():
|
||||
try:
|
||||
@@ -222,8 +209,7 @@ def PiperTTS_GUI_Randomize_Text():
|
||||
end_time = time.time()
|
||||
print(f'Elapsed Time: {end_time - start_time} seconds')
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when Randomizing text.")
|
||||
print(f"An exception occurred - when Randomizing text.\nException: {e}\nClass: {type(e)}")
|
||||
#
|
||||
def PiperTTS_GUI_Randomize_Text_2nd():
|
||||
try:
|
||||
@@ -234,8 +220,7 @@ def PiperTTS_GUI_Randomize_Text_2nd():
|
||||
end_time = time.time()
|
||||
print(f'Elapsed Time: {end_time - start_time} seconds')
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when Randomizing text.")
|
||||
print(f"An exception occurred - when Randomizing text.\nException: {e}\nClass: {type(e)}")
|
||||
#
|
||||
def PiperTTS_GUI_Set_Prefrences():
|
||||
try:
|
||||
@@ -244,7 +229,7 @@ def PiperTTS_GUI_Set_Prefrences():
|
||||
Input_Box_Frame.pack(fill = "both", expand = True)
|
||||
Controls_Box_Frame.pack(fill = "both")
|
||||
print("An if occurred - when Setting prefrences.")
|
||||
print(f"{Prefrences_Frame.winfo_ismapped()}")
|
||||
print(f"Is Mapped: {Prefrences_Frame.winfo_ismapped()}")
|
||||
else:
|
||||
#Input_Box_Frame.place_forget()
|
||||
#Controls_Box_Frame.place_forget()
|
||||
@@ -253,10 +238,9 @@ def PiperTTS_GUI_Set_Prefrences():
|
||||
#Prefrences_Frame.place(x = 0, y = 0, relwidth = 1, relheight = 1)
|
||||
Prefrences_Frame.pack(fill = "both", expand = True)
|
||||
print("An if occurred - when Setting prefrences.")
|
||||
print(f"{Prefrences_Frame.winfo_ismapped()}")
|
||||
print(f"Is Mapped: {Prefrences_Frame.winfo_ismapped()}")
|
||||
except Exception as e:
|
||||
print(e, type(e))
|
||||
print("An exception occurred - when Setting prefrences.")
|
||||
print(f"An exception occurred - when Setting prefrences.\nException: {e}\nClass: {type(e)}")
|
||||
|
||||
#
|
||||
def Select_Voice_For_Language(Mylanguages):
|
||||
|
||||
Reference in New Issue
Block a user