def submit_form(self):
        """Treat data and, if valid, perform changes."""
        if not self.subform_objects:
            return

        for label, entry in zip(self.current_name_labels, self.new_name_entries):

            new_name = entry.get()

            if not new_name:
                return
            elif label.name == new_name:
                return

        nodes_data = self.data.get("nodes", {})
        new_node_packs = []

        for label, entry in zip(self.current_name_labels, self.new_name_entries):

            old_name = label.name
            new_name = entry.get()

            ###
            old_path = next(path for path in self.node_packs if path.name == old_name)

            new_path = old_path.parent / new_name
            new_node_packs.append(new_path)

            ###

            ids = self.node_pack_name_to_ids[old_name]

            for node_id in ids:

                node_data = nodes_data[node_id]

                _, categ_name, script_name = node_data["script_id"]

                node_data["script_id"] = (new_name, categ_name, script_name)

        self.data["node_packs"] = (
            str(new_node_packs[0])
            if len(new_node_packs) == 1
            else [str(path) for path in new_node_packs]
        )

        ###

        save_pyl(self.data, self.chosen_filepath)

        ###

        for obj in self.subform_objects:
            self.widgets.remove(obj)

        self.subform_objects.clear()

        ###

        ### trigger exiting the form by setting special
        ### flag to False
        self.running = False
Treat data and, if valid, perform changes.
nodezator/editing/nodepacksforms/renaming.py