:mod:`dip.shell.tools.model_manager`
====================================
.. module:: dip.shell.tools.model_manager

This module contains the default implementation of a :term:`tool` that
handles the lifecycle of :term:`managed models<managed model>` in a
:term:`shell`.


:class:`ModelManagerTool`
-------------------------
.. class:: ModelManagerTool

    Base class: :class:`~dip.model.Model`

    The ModelManagerTool class is a :term:`tool` that handles the lifecycle
    of :term:`managed models<managed model>` in a :term:`shell`.

    .. attribute:: choose_model_wizard_title = Str('Choose an item')

        The title of the wizard page to choose a model.

    .. attribute:: choose_new_model_prompt = Str('From the list below choose what sort of item you want to create.\n')

        The text to use to prompt the user to choose a new model.
        FIXME: The newlines are needed for OS/X (don't know about other
        FIXME: platforms).  Should it be moved to the toolkit implementation?

    .. attribute:: choose_open_model_prompt = Str('From the list below choose what sort of item you want to open.\n')

        The text to use to prompt the user to choose a model to open.

    .. attribute:: choose_tool_prompt = Str('From the list below choose what tool you want to use.\n')

        The text to use to prompt the user to choose a tool.

    .. attribute:: choose_tool_wizard_title = Str('Choose a tool')

        The title of the wizard page to choose a tool.

    .. attribute:: close_action = CloseAction()

        The Close action.

    .. attribute:: id = 'dip.shell.tools.model_manager'

        The tool's identifier.

    .. attribute:: new_action = NewAction()

        The New action.

    .. attribute:: open_action = OpenAction()

        The Open action.

    .. attribute:: save_action = SaveAction()

        The Save action.

    .. attribute:: save_as_action = SaveAsAction()

        The Save As action.

    .. attribute:: user_close_question = Str('Do you still want to close?')

        The text used as the question asking if the user really wants to close.

    .. attribute:: user_close_title = Str()

        The text used as the title of the "Close" related views.

    .. attribute:: user_new_title = Str()

        The text used as the title of the "New" related views.

    .. attribute:: user_open_title = Str()

        The text used as the title of the "Open" related views.

    .. attribute:: user_save_title = Str()

        The text used as the title of the "Save" related views.

    .. attribute:: user_save_as_title = Str()

        The text used as the title of the "Save As" related views.

    .. method:: ModelManagerTool.__init__()

        Initialise the tool. 

    .. method:: ModelManagerTool.open_model(location, tool)

        This handles :meth:`~dip.shell.IOpenModel.open_model` on behalf of
        an implementation of the :class:`~dip.shell.IManagedModelTool`
        interface.
        
        :param location:
            is the storage location.
        :param tool:
            is the tool.

    .. method:: ModelManagerTool.veto_close_view(view, tool)

        This handles :meth:`~dip.shell.ICloseViewVeto.veto` on behalf of an
        implementation of the :class:`~dip.shell.IManagedModelTool` interface.
        
        :param view:
            is the view.
        :param tool:
            is the tool.
        :return:
            ``True`` if the close of the view is to be prevented.
