Skip to content

Commit 2e538b6

Browse files
committed
pybricks.hubs: Change button to buttons.
Fixes pybricks/support#1254
1 parent b2b183e commit 2e538b6

File tree

12 files changed

+23
-21
lines changed

12 files changed

+23
-21
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
## Changed
88

99
- Updates for v3.4.0b3 firmware.
10+
- Changed `hub.button` to `hub.buttons` on single button hubs. Access via
11+
`hub.button` will keep working in the firmware for backwards compatibility.
1012

1113
## 3.4.0b4 - 2024-02-14
1214

doc/main/hubs/cityhub.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ City Hub
5555

5656
.. blockimg:: pybricks_blockButtonIsPressed_CityHub
5757

58-
.. automethod:: pybricks.hubs::CityHub.button.pressed
58+
.. automethod:: pybricks.hubs::CityHub.buttons.pressed
5959

6060
.. automethod:: pybricks.hubs::CityHub.system.set_stop_button
6161

doc/main/hubs/essentialhub.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Essential Hub
3232

3333
.. blockimg:: pybricks_blockButtonIsPressed_EssentialHub
3434

35-
.. automethod:: pybricks.hubs::EssentialHub.button.pressed
35+
.. automethod:: pybricks.hubs::EssentialHub.buttons.pressed
3636

3737
.. automethod:: pybricks.hubs::EssentialHub.system.set_stop_button
3838

doc/main/hubs/movehub.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ Move Hub
7777

7878
.. blockimg:: pybricks_blockButtonIsPressed_PrimeHub
7979

80-
.. automethod:: pybricks.hubs::MoveHub.button.pressed
80+
.. automethod:: pybricks.hubs::MoveHub.buttons.pressed
8181

8282
.. automethod:: pybricks.hubs::MoveHub.system.set_stop_button
8383

doc/main/hubs/technichub.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Technic Hub
9595

9696
.. blockimg:: pybricks_blockButtonIsPressed_TechnicHub
9797

98-
.. automethod:: pybricks.hubs::TechnicHub.button.pressed
98+
.. automethod:: pybricks.hubs::TechnicHub.buttons.pressed
9999

100100
.. automethod:: pybricks.hubs::TechnicHub.system.set_stop_button
101101

examples/pup/hub_common/button_single.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
while watch.time() < 5000:
1515

1616
# Set light to green if pressed, else red.
17-
if hub.button.pressed():
17+
if hub.buttons.pressed():
1818
hub.light.on(Color.GREEN)
1919
else:
2020
hub.light.on(Color.RED)

jedi/tests/test_complete_city_hub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_hub_dot():
3434
assert [c["insertText"] for c in completions] == [
3535
"battery",
3636
"ble",
37-
"button",
37+
"buttons",
3838
"light",
3939
"system",
4040
]
@@ -51,7 +51,7 @@ def test_hub_dot_battery_dot():
5151

5252

5353
def test_hub_dot_button_dot():
54-
line = "hub.button."
54+
line = "hub.buttons."
5555
code = _create_snippet(line)
5656
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
5757
assert [c["insertText"] for c in completions] == [

jedi/tests/test_complete_essential_hub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_hub_dot():
3434
assert [c["insertText"] for c in completions] == [
3535
"battery",
3636
"ble",
37-
"button",
37+
"buttons",
3838
"charger",
3939
"imu",
4040
"light",
@@ -53,7 +53,7 @@ def test_hub_dot_battery_dot():
5353

5454

5555
def test_hub_dot_buttons_dot():
56-
line = "hub.button."
56+
line = "hub.buttons."
5757
code = _create_snippet(line)
5858
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
5959
assert [c["insertText"] for c in completions] == [

jedi/tests/test_complete_move_hub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_hub_dot():
3434
assert [c["insertText"] for c in completions] == [
3535
"battery",
3636
"ble",
37-
"button",
37+
"buttons",
3838
"imu",
3939
"light",
4040
"system",
@@ -52,7 +52,7 @@ def test_hub_dot_battery_dot():
5252

5353

5454
def test_hub_dot_button_dot():
55-
line = "hub.button."
55+
line = "hub.buttons."
5656
code = _create_snippet(line)
5757
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
5858
assert [c["insertText"] for c in completions] == [

jedi/tests/test_complete_technic_hub.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_hub_dot():
3434
assert [c["insertText"] for c in completions] == [
3535
"battery",
3636
"ble",
37-
"button",
37+
"buttons",
3838
"imu",
3939
"light",
4040
"system",
@@ -52,7 +52,7 @@ def test_hub_dot_battery_dot():
5252

5353

5454
def test_hub_dot_button_dot():
55-
line = "hub.button."
55+
line = "hub.buttons."
5656
code = _create_snippet(line)
5757
completions: list[CompletionItem] = json.loads(complete(code, 3, len(line) + 1))
5858
assert [c["insertText"] for c in completions] == [

0 commit comments

Comments
 (0)