winipedia-utils 0.1.62__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of winipedia-utils might be problematic. Click here for more details.
- winipedia_utils/concurrent/concurrent.py +245 -242
- winipedia_utils/concurrent/multiprocessing.py +130 -115
- winipedia_utils/concurrent/multithreading.py +93 -93
- winipedia_utils/consts.py +23 -23
- winipedia_utils/data/__init__.py +1 -1
- winipedia_utils/data/dataframe/__init__.py +1 -0
- winipedia_utils/data/dataframe/cleaning.py +378 -0
- winipedia_utils/data/structures/__init__.py +1 -0
- winipedia_utils/data/structures/dicts.py +16 -0
- winipedia_utils/django/__init__.py +24 -24
- winipedia_utils/django/bulk.py +538 -538
- winipedia_utils/django/command.py +334 -334
- winipedia_utils/django/database.py +289 -289
- winipedia_utils/git/__init__.py +1 -1
- winipedia_utils/git/gitignore/__init__.py +1 -1
- winipedia_utils/git/gitignore/gitignore.py +136 -136
- winipedia_utils/git/pre_commit/__init__.py +1 -1
- winipedia_utils/git/pre_commit/config.py +70 -70
- winipedia_utils/git/pre_commit/hooks.py +109 -109
- winipedia_utils/git/pre_commit/run_hooks.py +49 -49
- winipedia_utils/iterating/__init__.py +1 -1
- winipedia_utils/iterating/iterate.py +29 -29
- winipedia_utils/logging/ansi.py +6 -6
- winipedia_utils/logging/config.py +64 -64
- winipedia_utils/logging/logger.py +26 -26
- winipedia_utils/modules/class_.py +119 -119
- winipedia_utils/modules/function.py +101 -103
- winipedia_utils/modules/module.py +379 -379
- winipedia_utils/modules/package.py +390 -390
- winipedia_utils/oop/mixins/meta.py +333 -331
- winipedia_utils/oop/mixins/mixin.py +37 -37
- winipedia_utils/os/__init__.py +1 -1
- winipedia_utils/os/os.py +63 -63
- winipedia_utils/projects/__init__.py +1 -1
- winipedia_utils/projects/poetry/__init__.py +1 -1
- winipedia_utils/projects/poetry/config.py +91 -91
- winipedia_utils/projects/poetry/poetry.py +31 -31
- winipedia_utils/projects/project.py +48 -48
- winipedia_utils/pyside/__init__.py +1 -1
- winipedia_utils/pyside/core/__init__.py +1 -1
- winipedia_utils/pyside/core/py_qiodevice.py +476 -476
- winipedia_utils/pyside/ui/__init__.py +1 -1
- winipedia_utils/pyside/ui/base/__init__.py +1 -1
- winipedia_utils/pyside/ui/base/base.py +180 -180
- winipedia_utils/pyside/ui/pages/__init__.py +1 -1
- winipedia_utils/pyside/ui/pages/base/__init__.py +1 -1
- winipedia_utils/pyside/ui/pages/base/base.py +92 -92
- winipedia_utils/pyside/ui/pages/browser.py +26 -26
- winipedia_utils/pyside/ui/pages/player.py +85 -85
- winipedia_utils/pyside/ui/widgets/__init__.py +1 -1
- winipedia_utils/pyside/ui/widgets/browser.py +243 -243
- winipedia_utils/pyside/ui/widgets/clickable_widget.py +57 -57
- winipedia_utils/pyside/ui/widgets/media_player.py +430 -423
- winipedia_utils/pyside/ui/widgets/notification.py +78 -78
- winipedia_utils/pyside/ui/windows/__init__.py +1 -1
- winipedia_utils/pyside/ui/windows/base/__init__.py +1 -1
- winipedia_utils/pyside/ui/windows/base/base.py +49 -49
- winipedia_utils/resources/__init__.py +1 -1
- winipedia_utils/resources/svgs/__init__.py +1 -1
- winipedia_utils/resources/svgs/download_arrow.svg +2 -2
- winipedia_utils/resources/svgs/exit_fullscreen_icon.svg +5 -5
- winipedia_utils/resources/svgs/fullscreen_icon.svg +2 -2
- winipedia_utils/resources/svgs/menu_icon.svg +3 -3
- winipedia_utils/resources/svgs/pause_icon.svg +3 -3
- winipedia_utils/resources/svgs/play_icon.svg +16 -16
- winipedia_utils/resources/svgs/plus_icon.svg +23 -23
- winipedia_utils/resources/svgs/svg.py +15 -15
- winipedia_utils/security/__init__.py +1 -1
- winipedia_utils/security/cryptography.py +29 -29
- winipedia_utils/security/keyring.py +70 -70
- winipedia_utils/setup.py +47 -47
- winipedia_utils/testing/assertions.py +23 -23
- winipedia_utils/testing/convention.py +177 -177
- winipedia_utils/testing/create_tests.py +291 -291
- winipedia_utils/testing/fixtures.py +28 -28
- winipedia_utils/testing/tests/base/fixtures/__init__.py +1 -1
- winipedia_utils/testing/tests/base/fixtures/fixture.py +6 -6
- winipedia_utils/testing/tests/base/fixtures/scopes/class_.py +33 -33
- winipedia_utils/testing/tests/base/fixtures/scopes/function.py +7 -7
- winipedia_utils/testing/tests/base/fixtures/scopes/module.py +31 -31
- winipedia_utils/testing/tests/base/fixtures/scopes/package.py +7 -7
- winipedia_utils/testing/tests/base/fixtures/scopes/session.py +312 -312
- winipedia_utils/testing/tests/base/utils/utils.py +82 -82
- winipedia_utils/testing/tests/conftest.py +32 -32
- winipedia_utils/text/string.py +126 -126
- {winipedia_utils-0.1.62.dist-info → winipedia_utils-0.2.0.dist-info}/METADATA +5 -4
- winipedia_utils-0.2.0.dist-info/RECORD +103 -0
- {winipedia_utils-0.1.62.dist-info → winipedia_utils-0.2.0.dist-info}/WHEEL +1 -1
- {winipedia_utils-0.1.62.dist-info → winipedia_utils-0.2.0.dist-info/licenses}/LICENSE +21 -21
- winipedia_utils/data/dataframe.py +0 -7
- winipedia_utils-0.1.62.dist-info/RECORD +0 -100
|
@@ -1 +1 @@
|
|
|
1
|
-
"""__init__ module for winipedia_utils.pyside6.ui."""
|
|
1
|
+
"""__init__ module for winipedia_utils.pyside6.ui."""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"""__init__ module."""
|
|
1
|
+
"""__init__ module."""
|
|
@@ -1,180 +1,180 @@
|
|
|
1
|
-
"""Base UI module.
|
|
2
|
-
|
|
3
|
-
This module contains the base UI class for the VideoVault application.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from abc import abstractmethod
|
|
7
|
-
from types import ModuleType
|
|
8
|
-
from typing import TYPE_CHECKING, Any, Self, cast
|
|
9
|
-
|
|
10
|
-
from PySide6.QtCore import QObject
|
|
11
|
-
from PySide6.QtGui import QIcon
|
|
12
|
-
from PySide6.QtWidgets import QApplication, QStackedWidget
|
|
13
|
-
|
|
14
|
-
from winipedia_utils.modules.class_ import (
|
|
15
|
-
get_all_nonabstract_subclasses,
|
|
16
|
-
)
|
|
17
|
-
from winipedia_utils.modules.package import get_main_package, walk_package
|
|
18
|
-
from winipedia_utils.oop.mixins.meta import ABCLoggingMeta
|
|
19
|
-
from winipedia_utils.resources.svgs.svg import get_svg_path
|
|
20
|
-
from winipedia_utils.text.string import split_on_uppercase
|
|
21
|
-
|
|
22
|
-
# Avoid circular import
|
|
23
|
-
if TYPE_CHECKING:
|
|
24
|
-
from winipedia_utils.pyside.ui.pages.base.base import Base as BasePage
|
|
25
|
-
from winipedia_utils.pyside.ui.windows.base.base import Base as BaseWindow
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class QABCLoggingMeta(
|
|
29
|
-
ABCLoggingMeta,
|
|
30
|
-
type(QObject), # type: ignore[misc]
|
|
31
|
-
):
|
|
32
|
-
"""Metaclass for the QABCImplementationLoggingMixin."""
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
class Base(metaclass=QABCLoggingMeta):
|
|
36
|
-
"""Base UI class for a Qt application."""
|
|
37
|
-
|
|
38
|
-
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
39
|
-
"""Initialize the base UI."""
|
|
40
|
-
super().__init__(*args, **kwargs)
|
|
41
|
-
self.base_setup()
|
|
42
|
-
self.pre_setup()
|
|
43
|
-
self.setup()
|
|
44
|
-
self.post_setup()
|
|
45
|
-
|
|
46
|
-
@abstractmethod
|
|
47
|
-
def base_setup(self) -> None:
|
|
48
|
-
"""Setup the base Qt object of the UI.
|
|
49
|
-
|
|
50
|
-
This method should initialize the core Qt components required
|
|
51
|
-
for the UI to function properly.
|
|
52
|
-
"""
|
|
53
|
-
|
|
54
|
-
@abstractmethod
|
|
55
|
-
def setup(self) -> None:
|
|
56
|
-
"""Setup the main UI components.
|
|
57
|
-
|
|
58
|
-
This method should contain the primary UI initialization logic.
|
|
59
|
-
"""
|
|
60
|
-
|
|
61
|
-
@abstractmethod
|
|
62
|
-
def pre_setup(self) -> None:
|
|
63
|
-
"""Setup operations to run before main setup.
|
|
64
|
-
|
|
65
|
-
This method should contain any initialization that needs to happen
|
|
66
|
-
before the main setup method is called.
|
|
67
|
-
"""
|
|
68
|
-
|
|
69
|
-
@abstractmethod
|
|
70
|
-
def post_setup(self) -> None:
|
|
71
|
-
"""Setup operations to run after main setup.
|
|
72
|
-
|
|
73
|
-
This method should contain any finalization that needs to happen
|
|
74
|
-
after the main setup method is called.
|
|
75
|
-
"""
|
|
76
|
-
|
|
77
|
-
@classmethod
|
|
78
|
-
def get_display_name(cls) -> str:
|
|
79
|
-
"""Get the display name of the UI.
|
|
80
|
-
|
|
81
|
-
Returns:
|
|
82
|
-
The human-readable display name derived from the class name.
|
|
83
|
-
"""
|
|
84
|
-
return " ".join(split_on_uppercase(cls.__name__))
|
|
85
|
-
|
|
86
|
-
@classmethod
|
|
87
|
-
def get_subclasses(cls, package: ModuleType | None = None) -> list[type[Self]]:
|
|
88
|
-
"""Get all subclasses of the UI.
|
|
89
|
-
|
|
90
|
-
Args:
|
|
91
|
-
package: The package to search for subclasses in. If None,
|
|
92
|
-
searches in the main package.
|
|
93
|
-
|
|
94
|
-
Returns:
|
|
95
|
-
A sorted list of all non-abstract subclasses.
|
|
96
|
-
"""
|
|
97
|
-
if package is None:
|
|
98
|
-
# find the main package
|
|
99
|
-
package = get_main_package()
|
|
100
|
-
|
|
101
|
-
_ = list(walk_package(package))
|
|
102
|
-
|
|
103
|
-
children = get_all_nonabstract_subclasses(cls)
|
|
104
|
-
return sorted(children, key=lambda cls: cls.__name__)
|
|
105
|
-
|
|
106
|
-
def set_current_page(self, page_cls: type["BasePage"]) -> None:
|
|
107
|
-
"""Set the current page in the stack.
|
|
108
|
-
|
|
109
|
-
Args:
|
|
110
|
-
page_cls: The page class to set as current.
|
|
111
|
-
"""
|
|
112
|
-
self.get_stack().setCurrentWidget(self.get_page(page_cls))
|
|
113
|
-
|
|
114
|
-
def get_stack(self) -> QStackedWidget:
|
|
115
|
-
"""Get the stack widget of the window.
|
|
116
|
-
|
|
117
|
-
Returns:
|
|
118
|
-
The QStackedWidget containing all pages.
|
|
119
|
-
"""
|
|
120
|
-
window = cast("BaseWindow", (getattr(self, "window", lambda: None)()))
|
|
121
|
-
|
|
122
|
-
return window.stack
|
|
123
|
-
|
|
124
|
-
def get_stack_pages(self) -> list["BasePage"]:
|
|
125
|
-
"""Get all pages from the stack.
|
|
126
|
-
|
|
127
|
-
Returns:
|
|
128
|
-
A list of all pages currently in the stack.
|
|
129
|
-
"""
|
|
130
|
-
# Import here to avoid circular import
|
|
131
|
-
|
|
132
|
-
stack = self.get_stack()
|
|
133
|
-
# get all the pages
|
|
134
|
-
return [cast("BasePage", stack.widget(i)) for i in range(stack.count())]
|
|
135
|
-
|
|
136
|
-
def get_page[T: "BasePage"](self, page_cls: type[T]) -> T:
|
|
137
|
-
"""Get a specific page from the stack.
|
|
138
|
-
|
|
139
|
-
Args:
|
|
140
|
-
page_cls: The class of the page to retrieve.
|
|
141
|
-
|
|
142
|
-
Returns:
|
|
143
|
-
The page instance of the specified class.
|
|
144
|
-
"""
|
|
145
|
-
page = next(
|
|
146
|
-
page for page in self.get_stack_pages() if page.__class__ is page_cls
|
|
147
|
-
)
|
|
148
|
-
return cast("T", page)
|
|
149
|
-
|
|
150
|
-
@classmethod
|
|
151
|
-
def get_svg_icon(cls, svg_name: str, package: ModuleType | None = None) -> QIcon:
|
|
152
|
-
"""Get a QIcon for an SVG file.
|
|
153
|
-
|
|
154
|
-
Args:
|
|
155
|
-
svg_name: The name of the SVG file.
|
|
156
|
-
package: The package to search for the SVG in. If None,
|
|
157
|
-
searches in the main package.
|
|
158
|
-
|
|
159
|
-
Returns:
|
|
160
|
-
A QIcon created from the SVG file.
|
|
161
|
-
"""
|
|
162
|
-
return QIcon(str(get_svg_path(svg_name, package=package)))
|
|
163
|
-
|
|
164
|
-
@classmethod
|
|
165
|
-
def get_page_static[T: "BasePage"](cls, page_cls: type[T]) -> T:
|
|
166
|
-
"""Get a page statically from the main window.
|
|
167
|
-
|
|
168
|
-
Args:
|
|
169
|
-
page_cls: The class of the page to retrieve.
|
|
170
|
-
|
|
171
|
-
Returns:
|
|
172
|
-
The page instance of the specified class from the main window.
|
|
173
|
-
"""
|
|
174
|
-
from winipedia_utils.pyside.ui.windows.base.base import Base as BaseWindow
|
|
175
|
-
|
|
176
|
-
top_level_widgets = QApplication.topLevelWidgets()
|
|
177
|
-
main_window = next(
|
|
178
|
-
widget for widget in top_level_widgets if isinstance(widget, BaseWindow)
|
|
179
|
-
)
|
|
180
|
-
return main_window.get_page(page_cls)
|
|
1
|
+
"""Base UI module.
|
|
2
|
+
|
|
3
|
+
This module contains the base UI class for the VideoVault application.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from abc import abstractmethod
|
|
7
|
+
from types import ModuleType
|
|
8
|
+
from typing import TYPE_CHECKING, Any, Self, cast
|
|
9
|
+
|
|
10
|
+
from PySide6.QtCore import QObject
|
|
11
|
+
from PySide6.QtGui import QIcon
|
|
12
|
+
from PySide6.QtWidgets import QApplication, QStackedWidget
|
|
13
|
+
|
|
14
|
+
from winipedia_utils.modules.class_ import (
|
|
15
|
+
get_all_nonabstract_subclasses,
|
|
16
|
+
)
|
|
17
|
+
from winipedia_utils.modules.package import get_main_package, walk_package
|
|
18
|
+
from winipedia_utils.oop.mixins.meta import ABCLoggingMeta
|
|
19
|
+
from winipedia_utils.resources.svgs.svg import get_svg_path
|
|
20
|
+
from winipedia_utils.text.string import split_on_uppercase
|
|
21
|
+
|
|
22
|
+
# Avoid circular import
|
|
23
|
+
if TYPE_CHECKING:
|
|
24
|
+
from winipedia_utils.pyside.ui.pages.base.base import Base as BasePage
|
|
25
|
+
from winipedia_utils.pyside.ui.windows.base.base import Base as BaseWindow
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class QABCLoggingMeta(
|
|
29
|
+
ABCLoggingMeta,
|
|
30
|
+
type(QObject), # type: ignore[misc]
|
|
31
|
+
):
|
|
32
|
+
"""Metaclass for the QABCImplementationLoggingMixin."""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Base(metaclass=QABCLoggingMeta):
|
|
36
|
+
"""Base UI class for a Qt application."""
|
|
37
|
+
|
|
38
|
+
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
|
39
|
+
"""Initialize the base UI."""
|
|
40
|
+
super().__init__(*args, **kwargs)
|
|
41
|
+
self.base_setup()
|
|
42
|
+
self.pre_setup()
|
|
43
|
+
self.setup()
|
|
44
|
+
self.post_setup()
|
|
45
|
+
|
|
46
|
+
@abstractmethod
|
|
47
|
+
def base_setup(self) -> None:
|
|
48
|
+
"""Setup the base Qt object of the UI.
|
|
49
|
+
|
|
50
|
+
This method should initialize the core Qt components required
|
|
51
|
+
for the UI to function properly.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
@abstractmethod
|
|
55
|
+
def setup(self) -> None:
|
|
56
|
+
"""Setup the main UI components.
|
|
57
|
+
|
|
58
|
+
This method should contain the primary UI initialization logic.
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
@abstractmethod
|
|
62
|
+
def pre_setup(self) -> None:
|
|
63
|
+
"""Setup operations to run before main setup.
|
|
64
|
+
|
|
65
|
+
This method should contain any initialization that needs to happen
|
|
66
|
+
before the main setup method is called.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
@abstractmethod
|
|
70
|
+
def post_setup(self) -> None:
|
|
71
|
+
"""Setup operations to run after main setup.
|
|
72
|
+
|
|
73
|
+
This method should contain any finalization that needs to happen
|
|
74
|
+
after the main setup method is called.
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def get_display_name(cls) -> str:
|
|
79
|
+
"""Get the display name of the UI.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
The human-readable display name derived from the class name.
|
|
83
|
+
"""
|
|
84
|
+
return " ".join(split_on_uppercase(cls.__name__))
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def get_subclasses(cls, package: ModuleType | None = None) -> list[type[Self]]:
|
|
88
|
+
"""Get all subclasses of the UI.
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
package: The package to search for subclasses in. If None,
|
|
92
|
+
searches in the main package.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
A sorted list of all non-abstract subclasses.
|
|
96
|
+
"""
|
|
97
|
+
if package is None:
|
|
98
|
+
# find the main package
|
|
99
|
+
package = get_main_package()
|
|
100
|
+
|
|
101
|
+
_ = list(walk_package(package))
|
|
102
|
+
|
|
103
|
+
children = get_all_nonabstract_subclasses(cls)
|
|
104
|
+
return sorted(children, key=lambda cls: cls.__name__)
|
|
105
|
+
|
|
106
|
+
def set_current_page(self, page_cls: type["BasePage"]) -> None:
|
|
107
|
+
"""Set the current page in the stack.
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
page_cls: The page class to set as current.
|
|
111
|
+
"""
|
|
112
|
+
self.get_stack().setCurrentWidget(self.get_page(page_cls))
|
|
113
|
+
|
|
114
|
+
def get_stack(self) -> QStackedWidget:
|
|
115
|
+
"""Get the stack widget of the window.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
The QStackedWidget containing all pages.
|
|
119
|
+
"""
|
|
120
|
+
window = cast("BaseWindow", (getattr(self, "window", lambda: None)()))
|
|
121
|
+
|
|
122
|
+
return window.stack
|
|
123
|
+
|
|
124
|
+
def get_stack_pages(self) -> list["BasePage"]:
|
|
125
|
+
"""Get all pages from the stack.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
A list of all pages currently in the stack.
|
|
129
|
+
"""
|
|
130
|
+
# Import here to avoid circular import
|
|
131
|
+
|
|
132
|
+
stack = self.get_stack()
|
|
133
|
+
# get all the pages
|
|
134
|
+
return [cast("BasePage", stack.widget(i)) for i in range(stack.count())]
|
|
135
|
+
|
|
136
|
+
def get_page[T: "BasePage"](self, page_cls: type[T]) -> T:
|
|
137
|
+
"""Get a specific page from the stack.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
page_cls: The class of the page to retrieve.
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
The page instance of the specified class.
|
|
144
|
+
"""
|
|
145
|
+
page = next(
|
|
146
|
+
page for page in self.get_stack_pages() if page.__class__ is page_cls
|
|
147
|
+
)
|
|
148
|
+
return cast("T", page)
|
|
149
|
+
|
|
150
|
+
@classmethod
|
|
151
|
+
def get_svg_icon(cls, svg_name: str, package: ModuleType | None = None) -> QIcon:
|
|
152
|
+
"""Get a QIcon for an SVG file.
|
|
153
|
+
|
|
154
|
+
Args:
|
|
155
|
+
svg_name: The name of the SVG file.
|
|
156
|
+
package: The package to search for the SVG in. If None,
|
|
157
|
+
searches in the main package.
|
|
158
|
+
|
|
159
|
+
Returns:
|
|
160
|
+
A QIcon created from the SVG file.
|
|
161
|
+
"""
|
|
162
|
+
return QIcon(str(get_svg_path(svg_name, package=package)))
|
|
163
|
+
|
|
164
|
+
@classmethod
|
|
165
|
+
def get_page_static[T: "BasePage"](cls, page_cls: type[T]) -> T:
|
|
166
|
+
"""Get a page statically from the main window.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
page_cls: The class of the page to retrieve.
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
The page instance of the specified class from the main window.
|
|
173
|
+
"""
|
|
174
|
+
from winipedia_utils.pyside.ui.windows.base.base import Base as BaseWindow
|
|
175
|
+
|
|
176
|
+
top_level_widgets = QApplication.topLevelWidgets()
|
|
177
|
+
main_window = next(
|
|
178
|
+
widget for widget in top_level_widgets if isinstance(widget, BaseWindow)
|
|
179
|
+
)
|
|
180
|
+
return main_window.get_page(page_cls)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"""__init__ module."""
|
|
1
|
+
"""__init__ module."""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"""__init__ module."""
|
|
1
|
+
"""__init__ module."""
|
|
@@ -1,92 +1,92 @@
|
|
|
1
|
-
"""Base page module.
|
|
2
|
-
|
|
3
|
-
This module contains the base page class for the VideoVault application.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from functools import partial
|
|
7
|
-
from typing import TYPE_CHECKING, Any
|
|
8
|
-
|
|
9
|
-
from PySide6.QtCore import Qt
|
|
10
|
-
from PySide6.QtWidgets import (
|
|
11
|
-
QHBoxLayout,
|
|
12
|
-
QLayout,
|
|
13
|
-
QMenu,
|
|
14
|
-
QPushButton,
|
|
15
|
-
QSizePolicy,
|
|
16
|
-
QVBoxLayout,
|
|
17
|
-
QWidget,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
from winipedia_utils.pyside.ui.base.base import Base as BaseUI
|
|
21
|
-
|
|
22
|
-
if TYPE_CHECKING:
|
|
23
|
-
from winipedia_utils.pyside.ui.windows.base.base import Base as BaseWindow
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class Base(BaseUI, QWidget):
|
|
27
|
-
"""Base page class for the VideoVault application."""
|
|
28
|
-
|
|
29
|
-
def __init__(self, base_window: "BaseWindow", *args: Any, **kwargs: Any) -> None:
|
|
30
|
-
"""Initialize the base page."""
|
|
31
|
-
self.base_window = base_window
|
|
32
|
-
super().__init__(*args, **kwargs)
|
|
33
|
-
|
|
34
|
-
def base_setup(self) -> None:
|
|
35
|
-
"""Setup the base Qt object of the UI.
|
|
36
|
-
|
|
37
|
-
Initializes the main vertical layout, adds a horizontal layout for the top row,
|
|
38
|
-
and sets up the menu dropdown button.
|
|
39
|
-
"""
|
|
40
|
-
self.v_layout = QVBoxLayout()
|
|
41
|
-
self.setLayout(self.v_layout)
|
|
42
|
-
|
|
43
|
-
# add a horizontal layout for the top row
|
|
44
|
-
self.h_layout = QHBoxLayout()
|
|
45
|
-
self.v_layout.addLayout(self.h_layout)
|
|
46
|
-
|
|
47
|
-
self.add_menu_dropdown_button()
|
|
48
|
-
self.base_window.add_page(self)
|
|
49
|
-
|
|
50
|
-
def add_menu_dropdown_button(self) -> None:
|
|
51
|
-
"""Add a dropdown menu that leads to each page.
|
|
52
|
-
|
|
53
|
-
Creates a menu button with a dropdown containing actions for all available
|
|
54
|
-
page subclasses. Each action connects to the set_current_page method.
|
|
55
|
-
"""
|
|
56
|
-
self.menu_button = QPushButton("Menu")
|
|
57
|
-
self.menu_button.setIcon(self.get_svg_icon("menu_icon"))
|
|
58
|
-
self.menu_button.setSizePolicy(
|
|
59
|
-
QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum
|
|
60
|
-
)
|
|
61
|
-
self.h_layout.addWidget(
|
|
62
|
-
self.menu_button,
|
|
63
|
-
alignment=Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignLeft,
|
|
64
|
-
)
|
|
65
|
-
self.menu_dropdown = QMenu(self.menu_button)
|
|
66
|
-
self.menu_button.setMenu(self.menu_dropdown)
|
|
67
|
-
|
|
68
|
-
for page_cls in self.base_window.get_all_page_classes():
|
|
69
|
-
action = self.menu_dropdown.addAction(page_cls.get_display_name())
|
|
70
|
-
action.triggered.connect(partial(self.set_current_page, page_cls))
|
|
71
|
-
|
|
72
|
-
def add_to_page_button(
|
|
73
|
-
self, to_page_cls: type["Base"], layout: QLayout
|
|
74
|
-
) -> QPushButton:
|
|
75
|
-
"""Add a button to go to the specified page.
|
|
76
|
-
|
|
77
|
-
Args:
|
|
78
|
-
to_page_cls: The page class to navigate to when button is clicked.
|
|
79
|
-
layout: The layout to add the button to.
|
|
80
|
-
|
|
81
|
-
Returns:
|
|
82
|
-
The created QPushButton widget.
|
|
83
|
-
"""
|
|
84
|
-
button = QPushButton(to_page_cls.get_display_name())
|
|
85
|
-
|
|
86
|
-
# connect to open page on click
|
|
87
|
-
button.clicked.connect(lambda: self.set_current_page(to_page_cls))
|
|
88
|
-
|
|
89
|
-
# add to layout
|
|
90
|
-
layout.addWidget(button)
|
|
91
|
-
|
|
92
|
-
return button
|
|
1
|
+
"""Base page module.
|
|
2
|
+
|
|
3
|
+
This module contains the base page class for the VideoVault application.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from functools import partial
|
|
7
|
+
from typing import TYPE_CHECKING, Any
|
|
8
|
+
|
|
9
|
+
from PySide6.QtCore import Qt
|
|
10
|
+
from PySide6.QtWidgets import (
|
|
11
|
+
QHBoxLayout,
|
|
12
|
+
QLayout,
|
|
13
|
+
QMenu,
|
|
14
|
+
QPushButton,
|
|
15
|
+
QSizePolicy,
|
|
16
|
+
QVBoxLayout,
|
|
17
|
+
QWidget,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
from winipedia_utils.pyside.ui.base.base import Base as BaseUI
|
|
21
|
+
|
|
22
|
+
if TYPE_CHECKING:
|
|
23
|
+
from winipedia_utils.pyside.ui.windows.base.base import Base as BaseWindow
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class Base(BaseUI, QWidget):
|
|
27
|
+
"""Base page class for the VideoVault application."""
|
|
28
|
+
|
|
29
|
+
def __init__(self, base_window: "BaseWindow", *args: Any, **kwargs: Any) -> None:
|
|
30
|
+
"""Initialize the base page."""
|
|
31
|
+
self.base_window = base_window
|
|
32
|
+
super().__init__(*args, **kwargs)
|
|
33
|
+
|
|
34
|
+
def base_setup(self) -> None:
|
|
35
|
+
"""Setup the base Qt object of the UI.
|
|
36
|
+
|
|
37
|
+
Initializes the main vertical layout, adds a horizontal layout for the top row,
|
|
38
|
+
and sets up the menu dropdown button.
|
|
39
|
+
"""
|
|
40
|
+
self.v_layout = QVBoxLayout()
|
|
41
|
+
self.setLayout(self.v_layout)
|
|
42
|
+
|
|
43
|
+
# add a horizontal layout for the top row
|
|
44
|
+
self.h_layout = QHBoxLayout()
|
|
45
|
+
self.v_layout.addLayout(self.h_layout)
|
|
46
|
+
|
|
47
|
+
self.add_menu_dropdown_button()
|
|
48
|
+
self.base_window.add_page(self)
|
|
49
|
+
|
|
50
|
+
def add_menu_dropdown_button(self) -> None:
|
|
51
|
+
"""Add a dropdown menu that leads to each page.
|
|
52
|
+
|
|
53
|
+
Creates a menu button with a dropdown containing actions for all available
|
|
54
|
+
page subclasses. Each action connects to the set_current_page method.
|
|
55
|
+
"""
|
|
56
|
+
self.menu_button = QPushButton("Menu")
|
|
57
|
+
self.menu_button.setIcon(self.get_svg_icon("menu_icon"))
|
|
58
|
+
self.menu_button.setSizePolicy(
|
|
59
|
+
QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Minimum
|
|
60
|
+
)
|
|
61
|
+
self.h_layout.addWidget(
|
|
62
|
+
self.menu_button,
|
|
63
|
+
alignment=Qt.AlignmentFlag.AlignTop | Qt.AlignmentFlag.AlignLeft,
|
|
64
|
+
)
|
|
65
|
+
self.menu_dropdown = QMenu(self.menu_button)
|
|
66
|
+
self.menu_button.setMenu(self.menu_dropdown)
|
|
67
|
+
|
|
68
|
+
for page_cls in self.base_window.get_all_page_classes():
|
|
69
|
+
action = self.menu_dropdown.addAction(page_cls.get_display_name())
|
|
70
|
+
action.triggered.connect(partial(self.set_current_page, page_cls))
|
|
71
|
+
|
|
72
|
+
def add_to_page_button(
|
|
73
|
+
self, to_page_cls: type["Base"], layout: QLayout
|
|
74
|
+
) -> QPushButton:
|
|
75
|
+
"""Add a button to go to the specified page.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
to_page_cls: The page class to navigate to when button is clicked.
|
|
79
|
+
layout: The layout to add the button to.
|
|
80
|
+
|
|
81
|
+
Returns:
|
|
82
|
+
The created QPushButton widget.
|
|
83
|
+
"""
|
|
84
|
+
button = QPushButton(to_page_cls.get_display_name())
|
|
85
|
+
|
|
86
|
+
# connect to open page on click
|
|
87
|
+
button.clicked.connect(lambda: self.set_current_page(to_page_cls))
|
|
88
|
+
|
|
89
|
+
# add to layout
|
|
90
|
+
layout.addWidget(button)
|
|
91
|
+
|
|
92
|
+
return button
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"""Add downloads page module.
|
|
2
|
-
|
|
3
|
-
This module contains the add downloads page class for the VideoVault application.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
from winipedia_utils.pyside.ui.pages.base.base import Base as BasePage
|
|
7
|
-
from winipedia_utils.pyside.ui.widgets.browser import Browser as BrowserWidget
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
class Browser(BasePage):
|
|
11
|
-
"""Add downloads page for the VideoVault application."""
|
|
12
|
-
|
|
13
|
-
def setup(self) -> None:
|
|
14
|
-
"""Setup the UI.
|
|
15
|
-
|
|
16
|
-
Initializes the browser page by adding a browser widget to the layout.
|
|
17
|
-
"""
|
|
18
|
-
self.add_brwoser()
|
|
19
|
-
|
|
20
|
-
def add_brwoser(self) -> None:
|
|
21
|
-
"""Add a browser to surf the web.
|
|
22
|
-
|
|
23
|
-
Creates and adds a BrowserWidget instance to the vertical layout,
|
|
24
|
-
enabling web browsing functionality within the page.
|
|
25
|
-
"""
|
|
26
|
-
self.browser = BrowserWidget(self.v_layout)
|
|
1
|
+
"""Add downloads page module.
|
|
2
|
+
|
|
3
|
+
This module contains the add downloads page class for the VideoVault application.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from winipedia_utils.pyside.ui.pages.base.base import Base as BasePage
|
|
7
|
+
from winipedia_utils.pyside.ui.widgets.browser import Browser as BrowserWidget
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Browser(BasePage):
|
|
11
|
+
"""Add downloads page for the VideoVault application."""
|
|
12
|
+
|
|
13
|
+
def setup(self) -> None:
|
|
14
|
+
"""Setup the UI.
|
|
15
|
+
|
|
16
|
+
Initializes the browser page by adding a browser widget to the layout.
|
|
17
|
+
"""
|
|
18
|
+
self.add_brwoser()
|
|
19
|
+
|
|
20
|
+
def add_brwoser(self) -> None:
|
|
21
|
+
"""Add a browser to surf the web.
|
|
22
|
+
|
|
23
|
+
Creates and adds a BrowserWidget instance to the vertical layout,
|
|
24
|
+
enabling web browsing functionality within the page.
|
|
25
|
+
"""
|
|
26
|
+
self.browser = BrowserWidget(self.v_layout)
|