| 245 | self.queue_draw() |
| 246 | |
| 247 | def _post_draw(self, widget, ctx): |
| 248 | if self._rubberband_rect is None: |
| 249 | return |
| 250 | |
| 251 | x0, y0, w, h = (dim / self.device_pixel_ratio |
| 252 | for dim in self._rubberband_rect) |
| 253 | x1 = x0 + w |
| 254 | y1 = y0 + h |
| 255 | |
| 256 | # Draw the lines from x0, y0 towards x1, y1 so that the |
| 257 | # dashes don't "jump" when moving the zoom box. |
| 258 | ctx.move_to(x0, y0) |
| 259 | ctx.line_to(x0, y1) |
| 260 | ctx.move_to(x0, y0) |
| 261 | ctx.line_to(x1, y0) |
| 262 | ctx.move_to(x0, y1) |
| 263 | ctx.line_to(x1, y1) |
| 264 | ctx.move_to(x1, y0) |
| 265 | ctx.line_to(x1, y1) |
| 266 | |
| 267 | ctx.set_antialias(1) |
| 268 | ctx.set_line_width(1) |
| 269 | ctx.set_dash((3, 3), 0) |
| 270 | ctx.set_source_rgb(0, 0, 0) |
| 271 | ctx.stroke_preserve() |
| 272 | |
| 273 | ctx.set_dash((3, 3), 3) |
| 274 | ctx.set_source_rgb(1, 1, 1) |
| 275 | ctx.stroke() |
| 276 | |
| 277 | def on_draw_event(self, widget, ctx): |
| 278 | # to be overwritten by GTK3Agg or GTK3Cairo |