def do_save(self):   
     num = self.get_level_num()
     filename = self.get_current_level().filename
     utilities.log("Overwriting " + filename + "...")
     curr_json = self.get_current_level().to_json()
     
     with open(filename, 'w') as outfile:
         json_string = utilities.level_json_to_string(curr_json)
         utilities.log("writing text:\n" + json_string)
         outfile.write(json_string)
     utilities.log("done.")
 def dump_highscores_to_file(self, suppress_printing=0):
     "0 = print nothing, 1 = print message, 2 = print entire file"
     if self.settings.dev_mode():
         utilities.log("Not saving high scores because we're in dev mode")
         return
     
     if suppress_printing > 0:
         utilities.log("Saving highscores to "+self.get_highscores_filename()+"...")
     highscores = LevelManager.generate_empty_highscores_dict(self.get_num_levels(), checksums=[])
     highscores["best_overall_run_total"] = utilities.format_time(self.best_overall_run_total)
     highscores["best_individual_scores"] = [utilities.format_time(self.best_individual_scores[i]) for i in range(0, self.get_num_levels())]
     highscores["best_overall_run_scores"] = [utilities.format_time(self.best_overall_run_scores[i]) for i in range(0, self.get_num_levels())]
     highscores["ghosts"] = [actors.Ghost.to_json(g) for g in self.ghosts]
     highscores["checksums"] = [self.get_checksum(i) for i in range(0, self.get_num_levels())]
     
     with open(self.get_highscores_filename(), 'w') as file:
         json_string = utilities.level_json_to_string(highscores)
         if suppress_printing > 1:
             utilities.log("writing text:\n" + json_string)
         file.write(json_string)