From eac49fd6d978c496bcf5e77b3433abc620135b31 Mon Sep 17 00:00:00 2001 From: eshanized Date: Thu, 2 Jan 2025 12:46:03 +0530 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=EF=B8=8F=20perf:=20add=20inline=20exp?= =?UTF-8?q?lanation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- usr/share/snigdhaos-welcome/ui/Stack.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/usr/share/snigdhaos-welcome/ui/Stack.py b/usr/share/snigdhaos-welcome/ui/Stack.py index 3d4c53c..9c5bf81 100644 --- a/usr/share/snigdhaos-welcome/ui/Stack.py +++ b/usr/share/snigdhaos-welcome/ui/Stack.py @@ -1,22 +1,39 @@ import gi +# Required to specify the version of the Gtk library to use gi.require_version("Gtk", "3.0") from gi.repository import Gtk +# Custom class `Stack` inheriting from `Gtk.Stack` class Stack(Gtk.Stack): def __init__(self, transition_type): + # Call the initializer of the parent class super(Stack, self).__init__() - # self.set_transition_type(Gtk.StackTransitionType.ROTATE_LEFT) + # Determine the transition type based on the input argument + # If the input is "ROTATE_LEFT", set it to the corresponding Gtk transition type if transition_type == "ROTATE_LEFT": transition_type = Gtk.StackTransitionType.ROTATE_LEFT + + # If the input is "CROSSFADE", set it to the corresponding Gtk transition type if transition_type == "CROSSFADE": transition_type = Gtk.StackTransitionType.CROSSFADE + # Set the stack transition type (animation between stack pages) self.set_transition_type(transition_type) + + # Allow the widget to expand horizontally to fill available space self.set_hexpand(True) + + # Allow the widget to expand vertically to fill available space self.set_vexpand(True) + + # Set the duration of the transition animation in milliseconds self.set_transition_duration(500) + + # Disable horizontal homogeneity, allowing child widgets to have different widths self.set_hhomogeneous(False) + + # Disable vertical homogeneity, allowing child widgets to have different heights self.set_vhomogeneous(False)