-
-
Notifications
You must be signed in to change notification settings - Fork 687
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
[widget audit] toga.Button #1761
Changes from 1 commit
92fd082
d206715
9fdf46e
38bd4d6
b541c09
7077562
ec04ddc
859ad48
f93158e
67f3374
ca8a760
8a03783
37985ae
2b9714e
2ea497e
c8e41b1
a07ebde
e6c3096
163fa97
8c24cbe
df7c13e
d1fdf8b
2e7f8d0
da9c1ba
50c4fee
4a2944f
fe92bb9
73f0c5a
2ff0e95
e6ed1c1
db63ecc
493e722
c3d5c8a
542faf7
d3581ec
e1458ba
32451bd
c788a8c
da5105a
5bf1cbb
29924f0
7e2bc2d
8211f8b
8cd8531
857d899
7bd87a5
16ec542
8bd9528
e83f2fa
81e2d29
02a345d
9248973
45e52e6
8445dae
c646ef0
e2da16b
926c3d6
7f96efa
36ed554
091e3ec
dd73a9b
cfdc3e5
ce54201
5abe2f1
f76c90a
8f55716
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,14 +29,8 @@ A button has a text label. A handler can be associated with button press events. | |
|
||
button = toga.Button('Click me', on_press=my_callback) | ||
|
||
Notes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should keep this as a "Notes" section. While the notes at present are all style related, we're very likely going to come across platform specific eccentricities that don't fit the description being "style", and don't map to a specific attribute like the text handling of |
||
----- | ||
* Any "truthy" object (i.e, object that evaluates as ``True``) can be provided | ||
as the text for the button; if the object is not a string, it will be | ||
automatically converted to a string using ``str()``. | ||
|
||
* The button text cannot contain newlines. Any content after the first newline | ||
will be ignored. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've moved the property documentation into the docstring so it'll appear next to the property itself, rather than in a separate section. |
||
Styles | ||
------ | ||
|
||
* A background color of ``TRANSPARENT`` will be treated as a reset of the button | ||
to the default system color. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,30 +15,6 @@ async def test_text(widget, probe): | |
assert probe.text == text | ||
|
||
|
||
async def test_text_empty(widget, probe): | ||
"The text displayed on a widget can be empty" | ||
# Set the text to the empty string | ||
widget.text = "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty strings are now covered by |
||
await probe.redraw() | ||
|
||
assert widget.text == "" | ||
assert probe.text == "" | ||
|
||
# Reset back to "actual" content | ||
widget.text = "Hello" | ||
await probe.redraw() | ||
|
||
assert widget.text == "Hello" | ||
assert probe.text == "Hello" | ||
|
||
# Set the text to None; renders as an empty string | ||
widget.text = None | ||
await probe.redraw() | ||
|
||
assert widget.text == "" | ||
assert probe.text == "" | ||
|
||
|
||
async def test_text_width_change(widget, probe): | ||
"If the widget text is changed, the width of the widget changes" | ||
orig_width = probe.width | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
test_font, | ||
test_font_attrs, | ||
test_text, | ||
test_text_empty, | ||
test_text_width_change, | ||
) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm generally against the introduction of interface state/shadow variables; in this case, the shadow variable is only required if we have problems round-tripping the original value. In this implementation we're not round tripping anyway (because we're losing
None
and multiline input); to support the winforms edge case, I'm entirely comfortable with a normalizing a user-supplied"\u0200"
(zero width space) to""
). It's highly unlikely to ever be user supplied in that form, and it's functionally indistinguishable from "".There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, but \u0200 is LATIN CAPITAL LETTER A WITH DOUBLE GRAVE. I've replaced that with \u200B.