From 8c96f4e059a1eacfac5aedcd2033f7983002c08f Mon Sep 17 00:00:00 2001 From: eshanized Date: Thu, 2 Jan 2025 12:47:24 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20docs:=20add=20inline=20explanati?= =?UTF-8?q?on?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/share/snigdhaos-welcome/ui/StackSwitcher.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/usr/share/snigdhaos-welcome/ui/StackSwitcher.py b/usr/share/snigdhaos-welcome/ui/StackSwitcher.py index 6410422..021fe7f 100644 --- a/usr/share/snigdhaos-welcome/ui/StackSwitcher.py +++ b/usr/share/snigdhaos-welcome/ui/StackSwitcher.py @@ -1,12 +1,23 @@ import gi +# Specify the version of the Gtk library to use gi.require_version("Gtk", "3.0") from gi.repository import Gtk +# Custom class `StackSwitcher` inheriting from `Gtk.StackSwitcher` class StackSwitcher(Gtk.StackSwitcher): def __init__(self, stack): + # Call the initializer of the parent class super(StackSwitcher, self).__init__() + + # Set the orientation of the switcher to horizontal + # This means the buttons to switch between stack pages will be laid out side by side self.set_orientation(Gtk.Orientation.HORIZONTAL) + + # Link the `StackSwitcher` to a specific `Gtk.Stack` instance + # This allows the switcher to control and reflect the state of the given stack self.set_stack(stack) + + # Align the switcher horizontally to the center of its parent container self.set_halign(Gtk.Align.CENTER)