Remove toggle_state method

This commit is contained in:
Vy Nguyen 2024-12-02 23:09:14 -08:00
parent 61f3aefb62
commit 6db3e465e8

View File

@ -242,13 +242,8 @@ class ContextMenuCheckBoxItem(RadixThemesComponent):
# Whether the checkbox is disabled. # Whether the checkbox is disabled.
disabled: Var[bool] disabled: Var[bool]
# Event handler for when the checkbox state changes. # Fired when the checkbox state changes.
on_check_change: EventHandler[passthrough_event_spec(bool)] on_check_change: EventHandler[passthrough_event_spec(bool)]
def toggle_state(self):
"""Toggle the checked state dynamically."""
if self.checked is not None:
self.checked.set(not self.checked.get())
class ContextMenu(ComponentNamespace): class ContextMenu(ComponentNamespace):
"""Menu representing a set of actions, displayed at the origin of a pointer right-click or long-press.""" """Menu representing a set of actions, displayed at the origin of a pointer right-click or long-press."""
@ -263,5 +258,4 @@ class ContextMenu(ComponentNamespace):
separator = staticmethod(ContextMenuSeparator.create) separator = staticmethod(ContextMenuSeparator.create)
checkbox_item = staticmethod(ContextMenuCheckBoxItem.create) checkbox_item = staticmethod(ContextMenuCheckBoxItem.create)
context_menu = ContextMenu() context_menu = ContextMenu()