import carb.settings
import omni.ui as ui
from omni.kit.window.preferences import PreferenceBuilder, SettingType, PERSISTENT_SETTINGS_PREFIX


class PropertyUsdPreferences(PreferenceBuilder):
    def __init__(self):
        super().__init__("Property Widgets")

    def build(self):
        with ui.VStack(height=0):
            with self.add_frame("Property Window"):
                with ui.VStack():
                    w = self.create_setting_widget(
                        "Large selections threshold. This prevents slowdown/stalls on large selections, after this number of prims is selected most of the property window will be hidden.\n\nSet to zero to disable this feature\n\n",
                        PERSISTENT_SETTINGS_PREFIX + "/exts/omni.kit.property.usd/large_selection",
                        SettingType.INT,
                        height=20
                    )
                    w.identifier = "large_selection"

                    w = self.create_setting_widget(
                        "Raw Usd Properties Widget multi-selection limit. This prevents slowdown/stalls on large selections, after this number of prims is selected content of Raw Usd Properties Widget will be hidden.\n\nSet to zero to disable this feature\n\n",
                        PERSISTENT_SETTINGS_PREFIX + "/exts/omni.kit.property.usd/raw_widget_multi_selection_limit",
                        SettingType.INT,
                        height=20
                    )
                    w.identifier = "raw_widget_multi_selection_limit"
