Wait for a button press using thread-safe event queue. LEFT/RIGHT adjust brightness and are not returned to callers.
(self)
| 164 | self.gfx.set_brightness(new) |
| 165 | |
| 166 | def _wait_button(self): |
| 167 | """Wait for a button press using thread-safe event queue. |
| 168 | LEFT/RIGHT adjust brightness and are not returned to callers.""" |
| 169 | while True: |
| 170 | event = self.gfx.get_input_event() |
| 171 | if event: |
| 172 | button, event_type, timestamp = event |
| 173 | if event_type == Pager.EVENT_PRESS: |
| 174 | if button == Pager.BTN_LEFT: |
| 175 | self._adjust_brightness(-1) |
| 176 | continue |
| 177 | if button == Pager.BTN_RIGHT: |
| 178 | self._adjust_brightness(1) |
| 179 | continue |
| 180 | if button == Pager.BTN_UP: |
| 181 | return 'UP' |
| 182 | if button == Pager.BTN_DOWN: |
| 183 | return 'DOWN' |
| 184 | if button == Pager.BTN_A: |
| 185 | return 'SELECT' |
| 186 | if button == Pager.BTN_B: |
| 187 | return 'BACK' |
| 188 | else: |
| 189 | time.sleep(0.016) |
| 190 | |
| 191 | def _draw_main_menu(self, selected, iface_idx, web_ui): |
| 192 | self.gfx.clear(Pager.BLACK) |
no test coverage detected