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

        edited_prefs = {widget.name: widget.get() for widget in self.prefs_widgets}

        try:
            validate_prefs_data(edited_prefs)

        except Exception:

            return

        else:

            try:
                save_pyl(edited_prefs, CONFIG_FILEPATH)

            except Exception:

                return

            else:

                # TODO make sure changes propagate to
                # wherever relevant (for instance,
                # assign max_lines to user logger and
                # also take care of max lines for
                # the custom stdout)
                USER_PREFS.update(edited_prefs)

        ### notify user via dialog and status message

        message = (
            "User preferences changed. Some changes may"
            " only take effect after restarting the app"
        )

        set_status_message(message)

        create_and_show_dialog(message, level_name='info')
Assign new category indices and exit loop.
nodezator/userprefsman/generalform.py