componentsv2 0.3.0__tar.gz → 0.3.2__tar.gz
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.
- {componentsv2-0.3.0 → componentsv2-0.3.2}/PKG-INFO +1 -1
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/holders/container.py +20 -2
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2.egg-info/PKG-INFO +1 -1
- {componentsv2-0.3.0 → componentsv2-0.3.2}/pyproject.toml +1 -1
- {componentsv2-0.3.0 → componentsv2-0.3.2}/LICENSE.txt +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/README.md +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/__init__.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/component_holder.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/__init__.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/action_row.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/base.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/button.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/checkbox.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/file_upload.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/gallery.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/holders/__init__.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/holders/label.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/holders/nestable.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/holders/section.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/media.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/radio_group.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/select.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/separator.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/text_display.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/components/text_input.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/utils/__init__.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/utils/serialize.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2/wrapper.py +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2.egg-info/SOURCES.txt +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2.egg-info/dependency_links.txt +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2.egg-info/requires.txt +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/componentsv2.egg-info/top_level.txt +0 -0
- {componentsv2-0.3.0 → componentsv2-0.3.2}/setup.cfg +0 -0
|
@@ -7,7 +7,10 @@ from ..text_display import TextDisplay
|
|
|
7
7
|
from typing import Optional
|
|
8
8
|
|
|
9
9
|
class Container(Nestable):
|
|
10
|
-
def __init__(self, components: list[ComponentV2] =
|
|
10
|
+
def __init__(self, components: list[ComponentV2] = None, accent_color: int = None, spoiler: bool = None, id: Optional[int] = None):
|
|
11
|
+
if components is None:
|
|
12
|
+
components = []
|
|
13
|
+
|
|
11
14
|
for component in components:
|
|
12
15
|
if hasattr(component, "__container_compatible__") == False:
|
|
13
16
|
raise TypeError(f"Component {component.__class__.__name__} not accepted in Containers!")
|
|
@@ -16,6 +19,8 @@ class Container(Nestable):
|
|
|
16
19
|
|
|
17
20
|
self.accent_color = accent_color
|
|
18
21
|
self.spoiler = spoiler
|
|
22
|
+
|
|
23
|
+
self.footer = None
|
|
19
24
|
|
|
20
25
|
def get_row(self, row: int) -> tuple[int, ActionRow]:
|
|
21
26
|
total_rows = -1
|
|
@@ -41,10 +46,14 @@ class Container(Nestable):
|
|
|
41
46
|
|
|
42
47
|
return self.append_component(action_row)
|
|
43
48
|
else:
|
|
44
|
-
IndexError("Action rows must be created sequentially!")
|
|
49
|
+
raise IndexError("Action rows must be created sequentially!")
|
|
45
50
|
|
|
46
51
|
self.components.append(component)
|
|
47
52
|
|
|
53
|
+
if self.footer is not None:
|
|
54
|
+
self.components.remove(self.footer)
|
|
55
|
+
self.components.append(self.footer)
|
|
56
|
+
|
|
48
57
|
return self
|
|
49
58
|
|
|
50
59
|
def add_field(self, title: str, content: str):
|
|
@@ -54,6 +63,15 @@ class Container(Nestable):
|
|
|
54
63
|
)
|
|
55
64
|
)
|
|
56
65
|
|
|
66
|
+
def set_footer(self, footer: str):
|
|
67
|
+
if self.footer is not None:
|
|
68
|
+
self.components.remove(self.footer)
|
|
69
|
+
|
|
70
|
+
self.footer = TextDisplay(f"-# {footer}")
|
|
71
|
+
self.components.append(
|
|
72
|
+
self.footer
|
|
73
|
+
)
|
|
74
|
+
|
|
57
75
|
def serialize(self):
|
|
58
76
|
base_dict = super().serialize()
|
|
59
77
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|