1010from ..utils import find , get
1111from .button import Button
1212from .file import File
13- from .item import Item , ItemCallbackType
13+ from .item import ViewItem , ItemCallbackType
1414from .select import Select
1515
1616__all__ = ("ActionRow" ,)
2828V = TypeVar ("V" , bound = "DesignerView" , covariant = True )
2929
3030
31- class ActionRow (Item [V ]):
31+ class ActionRow (ViewItem [V ]):
3232 """Represents a UI Action Row used in :class:`discord.ui.DesignerView`.
3333
3434 The items supported are as follows:
@@ -40,7 +40,7 @@ class ActionRow(Item[V]):
4040
4141 Parameters
4242 ----------
43- *items: :class:`Item `
43+ *items: :class:`ViewItem `
4444 The initial items in this action row.
4545 id: Optional[:class:`int`]
4646 The action's ID.
@@ -64,12 +64,12 @@ def __init_subclass__(cls) -> None:
6464
6565 def __init__ (
6666 self ,
67- * items : Item ,
67+ * items : ViewItem ,
6868 id : int | None = None ,
6969 ):
7070 super ().__init__ ()
7171
72- self .children : list [Item ] = []
72+ self .children : list [ViewItem ] = []
7373
7474 self ._underlying = ActionRowComponent ._raw_construct (
7575 type = ComponentType .action_row ,
@@ -78,7 +78,7 @@ def __init__(
7878 )
7979
8080 for func in self .__row_children_items__ :
81- item : Item = func .__discord_ui_model_type__ (
81+ item : ViewItem = func .__discord_ui_model_type__ (
8282 ** func .__discord_ui_model_kwargs__
8383 )
8484 item .callback = partial (func , self , item )
@@ -87,26 +87,26 @@ def __init__(
8787 for i in items :
8888 self .add_item (i )
8989
90- def _add_component_from_item (self , item : Item ):
90+ def _add_component_from_item (self , item : ViewItem ):
9191 self ._underlying .children .append (item ._underlying )
9292
93- def _set_components (self , items : list [Item ]):
93+ def _set_components (self , items : list [ViewItem ]):
9494 self ._underlying .children .clear ()
9595 for item in items :
9696 self ._add_component_from_item (item )
9797
98- def add_item (self , item : Item ) -> Self :
98+ def add_item (self , item : ViewItem ) -> Self :
9999 """Adds an item to the action row.
100100
101101 Parameters
102102 ----------
103- item: :class:`Item `
103+ item: :class:`ViewItem `
104104 The item to add to the action row.
105105
106106 Raises
107107 ------
108108 TypeError
109- An :class:`Item ` was not passed.
109+ A :class:`ViewItem ` was not passed.
110110 """
111111
112112 if not isinstance (item , (Select , Button )):
@@ -123,12 +123,12 @@ def add_item(self, item: Item) -> Self:
123123 self ._add_component_from_item (item )
124124 return self
125125
126- def remove_item (self , item : Item | str | int ) -> Self :
126+ def remove_item (self , item : ViewItem | str | int ) -> Self :
127127 """Removes an item from the action row. If an int or str is passed, it will remove by Item :attr:`id` or ``custom_id`` respectively.
128128
129129 Parameters
130130 ----------
131- item: Union[:class:`Item `, :class:`int`, :class:`str`]
131+ item: Union[:class:`ViewItem `, :class:`int`, :class:`str`]
132132 The item, ``id``, or item ``custom_id`` to remove from the action row.
133133 """
134134
@@ -140,7 +140,7 @@ def remove_item(self, item: Item | str | int) -> Self:
140140 pass
141141 return self
142142
143- def get_item (self , id : str | int ) -> Item | None :
143+ def get_item (self , id : str | int ) -> ViewItem | None :
144144 """Get an item from this action row. Roughly equivalent to `utils.get(row.children, ...)`.
145145 If an ``int`` is provided, the item will be retrieved by ``id``, otherwise by ``custom_id``.
146146
@@ -151,7 +151,7 @@ def get_item(self, id: str | int) -> Item | None:
151151
152152 Returns
153153 -------
154- Optional[:class:`Item `]
154+ Optional[:class:`ViewItem `]
155155 The item with the matching ``id`` or ``custom_id`` if it exists.
156156 """
157157 if not id :
@@ -327,7 +327,7 @@ def add_select(
327327
328328 return self .add_item (select )
329329
330- @Item .view .setter
330+ @ViewItem .view .setter
331331 def view (self , value ):
332332 self ._view = value
333333 for item in self .children :
@@ -352,27 +352,27 @@ def refresh_component(self, component: ActionRowComponent) -> None:
352352 x .refresh_component (y )
353353 i += 1
354354
355- def disable_all_items (self , * , exclusions : list [Item ] | None = None ) -> Self :
355+ def disable_all_items (self , * , exclusions : list [ViewItem ] | None = None ) -> Self :
356356 """
357357 Disables all items in the row.
358358
359359 Parameters
360360 ----------
361- exclusions: Optional[List[:class:`Item `]]
361+ exclusions: Optional[List[:class:`ViewItem `]]
362362 A list of items in `self.children` to not disable.
363363 """
364364 for item in self .walk_items ():
365365 if exclusions is None or item not in exclusions :
366366 item .disabled = True
367367 return self
368368
369- def enable_all_items (self , * , exclusions : list [Item ] | None = None ) -> Self :
369+ def enable_all_items (self , * , exclusions : list [ViewItem ] | None = None ) -> Self :
370370 """
371371 Enables all items in the row.
372372
373373 Parameters
374374 ----------
375- exclusions: Optional[List[:class:`Item `]]
375+ exclusions: Optional[List[:class:`ViewItem `]]
376376 A list of items in `self.children` to not enable.
377377 """
378378 for item in self .walk_items ():
@@ -388,7 +388,7 @@ def width(self):
388388 t += 1 if item ._underlying .type is ComponentType .button else 5
389389 return t
390390
391- def walk_items (self ) -> Iterator [Item ]:
391+ def walk_items (self ) -> Iterator [ViewItem ]:
392392 yield from self .children
393393
394394 def to_component_dict (self ) -> ActionRowPayload :
0 commit comments