Very simple implementation of a debugger bridge for the sake of the test mode.
| 143 | |
| 144 | |
| 145 | class DummyDebugger(BridgeInterface): |
| 146 | """ |
| 147 | Very simple implementation of a debugger bridge for the sake of the test |
| 148 | mode. |
| 149 | """ |
| 150 | def __init__(self): |
| 151 | width = 400 |
| 152 | height = 200 |
| 153 | self._buffers = _gen_buffers(width, height) |
| 154 | self._buffer_names = [name for name in self._buffers] |
| 155 | |
| 156 | self._is_running = True |
| 157 | self._incoming_request_queue = [] |
| 158 | |
| 159 | def run_event_loop(self): |
| 160 | if self._is_running: |
| 161 | request_queue = self._incoming_request_queue |
| 162 | self._incoming_request_queue = [] |
| 163 | |
| 164 | while len(request_queue) > 0: |
| 165 | latest_request = request_queue.pop(-1) |
| 166 | latest_request() |
| 167 | |
| 168 | def kill(self): |
| 169 | """ |
| 170 | Request consumer thread to finish its execution |
| 171 | """ |
| 172 | self._is_running = False |
| 173 | |
| 174 | def get_casted_pointer(self, typename, debugger_object): |
| 175 | """ |
| 176 | No need to cast anything in this example |
| 177 | """ |
| 178 | return debugger_object |
| 179 | |
| 180 | def register_event_handlers(self, events): |
| 181 | """ |
| 182 | No need to register events in this example |
| 183 | """ |
| 184 | pass |
| 185 | |
| 186 | def get_available_symbols(self): |
| 187 | """ |
| 188 | Return the names of the available sample buffers |
| 189 | """ |
| 190 | return self._buffer_names |
| 191 | |
| 192 | def get_buffer_metadata(self, var_name): |
| 193 | """ |
| 194 | Search in the list of available buffers and return the requested one |
| 195 | """ |
| 196 | if var_name in self._buffers: |
| 197 | return self._buffers[var_name] |
| 198 | |
| 199 | return None |
| 200 | |
| 201 | def get_backend_name(self): # type: () -> str |
| 202 | return 'dummy' |