def finish_form(self):
        """Assign new category indices and exit loop."""

        prefs_copy = USER_PREFS.copy()

        prefs_copy.update({
            'SOCKET_DETECTION_GRAPHICS': self.socket_graphics_option_menu.get(),
            'DETECTION_DISTANCE': int(self.detection_distance_value_label.get()),
            'GRASPING_DISTANCE': int(self.grasping_distance_value_label.get()),
        })

        try:
            validate_prefs_data(prefs_copy)

        except Exception:
            return

        else:

            try:
                save_pyl(prefs_copy, CONFIG_FILEPATH)

            except Exception:
                return

            else:

                USER_PREFS.update(prefs_copy)
                APP_REFS.gm.reference_socket_detection_graphics()

        ### notify user via status message

        message = "Socket detection preferences changed."
        set_status_message(message)
Assign new category indices and exit loop.
nodezator/userprefsman/socketdetectionform.py