Example #1
0
 def save_library(self):
     try:
         if self.current_library_filename:
             ml.save_library(self.library, self.current_library_filename)
         else:
             self.save_library_as()
     except Exception as e:
         print(traceback.print_exc())
         messagebox.showerror('Create Library Error', e)
Example #2
0
 def save_library_as(self):
     try:
         library_filename = filedialog.asksaveasfilename(initialdir=os.getcwd(),
                                                         title='Save music library',
                                                         filetypes=(('json', '*.json'),),
                                                         defaultextension='.json')
         if library_filename:
             ml.save_library(self.library, library_filename)
             self.current_library_filename = library_filename
     except Exception as e:
         print(traceback.print_exc())
         messagebox.showerror('Create Library Error', e)