| 191 | def alert_remote_control_reply(self, reply): |
| 192 | |
| 193 | def callback(my, mx, xs): |
| 194 | y = count(xs) |
| 195 | if not reply: |
| 196 | self.win.addstr( |
| 197 | next(y), 3, 'No replies received in 1s deadline.', |
| 198 | curses.A_BOLD + curses.color_pair(2), |
| 199 | ) |
| 200 | return |
| 201 | |
| 202 | for subreply in reply: |
| 203 | curline = next(y) |
| 204 | |
| 205 | host, response = next(subreply.items()) |
| 206 | host = f'{host}: ' |
| 207 | self.win.addstr(curline, 3, host, curses.A_BOLD) |
| 208 | attr = curses.A_NORMAL |
| 209 | text = '' |
| 210 | if 'error' in response: |
| 211 | text = response['error'] |
| 212 | attr |= curses.color_pair(2) |
| 213 | elif 'ok' in response: |
| 214 | text = response['ok'] |
| 215 | attr |= curses.color_pair(3) |
| 216 | self.win.addstr(curline, 3 + len(host), text, attr) |
| 217 | |
| 218 | return self.alert(callback, 'Remote Control Command Replies') |
| 219 | |