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 all 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 @@
An implementation of Divider was added to the Web backend.
2 changes: 1 addition & 1 deletion docs/reference/data/widgets_by_platform.csv
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Button,General Widget,:class:`~toga.Button`,Basic clickable Button,|y|,|y|,|y|,|
Canvas,General Widget,:class:`~toga.Canvas`,Area you can draw on,|b|,|b|,|b|,|b|,,
DateInput,General Widget,:class:`~toga.DateInput`,A widget to select a calendar date,,,|y|,,|y|,
DetailedList,General Widget,:class:`~toga.DetailedList`,A list of complex content,|b|,|b|,,|b|,|b|,
Divider,General Widget,:class:`~toga.Divider`,A horizontal or vertical line,|y|,|y|,|y|,,,
Divider,General Widget,:class:`~toga.Divider`,A horizontal or vertical line,|y|,|y|,|y|,,,|b|
ImageView,General Widget,:class:`~toga.ImageView`,A widget that displays an image,|y|,|y|,|y|,|y|,|y|,
Label,General Widget,:class:`~toga.Label`,Text label,|y|,|y|,|y|,|y|,|y|,|b|
MultilineTextInput,General Widget,:class:`~toga.MultilineTextInput`,Multi-line Text Input field,|y|,|y|,|y|,|y|,|y|,
Expand Down
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")
Loading