main.page

 1from PyQt6.QtWidgets import QWidget
 2
 3
 4class Page(QWidget):
 5    """
 6    Base class for all application pages.
 7
 8    This abstract widget defines the lifecycle and navigation interface
 9    shared by all pages in the UI (e.g., `on_enter`, `next`, `back`).
10    Subclasses should override relevant methods to implement page-specific
11    logic, layout, and transitions.
12    """
13
14    def _setup_ui(self):
15        """
16        Initialize and configure the page's user interface.
17
18        To be implemented by subclasses for defining layouts, widgets,
19        and signal connections.
20        """
21        pass
22
23    def is_ready_to_advance(self):
24        """
25        Check whether the page is ready to advance to the next step.
26
27        Returns
28        -------
29        bool
30            True if navigation to the next page is allowed.
31        """
32        return True
33
34    def is_ready_to_go_back(self):
35        """
36        Check whether the page can return to the previous step.
37
38        Returns
39        -------
40        bool
41            True if navigation backward is allowed.
42        """
43        return True
44
45    def reset_page(self):
46        """
47        Reset the page state and clear any user input or temporary data.
48
49        Should be overridden by subclasses that maintain internal state.
50        """
51        pass
52
53    def on_enter(self):
54        """
55        Hook called when this page becomes active.
56
57        Used for refreshing content or resetting temporary UI state.
58        Subclasses can override this to perform actions when the user
59        navigates to this page.
60        """
61        pass
62
63    def next(self, context):
64        """
65        Handle transition to the next page.
66
67        Parameters
68        ----------
69        context : dict
70            Shared application context passed across pages.
71
72        Returns
73        -------
74        Page | None
75            The next page instance, or None if navigation should stop.
76        """
77        pass
78
79    def back(self):
80        """
81        Handle transition to the previous page.
82
83        Returns
84        -------
85        Page | None
86            The previous page instance, or None if there is no previous page.
87        """
88        pass
89
90    def _translate_ui(self):
91        """
92        Update translatable text in the UI when the language changes.
93
94        Subclasses should override this method to refresh localized labels,
95        buttons, and other text elements.
96        """
97        pass
class Page(PyQt6.QtWidgets.QWidget):
 5class Page(QWidget):
 6    """
 7    Base class for all application pages.
 8
 9    This abstract widget defines the lifecycle and navigation interface
10    shared by all pages in the UI (e.g., `on_enter`, `next`, `back`).
11    Subclasses should override relevant methods to implement page-specific
12    logic, layout, and transitions.
13    """
14
15    def _setup_ui(self):
16        """
17        Initialize and configure the page's user interface.
18
19        To be implemented by subclasses for defining layouts, widgets,
20        and signal connections.
21        """
22        pass
23
24    def is_ready_to_advance(self):
25        """
26        Check whether the page is ready to advance to the next step.
27
28        Returns
29        -------
30        bool
31            True if navigation to the next page is allowed.
32        """
33        return True
34
35    def is_ready_to_go_back(self):
36        """
37        Check whether the page can return to the previous step.
38
39        Returns
40        -------
41        bool
42            True if navigation backward is allowed.
43        """
44        return True
45
46    def reset_page(self):
47        """
48        Reset the page state and clear any user input or temporary data.
49
50        Should be overridden by subclasses that maintain internal state.
51        """
52        pass
53
54    def on_enter(self):
55        """
56        Hook called when this page becomes active.
57
58        Used for refreshing content or resetting temporary UI state.
59        Subclasses can override this to perform actions when the user
60        navigates to this page.
61        """
62        pass
63
64    def next(self, context):
65        """
66        Handle transition to the next page.
67
68        Parameters
69        ----------
70        context : dict
71            Shared application context passed across pages.
72
73        Returns
74        -------
75        Page | None
76            The next page instance, or None if navigation should stop.
77        """
78        pass
79
80    def back(self):
81        """
82        Handle transition to the previous page.
83
84        Returns
85        -------
86        Page | None
87            The previous page instance, or None if there is no previous page.
88        """
89        pass
90
91    def _translate_ui(self):
92        """
93        Update translatable text in the UI when the language changes.
94
95        Subclasses should override this method to refresh localized labels,
96        buttons, and other text elements.
97        """
98        pass

Base class for all application pages.

This abstract widget defines the lifecycle and navigation interface shared by all pages in the UI (e.g., on_enter, next, back). Subclasses should override relevant methods to implement page-specific logic, layout, and transitions.

def is_ready_to_advance(self):
24    def is_ready_to_advance(self):
25        """
26        Check whether the page is ready to advance to the next step.
27
28        Returns
29        -------
30        bool
31            True if navigation to the next page is allowed.
32        """
33        return True

Check whether the page is ready to advance to the next step.

Returns

bool True if navigation to the next page is allowed.

def is_ready_to_go_back(self):
35    def is_ready_to_go_back(self):
36        """
37        Check whether the page can return to the previous step.
38
39        Returns
40        -------
41        bool
42            True if navigation backward is allowed.
43        """
44        return True

Check whether the page can return to the previous step.

Returns

bool True if navigation backward is allowed.

def reset_page(self):
46    def reset_page(self):
47        """
48        Reset the page state and clear any user input or temporary data.
49
50        Should be overridden by subclasses that maintain internal state.
51        """
52        pass

Reset the page state and clear any user input or temporary data.

Should be overridden by subclasses that maintain internal state.

def on_enter(self):
54    def on_enter(self):
55        """
56        Hook called when this page becomes active.
57
58        Used for refreshing content or resetting temporary UI state.
59        Subclasses can override this to perform actions when the user
60        navigates to this page.
61        """
62        pass

Hook called when this page becomes active.

Used for refreshing content or resetting temporary UI state. Subclasses can override this to perform actions when the user navigates to this page.

def next(self, context):
64    def next(self, context):
65        """
66        Handle transition to the next page.
67
68        Parameters
69        ----------
70        context : dict
71            Shared application context passed across pages.
72
73        Returns
74        -------
75        Page | None
76            The next page instance, or None if navigation should stop.
77        """
78        pass

Handle transition to the next page.

Parameters

context : dict Shared application context passed across pages.

Returns

Page | None The next page instance, or None if navigation should stop.

def back(self):
80    def back(self):
81        """
82        Handle transition to the previous page.
83
84        Returns
85        -------
86        Page | None
87            The previous page instance, or None if there is no previous page.
88        """
89        pass

Handle transition to the previous page.

Returns

Page | None The previous page instance, or None if there is no previous page.