Skip to content

Commit

Permalink
fixup! Add a web widget for divider
Browse files Browse the repository at this point in the history
  • Loading branch information
cgl committed Jul 23, 2023
1 parent ad69616 commit 875faf7
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions web/src/toga_web/widgets/divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,30 @@ class Divider(Widget):
HORIZONTAL = Direction.HORIZONTAL
VERTICAL = Direction.VERTICAL

def __init__(
self,
interface,
):
"""Create a new divider line.
Inherits from :class:`base.Widget`.
:param id: The ID for the widget.
:param style: A style object. If no style is provided, a default style will be
applied to the widget.
:param direction: The direction in which the divider will be drawn. Either
:attr:`~toga.constants.Direction.HORIZONTAL` or
:attr:`~toga.constants.Direction.VERTICAL`; defaults to
:attr:`~toga.constants.Direction.HORIZONTAL`
"""
super().__init__(interface=interface)

# Set direction of the divider.
self.interface = interface

def create(
self,
direction: Direction = HORIZONTAL,
):
self._direction = direction
self.native = self._create_native_widget("sl-divider")

def get_direction(self):
Expand All @@ -27,7 +46,8 @@ def set_direction(self, value):
self._set_value("direction", value)

def _get_value(self):
return self._direction
return self.interface.direction

def _set_value(self, attr, value):
self._direction = value
pass
# self.interface.direction = value

0 comments on commit 875faf7

Please sign in to comment.