def save(self, filepath=None): """Save this layer, optionally to new, given filepath. :param filepath: file path to save to, defaults to None :type filepath: str, optional """ filepath = filepath or self.real_path # Update graph name graph_name = os.path.splitext(os.path.basename(filepath))[0] if self.get_alias(local=True) == UNTITLED: self.set_alias(graph_name) save_data = self.get_save_data() try: json.dumps(save_data, indent=4, sort_keys=False) except TypeError: logger.error("Failed to save file!") # TODO: Should raise here, but its out of scope for what I'm # working on right now. return logger.info("Save Data Generated") nxt_io.save_file_data(save_data=save_data, filepath=filepath) if filepath != self.real_path: self.real_path = filepath self.propegate_real_path() return save_data
def save(self, filepath): save_data = self.get_save_data() nxt_io.save_file_data(save_data=save_data, filepath=filepath) return save_data