# Copyright (c) 2018-2021, NVIDIA CORPORATION.  All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
#
from .quicklayout import QuickLayout
import omni.ext
import omni.kit.ui


class QuickLayoutExtension(omni.ext.IExt):
    def on_startup(self, ext_id):
        self.__quick_layout = QuickLayout()

        editor_menu = omni.kit.ui.get_editor_menu()
        if editor_menu:
            self._menu_save = editor_menu.add_item("Window/Layout/Save Layout...", self.__quick_layout.save)
            self._menu_load = editor_menu.add_item("Window/Layout/Load Layout...", self.__quick_layout.load)
            self._menu_quick_save = editor_menu.add_item("Window/Layout/Quick Save", QuickLayout.quick_save)
            self._menu_quick_load = editor_menu.add_item("Window/Layout/Quick Load", QuickLayout.quick_load)

    def on_shutdown(self): # pragma: no cover
        self._menu_save = None
        self._menu_load = None
        self._menu_quick_save = None
        self._menu_quick_load = None
        self._menu = None
        self.__quick_layout.destroy()
        self.__quick_layout = None
