3434 buttons_active ,
3535 is_reaper_run ,
3636 show_help_window ,
37+ set_geometry ,
3738)
3839from help_texts import HELP_DICT
3940from tkinter import ttk
@@ -83,7 +84,7 @@ def reaper_main(
8384 BUTTONS : List
8485 ) -> None :
8586 """Основная функция"""
86- save_options (checkboxes )
87+ save_options (master , checkboxes )
8788 project_path = load_path ('project_path' )
8889 if not project_path :
8990 path_choice ('project_path' )
@@ -116,7 +117,7 @@ def reaper_main(
116117 if get_option ('split' ):
117118 split (project )
118119 project .save (False )
119- if get_option ('normalize ' ):
120+ if get_option ('normalize_dubbers' ) and get_option ( 'normalize_video ' ):
120121 normalize (project , 'all' )
121122 if get_option ('normalize_dubbers' ):
122123 normalize (project , 'dubbers' )
@@ -135,8 +136,15 @@ def reaper_main(
135136 master .focus_force ()
136137
137138
138- def on_start_click (checkboxes : Dict , master : tkinter .Tk , BUTTONS : List ):
139- thread = Thread (target = reaper_main , args = (checkboxes , master , BUTTONS ))
139+ def on_start_click (
140+ checkboxes : Dict ,
141+ master : tkinter .Tk ,
142+ BUTTONS : List
143+ ):
144+ thread = Thread (
145+ target = reaper_main ,
146+ args = (checkboxes , master , BUTTONS )
147+ )
140148 thread .start ()
141149
142150
@@ -146,42 +154,35 @@ def on_fix_check_click(master: tkinter.Tk, BUTTONS: List):
146154
147155
148156master = tkinter .Tk (className = 'REAPERSCRIPT.main' )
149- width = 380
150- height = 440
151- s_width = master .winfo_screenwidth ()
152- s_height = master .winfo_screenheight ()
153- upper = s_height // 8
154- x = (s_width - width ) // 2
155- y = (s_height - height ) // 2
156- master .geometry (f'{ width } x{ height } +{ x } +{ y - upper } ' )
157- master .resizable (width = False , height = False )
158- master .title ('REAPERSCRIPT v3.22' )
157+ master .geometry (set_geometry (master ))
158+ master .resizable (False , False )
159+ master .title ('REAPERSCRIPT v3.24' )
159160master .iconbitmap (default = resource_path ('ico.ico' ))
160- img = Image .open (resource_path ('background.png' ))
161- tk_img = ImageTk .PhotoImage (img )
162- background_label = tkinter .Label (master , image = tk_img )
163- background_label .place (x = 0 , y = 0 , relwidth = 1 , relheight = 1 )
164161master .protocol ('WM_DELETE_WINDOW' , on_closing )
162+ style = ttk .Style ()
163+ style .configure ('TCheckbutton' , background = '#ffc0cb' )
164+ style .configure ('TButton' , background = '#ffc0cb' )
165+ style .configure ('TLabel' , background = '#ffc0cb' )
166+ style .configure ('TButton' , width = 13 )
167+ raw_img = Image .open (resource_path ('background.png' ))
168+ image = ImageTk .PhotoImage (raw_img )
169+ background = tkinter .Label (master , image = image )
170+ background .place (x = 0 , y = 0 , relwidth = 1 , relheight = 1 )
171+ config = get_config ()
172+ checkboxes = {}
165173OPTIONS = [
166174 'noise_reduction' ,
167175 'volume_up_dubbers' ,
168176 'subs_cleaner' ,
169177 'sub_region' ,
170178 'sub_item' ,
171179 'split' ,
172- 'normalize' ,
173180 'normalize_dubbers' ,
174181 'normalize_video' ,
175182 'fix_check' ,
176183 'render_audio' ,
177184 'render_video' ,
178185]
179- config = get_config ()
180- checkboxes = {}
181- checkbox_style = ttk .Style ()
182- checkbox_style .configure ('TCheckbutton' , background = '#ffc0cb' )
183- button_style = ttk .Style ()
184- button_style .configure ('TButton' , background = '#ffc0cb' )
185186for i , option in enumerate (OPTIONS ):
186187 var = tkinter .BooleanVar ()
187188 if option in config ['OPTIONS' ]:
@@ -192,10 +193,10 @@ def on_fix_check_click(master: tkinter.Tk, BUTTONS: List):
192193 master ,
193194 text = option ,
194195 variable = var ,
195- padding = 7 ,
196+ padding = 6 ,
196197 )
197198 checkbox .grid (
198- row = i ,
199+ row = i + 1 ,
199200 column = 0 ,
200201 sticky = tkinter .W
201202 )
@@ -231,44 +232,68 @@ def on_fix_check_click(master: tkinter.Tk, BUTTONS: List):
231232 pady = 3
232233)
233234ToolTip (template_btn , HELP_DICT ['template' ], 1 )
234- rfxchains_btn = ttk .Button (
235+ nr_template_btn = ttk .Button (
235236 master ,
236- text = 'RFXCHAINS ' ,
237- name = 'rfx ' ,
238- command = lambda : path_choice ('fx_chains_folder ' )
237+ text = 'NR TEMPLATE ' ,
238+ name = 'nrtemplate ' ,
239+ command = lambda : path_choice ('nrtemplate ' )
239240)
240- rfxchains_btn .grid (
241+ nr_template_btn .grid (
241242 row = (len (OPTIONS ) + 3 ),
242243 column = 0 ,
243244 sticky = tkinter .W ,
244245 padx = 6 ,
245246 pady = 3
246247)
248+ ToolTip (nr_template_btn , HELP_DICT ['nrtemplate' ], 1 )
249+ rfxchains_btn = ttk .Button (
250+ master ,
251+ text = 'RFXCHAINS' ,
252+ name = 'rfx' ,
253+ command = lambda : path_choice ('fx_chains_folder' )
254+ )
255+ rfxchains_btn .place (relx = 0.5 , rely = 1.0 , anchor = "s" , x = 140 , y = - 40 )
247256ToolTip (rfxchains_btn , HELP_DICT ['rfx' ], 1 )
248257fix_check_btn = ttk .Button (
249258 master ,
250- text = 'FIXCHECK ' ,
259+ text = 'FIX CHECK ' ,
251260 name = 'fixcheck_standalone' ,
252261 command = lambda : on_fix_check_click (master , BUTTONS )
253262)
254- fix_check_btn .place (relx = 0.5 , rely = 1.0 , anchor = "s" , x = 145 , y = - 9 )
263+ fix_check_btn .place (relx = 0.5 , rely = 1.0 , anchor = "s" , x = 140 , y = - 9 )
255264ToolTip (fix_check_btn , HELP_DICT ['fixcheck_standalone' ], 1 )
256- nr_template_btn = ttk .Button (
257- master ,
258- text = 'NR TEMP' ,
259- name = 'nrtemplate' ,
260- command = lambda : path_choice ('nrtemplate' )
261- )
262- nr_template_btn .place (relx = 0.5 , rely = 1.0 , anchor = "s" , x = 145 , y = - 40 )
263- ToolTip (nr_template_btn , HELP_DICT ['nrtemplate' ], 1 )
264265help_btn = ttk .Button (
265266 master ,
266267 text = 'HELP' ,
267268 name = 'help' ,
268269 command = lambda : show_help_window (master ),
269270)
270- help_btn .place (relx = 0.5 , rely = 1.0 , anchor = "s" , x = 145 , y = - 407 )
271+ help_btn .place (relx = 0.5 , rely = 1.0 , anchor = "s" , x = 140 , y = - 389 )
271272ToolTip (help_btn , HELP_DICT ['help' ], 1 )
273+ subs_extract = ttk .Label (master , text = 'Select subtitles to extract:' )
274+ subs_extract .grid (row = 0 , column = 0 , sticky = tkinter .W , padx = 6 , pady = 6 )
275+ SUBS_LANGS_LIST = [
276+ 'Russia' ,
277+ 'US' ,
278+ 'Saudi Arabia' ,
279+ 'Germany' ,
280+ 'Latin America' ,
281+ 'France' ,
282+ 'Italy' ,
283+ 'Brasil' ,
284+ ]
285+ menu = ttk .Combobox (
286+ master ,
287+ values = SUBS_LANGS_LIST ,
288+ name = 'subs_lang' ,
289+ state = 'readonly' ,
290+ width = 13 ,
291+ )
292+ try :
293+ menu .set (config ['SUBS' ]['subs_lang' ])
294+ except KeyError :
295+ menu .set (SUBS_LANGS_LIST [0 ])
296+ menu .place (relx = 0.5 , rely = 1.0 , anchor = "s" , x = 6 , y = - 391 )
272297
273298
274299if __name__ == '__main__' :
0 commit comments