@@ -58,7 +58,7 @@ def new_Popen(*args, startupinfo=None, **kwargs):
5858import tempfile
5959from config import DEBUG
6060import customtkinter
61- from CTkMessagebox import CTkMessagebox
61+ from custom_message_box import custom_messagebox_panel
6262
6363customtkinter .set_appearance_mode ("light" )
6464customtkinter .set_default_color_theme ("blue" )
@@ -85,7 +85,8 @@ def new_Popen(*args, startupinfo=None, **kwargs):
8585
8686
8787def about ():
88- CTkMessagebox (title = "Info" , message = "Milonga DJ Soft - Paweł Wąsowicz" )
88+ #CTkMessagebox(title="Info", message="Milonga DJ Soft - Paweł Wąsowicz",master=root)
89+ custom_messagebox_panel (parent = tree , message = "Milonga DJ Soft - Paweł Wąsowicz" )
8990
9091
9192def export_playlist ():
@@ -101,11 +102,8 @@ def export_playlist():
101102def on_closing ():
102103 global is_playing
103104 if is_playing :
104- CTkMessagebox (
105- title = "Warning" ,
106- message = "Cannot close application while is playing." ,
107- icon = "warning" ,
108- )
105+ custom_messagebox_panel (parent = tree , message = "Cannot close application while is playing." )
106+
109107 else :
110108 player .quit_device ()
111109 player .delete_tmp_files ()
@@ -340,19 +338,12 @@ def on_delete():
340338 selected_items = tree .selection ()
341339
342340 if not selected_items :
343- CTkMessagebox ( title = "None selected" , message = "Select rows." , icon = "warning " )
341+ custom_messagebox_panel ( parent = tree , message = "Select rows." )
344342 return
345343
346- msg = CTkMessagebox (
347- title = "Confirmation" ,
348- message = f"Delete { len (selected_items )} song(s)?" ,
349- icon = "question" ,
350- option_1 = "No" ,
351- option_2 = "Yes" ,
352- )
353- response = msg .get ()
344+ res = custom_messagebox_panel (parent = tree , message = f"Delete { len (selected_items )} song(s)?" ,show_cancel = True )
354345
355- if response == "Yes" :
346+ if res :
356347 converted_files = player .get_converted_files ()
357348 for item in selected_items :
358349 tree .delete (item )
@@ -395,17 +386,10 @@ def on_start():
395386def on_stop ():
396387 global is_playing
397388 global current_song
389+ res = custom_messagebox_panel (parent = tree , message = "Stop playing?" , show_cancel = True )
398390
399- msg = CTkMessagebox (
400- title = "Confirmation" ,
401- message = "Stop playing?" ,
402- icon = "question" ,
403- option_1 = "No" ,
404- option_2 = "Yes" ,
405- )
406- response = msg .get ()
407391
408- if response == "Yes" :
392+ if res :
409393 player .fade ()
410394 clear_playing ()
411395 player .reset_progress ()
@@ -459,8 +443,9 @@ def make_drop(event):
459443 else :
460444 print ("Wrong file: " , new_file )
461445
462- if len (tree .get_children ()) != len (selections ):
463- tree .selection_set (selections )
446+ #if len(tree.get_children()) != len(selections):
447+ # tree.selection_set(selections)
448+
464449 progressbar .set (start_pos )
465450
466451 files = utils .get_files_from_tree (tree , songs )
@@ -559,6 +544,7 @@ def build_gui():
559544 global audio_device_dropdown
560545
561546 root = CTk ()
547+
562548 root .protocol ("WM_DELETE_WINDOW" , on_closing )
563549 icon = PhotoImage (file = "./icons/icon.png" )
564550 root .iconphoto (True , icon )
@@ -764,6 +750,13 @@ def update_loudness():
764750 songs [id ] = tuple (new_data )
765751 is_converting = False
766752
753+ oimage = None
754+ def draw_wave (temp_filename ):
755+ global oimage
756+ global_canvas = global_vars .wave_canvas
757+ oimage = tk .PhotoImage (file = temp_filename )
758+ global_vars .image_id = global_canvas .create_image (0 , 0 , anchor = "nw" , image = oimage )
759+ os .remove (temp_filename )
767760
768761def check_music ():
769762 global is_playing
@@ -772,6 +765,10 @@ def check_music():
772765
773766 setup_buttons ()
774767
768+ if global_vars .wave_queue .qsize ()> 0 :
769+ file_name = global_vars .wave_queue .get (block = False )
770+ draw_wave (file_name )
771+
775772 def worker ():
776773 update_loudness ()
777774
0 commit comments