@@ -772,6 +772,11 @@ class BlueDot(Dot):
772
772
bd.wait_for_press()
773
773
print("The button was pressed")
774
774
775
+ If there are multiple buttons, each button can be referenced using its [col, row]::
776
+
777
+ bd = BlueDot()
778
+ first_button = bd[0,0]
779
+
775
780
:param str device:
776
781
The Bluetooth device the server should use, the default is "hci0", if
777
782
your device only has 1 Bluetooth adapter this shouldn't need to be changed.
@@ -842,21 +847,9 @@ def __init__(self,
842
847
@property
843
848
def buttons (self ):
844
849
"""
845
- A dictionary of :class:`BlueDotButton` objects in the "grid".
846
-
847
- The key is [col,row].
848
-
849
- To return the 'first' button at grid position 0,0 ::
850
-
851
- bd = BlueDot()
852
- first_button = bd.buttons[0,0]
853
-
854
- Or alternatively:
855
-
856
- bd = BlueDot()
857
- first_button = bd[0,0]
850
+ A list of :class:`BlueDotButton` objects in the "grid".
858
851
"""
859
- return self ._buttons
852
+ return self ._buttons . values ()
860
853
861
854
@property
862
855
def cols (self ):
@@ -959,7 +952,7 @@ def is_pressed(self):
959
952
If there are multiple buttons, if any button is pressed, `True`
960
953
will be returned.
961
954
"""
962
- for button in self .buttons . values () :
955
+ for button in self .buttons :
963
956
if button ._is_pressed :
964
957
return True
965
958
@@ -999,7 +992,7 @@ def rotation_segments(self):
999
992
@rotation_segments .setter
1000
993
def rotation_segments (self , value ):
1001
994
super (BlueDot , self .__class__ ).rotation_segments .fset (self , value )
1002
- for button in self .buttons . values () :
995
+ for button in self .buttons :
1003
996
button .rotation_segments = value
1004
997
1005
998
@property
@@ -1017,7 +1010,7 @@ def double_press_time(self):
1017
1010
@double_press_time .setter
1018
1011
def double_press_time (self , value ):
1019
1012
super (BlueDot , self .__class__ ).double_press_time .fset (self , value )
1020
- for button in self .buttons . values () :
1013
+ for button in self .buttons :
1021
1014
button .double_press_time = value
1022
1015
1023
1016
@property
@@ -1044,7 +1037,7 @@ def color(self):
1044
1037
@color .setter
1045
1038
def color (self , value ):
1046
1039
super (BlueDot , self .__class__ ).color .fset (self , value )
1047
- for button in self .buttons . values () :
1040
+ for button in self .buttons :
1048
1041
button .color = value
1049
1042
1050
1043
@property
@@ -1062,7 +1055,7 @@ def square(self):
1062
1055
@square .setter
1063
1056
def square (self , value ):
1064
1057
super (BlueDot , self .__class__ ).square .fset (self , value )
1065
- for button in self .buttons . values () :
1058
+ for button in self .buttons :
1066
1059
button .square = value
1067
1060
1068
1061
@property
@@ -1080,7 +1073,7 @@ def border(self):
1080
1073
@border .setter
1081
1074
def border (self , value ):
1082
1075
super (BlueDot , self .__class__ ).border .fset (self , value )
1083
- for button in self .buttons . values () :
1076
+ for button in self .buttons :
1084
1077
button .border = value
1085
1078
1086
1079
@property
@@ -1101,7 +1094,7 @@ def visible(self):
1101
1094
@visible .setter
1102
1095
def visible (self , value ):
1103
1096
super (BlueDot , self .__class__ ).visible .fset (self , value )
1104
- for button in self .buttons . values () :
1097
+ for button in self .buttons :
1105
1098
button .visible = value
1106
1099
1107
1100
@property
@@ -1242,7 +1235,7 @@ def resize(self, cols, rows):
1242
1235
1243
1236
def _get_button (self , key ):
1244
1237
try :
1245
- return self .buttons [key ]
1238
+ return self ._buttons [key ]
1246
1239
except KeyError :
1247
1240
raise ButtonDoesNotExist ("The button `{}` does not exist" .format (key ))
1248
1241
@@ -1399,7 +1392,7 @@ def _send_bluedot_config(self):
1399
1392
1400
1393
# send the configuration for the individual buttons
1401
1394
button_config_msg = ""
1402
- for button in self .buttons . values () :
1395
+ for button in self .buttons :
1403
1396
if button .modified :
1404
1397
button_config_msg += button .build_config_msg ()
1405
1398
0 commit comments