@@ -109,19 +109,67 @@ def all_off():
109109
110110# ~autogen
111111
112- class Button (ButtonEVIO ):
112+ class Button (object ):
113113 """
114114 EV3 Buttons
115115 """
116116
117117# ~autogen button-property platforms.ev3.button>currentClass
118118
119- on_up = None
120- on_down = None
121- on_left = None
122- on_right = None
123- on_enter = None
124- on_backspace = None
119+ @staticmethod
120+ def on_up (state ):
121+ """
122+ This handler is called by `process()` whenever state of 'up' button
123+ has changed since last `process()` call. `state` parameter is the new
124+ state of the button.
125+ """
126+ pass
127+
128+ @staticmethod
129+ def on_down (state ):
130+ """
131+ This handler is called by `process()` whenever state of 'down' button
132+ has changed since last `process()` call. `state` parameter is the new
133+ state of the button.
134+ """
135+ pass
136+
137+ @staticmethod
138+ def on_left (state ):
139+ """
140+ This handler is called by `process()` whenever state of 'left' button
141+ has changed since last `process()` call. `state` parameter is the new
142+ state of the button.
143+ """
144+ pass
145+
146+ @staticmethod
147+ def on_right (state ):
148+ """
149+ This handler is called by `process()` whenever state of 'right' button
150+ has changed since last `process()` call. `state` parameter is the new
151+ state of the button.
152+ """
153+ pass
154+
155+ @staticmethod
156+ def on_enter (state ):
157+ """
158+ This handler is called by `process()` whenever state of 'enter' button
159+ has changed since last `process()` call. `state` parameter is the new
160+ state of the button.
161+ """
162+ pass
163+
164+ @staticmethod
165+ def on_backspace (state ):
166+ """
167+ This handler is called by `process()` whenever state of 'backspace' button
168+ has changed since last `process()` call. `state` parameter is the new
169+ state of the button.
170+ """
171+ pass
172+
125173
126174 _buttons = {
127175 'up' : {'name' : '/dev/input/by-path/platform-gpio-keys.0-event' , 'value' : 103 },
@@ -134,26 +182,44 @@ class Button(ButtonEVIO):
134182
135183 @property
136184 def up (self ):
185+ """
186+ Check if 'up' button is pressed.
187+ """
137188 return 'up' in self .buttons_pressed
138189
139190 @property
140191 def down (self ):
192+ """
193+ Check if 'down' button is pressed.
194+ """
141195 return 'down' in self .buttons_pressed
142196
143197 @property
144198 def left (self ):
199+ """
200+ Check if 'left' button is pressed.
201+ """
145202 return 'left' in self .buttons_pressed
146203
147204 @property
148205 def right (self ):
206+ """
207+ Check if 'right' button is pressed.
208+ """
149209 return 'right' in self .buttons_pressed
150210
151211 @property
152212 def enter (self ):
213+ """
214+ Check if 'enter' button is pressed.
215+ """
153216 return 'enter' in self .buttons_pressed
154217
155218 @property
156219 def backspace (self ):
220+ """
221+ Check if 'backspace' button is pressed.
222+ """
157223 return 'backspace' in self .buttons_pressed
158224
159225
0 commit comments