Implemented Resolution Type option

This commit is contained in:
Dilan Boskan
2021-01-14 15:35:24 +01:00
parent fe4c0073d3
commit aa5bd6891b
3 changed files with 32 additions and 11 deletions

View File

@@ -61,6 +61,7 @@ DEFAULT_DATA = {
'modelInstrumentalLabel': '',
'modelStackedLabel': '',
'aiModel': 'v4',
'resType': 'Kaiser Fast',
'useModel': 'instrumental',
'lastDir': None,
@@ -240,15 +241,15 @@ class MainWindow(TkinterDnD.Tk):
# Layout
IMAGE_HEIGHT = 140
FILEPATHS_HEIGHT = 90
OPTIONS_HEIGHT = 240
OPTIONS_HEIGHT = 285
CONVERSIONBUTTON_HEIGHT = 35
COMMAND_HEIGHT = 200
PROGRESS_HEIGHT = 26
PADDING = 10
COL1_ROWS = 8
COL2_ROWS = 7
COL3_ROWS = 5
COL1_ROWS = 9
COL2_ROWS = 8.1
COL3_ROWS = 5.5
def __init__(self):
# Run the __init__ method on the tk.Tk class
@@ -307,6 +308,7 @@ class MainWindow(TkinterDnD.Tk):
self.nfft_var = tk.StringVar(value=data['n_fft'])
# AI model
self.aiModel_var = tk.StringVar(value=data['aiModel'])
self.resType_var = tk.StringVar(value=data['resType'])
self.last_aiModel = self.aiModel_var.get()
# Other
self.inputPathsEntry_var = tk.StringVar(value='')
@@ -398,7 +400,6 @@ class MainWindow(TkinterDnD.Tk):
text='Save to',
command=self.open_export_filedialog)
self.filePaths_saveTo_Entry = ttk.Entry(master=self.filePaths_Frame,
textvariable=self.exportPath_var,
state=tk.DISABLED
)
@@ -492,6 +493,13 @@ class MainWindow(TkinterDnD.Tk):
self.options_nfft_Label = tk.Label(master=self.options_Frame,
text='N_FFT', anchor=tk.W,
background='#63605f', font=self.font, foreground='white', relief="sunken")
# Resolution Type
self.options_resType_Label = tk.Label(master=self.options_Frame,
text='Resolution Type', anchor=tk.CENTER,
background='#63605f', font=self.font, foreground='white', relief="sunken")
self.options_resType_Optionmenu = ttk.OptionMenu(self.options_Frame,
self.resType_var,
None, 'Kaiser Fast', 'Kaiser Best', 'Scipy')
# AI model
self.options_aiModel_Label = tk.Label(master=self.options_Frame,
text='Choose AI Engine', anchor=tk.CENTER,
@@ -563,11 +571,16 @@ class MainWindow(TkinterDnD.Tk):
relx=1/3, rely=3/self.COL2_ROWS, relwidth=1/3/2, relheight=1/self.COL2_ROWS)
self.options_nfft_Entry.place(x=15, y=4, width=5, height=-8,
relx=1/3 + 1/3/2, rely=3/self.COL2_ROWS, relwidth=1/3/4, relheight=1/self.COL2_ROWS)
# Resolution Type
self.options_resType_Label.place(x=5, y=8, width=-30, height=-8,
relx=1/3, rely=4/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
self.options_resType_Optionmenu.place(x=5, y=8, width=-30, height=-8,
relx=1/3, rely=5/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
# AI model
self.options_aiModel_Label.place(x=5, y=-5, width=-30, height=-8,
relx=1/3, rely=5/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
self.options_aiModel_Optionmenu.place(x=5, y=-5, width=-30, height=-8,
relx=1/3, rely=6/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
self.options_aiModel_Label.place(x=5, y=8, width=-30, height=-8,
relx=1/3, rely=6/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
self.options_aiModel_Optionmenu.place(x=5, y=8, width=-30, height=-8,
relx=1/3, rely=7/self.COL2_ROWS, relwidth=1/3, relheight=1/self.COL2_ROWS)
# -Column 3-
# Choose Model
@@ -641,6 +654,7 @@ class MainWindow(TkinterDnD.Tk):
input_paths = self.inputPaths
instrumentalModel_path = self.instrumentalLabel_to_path[self.instrumentalModel_var.get()] # nopep8
stackedModel_path = self.stackedLabel_to_path[self.stackedModel_var.get()] # nopep8
resType = self.resType_var.get().lower().replace(' ', '_')
# Get constants
instrumental = get_model_values(self.instrumentalModel_var.get())
stacked = get_model_values(self.stackedModel_var.get())
@@ -728,6 +742,8 @@ class MainWindow(TkinterDnD.Tk):
'hop_length': hop_length,
'window_size': window_size,
'n_fft': n_fft, # not needed for v2
# Resolution Type
'resType': resType,
# Other Variables (Tkinter)
'window': self,
'text_widget': self.command_Text,
@@ -976,6 +992,7 @@ class MainWindow(TkinterDnD.Tk):
'modelInstrumentalLabel': self.instrumentalModel_var.get(),
'modelStackedLabel': self.stackedModel_var.get(),
'aiModel': self.aiModel_var.get(),
'resType': self.resType_var.get(),
})
self.destroy()