Skip to content

Commit

Permalink
Merge pull request #2939 from mhsmith/widget-id-docs
Browse files Browse the repository at this point in the history
Rephrase web-specific language in docs
  • Loading branch information
freakboy3742 authored Nov 2, 2024
2 parents 18d6559 + e41b761 commit 7c567f4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
1 change: 1 addition & 0 deletions changes/2939.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Rephrase web-specific language in docs.
5 changes: 1 addition & 4 deletions core/src/toga/widgets/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ def __lt__(self, other: Widget) -> bool:

@property
def id(self) -> str:
"""The DOM identifier for the widget.
This id can be used to target CSS directives.
"""
"""A unique identifier for the widget."""
return self._id

@property
Expand Down
20 changes: 10 additions & 10 deletions docs/reference/style/pack.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ Pack style properties

**Initial value:** ``pack``

Used to define the how to display the element. A value of ``pack`` will apply
Used to define how to display the widget. A value of ``pack`` will apply
the pack layout algorithm to this node and its descendants. A value of
``none`` removes the element from the layout entirely. Space will be allocated
for the element as if it were there, but the element itself will not be
``none`` removes the widget from the layout entirely. Space will be allocated
for the widget as if it were there, but the widget itself will not be
visible.

``visibility``
Expand All @@ -42,13 +42,13 @@ visible.

**Initial value:** ``visible``

Used to define whether the element should be drawn. A value of ``visible`` means
the element will be displayed. A value of ``hidden`` removes the element from
view, but allocates space for the element as if it were still in the layout.
Used to define whether the widget should be drawn. A value of ``visible`` means
the widget will be displayed. A value of ``hidden`` removes the widget from
view, but allocates space for the widget as if it were still in the layout.

Any children of a hidden element are implicitly removed from view.
Any children of a hidden widget are implicitly removed from view.

If a previously hidden element is made visible, any children of the element with
If a previously hidden widget is made visible, any children of the widget with
a visibility of ``hidden`` will remain hidden. Any descendants of the hidden
child will also remain hidden, regardless of their visibility.

Expand Down Expand Up @@ -309,14 +309,14 @@ The mapping that can be used to establish the reference implementation is:
<body></body>
</html>

* The root element of the Pack layout can be mapped to the ``<body>`` element of
* The root widget of the Pack layout can be mapped to the ``<body>`` element of
the HTML reference document. The rendering area of the browser window becomes
the view area that Pack will fill.

* ImageViews map to ``<img>`` elements. The ``<img>`` element has an additional style of
``object-fit: contain`` unless *both* ``height`` and ``width`` are defined.

* All other elements in the DOM tree are mapped to ``<div>`` elements.
* All other widgets are mapped to ``<div>`` elements.

* The following Pack declarations can be mapped to equivalent CSS declarations:

Expand Down
6 changes: 3 additions & 3 deletions docs/tutorial/tutorial-0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ Now we will make the button take up all the available width::

button.style.flex = 1

The ``flex`` attribute specifies how an element is sized with respect to other
elements along its direction. The default direction is row (horizontal) and
since the button is the only element here, it will take up the whole width.
The ``flex`` attribute specifies how a widget is sized with respect to other
widgets along its direction. The default direction is row (horizontal) and
since the button is the only widget here, it will take up the whole width.
Check out `style docs
<https://toga.readthedocs.io/en/latest/reference/style/pack.html#flex>`_ for
more information on how to use the ``flex`` attribute.
Expand Down

0 comments on commit 7c567f4

Please sign in to comment.