Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a web widget for divider #2051

Merged
merged 4 commits into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/2051.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Divider web widget implementation introduced.
5 changes: 4 additions & 1 deletion web/src/toga_web/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from .paths import Paths
from .widgets.box import Box
from .widgets.button import Button
from .widgets.divider import Divider

# from .widgets.canvas import Canvas
# from .widgets.detailedlist import DetailedList
Expand Down Expand Up @@ -43,7 +44,8 @@ def not_implemented(feature):
__all__ = [
"not_implemented",
"App",
"MainWindow", # 'DocumentApp',
"MainWindow",
# 'DocumentApp',
"Command",
# 'Document',
# # Resources
Expand All @@ -56,6 +58,7 @@ def not_implemented(feature):
"Box",
"Button",
# 'Canvas',
"Divider",
# 'DetailedList',
# 'ImageView',
"Label",
Expand Down
17 changes: 17 additions & 0 deletions web/src/toga_web/widgets/divider.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from toga.constants import Direction

from .base import Widget


class Divider(Widget):
def create(self):
self.native = self._create_native_widget("sl-divider")

def get_direction(self):
return self.interface.direction

def set_direction(self, value):
if value is Direction.VERTICAL:
self.native.setAttribute("vertical", "")
else:
self.native.removeAttribute("vertical")