Skip to content

Commit

Permalink
Merge pull request #2051 from cgl/add-divider-widget
Browse files Browse the repository at this point in the history
Add a web widget for divider
  • Loading branch information
freakboy3742 authored Jul 26, 2023
2 parents 2c20a4e + f4483a7 commit 0d94690
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
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")

0 comments on commit 0d94690

Please sign in to comment.