Пример #1
0
    def __init__(self, settings, docker):
        super().__init__()
        self.set_halign(Gtk.Align.FILL)
        self.set_valign(Gtk.Align.FILL)
        self.set_hexpand(True)

        self._settings = settings
        self._docker = docker

        self.general_preferences = GeneralSettingsPage(settings=self._settings,
                                                       docker=self._docker)
        self.registry_preferences = RegistrySettingsPage(
            settings=self._settings, docker=self._docker)
        self.k3s_preferences = K3sSettingsPage(settings=self._settings,
                                               docker=self._docker)
        self.hooks_preferences = HooksSettingsPage(settings=self._settings,
                                                   docker=self._docker)

        self.stack = Gtk.Stack()
        self.stack.set_halign(Gtk.Align.FILL)
        self.stack.set_valign(Gtk.Align.FILL)
        self.stack.set_hexpand(True)
        self.stack.set_homogeneous(True)
        self.stack.add_named(self.general_preferences, "settings_page")
        self.stack.add_named(self.registry_preferences, "registry_page")
        self.stack.add_named(self.k3s_preferences, "k3s_page")
        self.stack.add_named(self.hooks_preferences, "hooks_page")

        self.stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
        self.stack.set_transition_duration(100)

        self.settings_sidebar = Granite.SettingsSidebar(stack=self.stack)

        self.add(self.settings_sidebar)
        self.add(self.stack)
Пример #2
0
    def __init__(self,
                 settings: ApplicationSettings,
                 cluster: Optional[K3dCluster] = None):
        super().__init__()
        self.set_halign(Gtk.Align.FILL)
        self.set_valign(Gtk.Align.FILL)
        self.set_hexpand(True)

        self._settings = settings

        self.general_settings = GeneralSettingsPage(cluster=cluster,
                                                    settings=settings)
        self.registry_settings = RegistrySettingsPage(cluster=cluster,
                                                      settings=settings)
        self.network_settings = NetworkSettingsPage(cluster=cluster,
                                                    settings=settings)
        self.advanced_settings = AdvancedSettingsPage(cluster=cluster,
                                                      settings=settings)

        self.stack = Gtk.Stack()
        self.stack.set_halign(Gtk.Align.FILL)
        self.stack.set_valign(Gtk.Align.FILL)
        self.stack.set_hexpand(True)
        self.stack.set_homogeneous(True)
        self.stack.add_named(self.general_settings, "settings_page")
        self.stack.add_named(self.registry_settings, "registry_page")
        self.stack.add_named(self.network_settings, "ports_page")
        self.stack.add_named(self.advanced_settings, "advanced_page")
        self.stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
        self.stack.set_transition_duration(100)

        self.settings_sidebar = Granite.SettingsSidebar(stack=self.stack)

        self.add(self.settings_sidebar)
        self.add(self.stack)