Button press event handler.
(self, event)
| 2882 | self.connect_event('motion_notify_event', self._hover) |
| 2883 | |
| 2884 | def _press(self, event): |
| 2885 | """Button press event handler.""" |
| 2886 | self._set_span_cursor(enabled=True) |
| 2887 | if self._interactive and self._selection_artist.get_visible(): |
| 2888 | self._set_active_handle(event) |
| 2889 | else: |
| 2890 | self._active_handle = None |
| 2891 | |
| 2892 | if self._active_handle is None or not self._interactive: |
| 2893 | # Clear previous rectangle before drawing new rectangle. |
| 2894 | self.update() |
| 2895 | |
| 2896 | v = event.xdata if self.direction == 'horizontal' else event.ydata |
| 2897 | |
| 2898 | if self._active_handle is None and not self.ignore_event_outside: |
| 2899 | # when the press event outside the span, we initially set the |
| 2900 | # visibility to False and extents to (v, v) |
| 2901 | # update will be called when setting the extents |
| 2902 | self._visible = False |
| 2903 | self._set_extents((v, v)) |
| 2904 | # We need to set the visibility back, so the span selector will be |
| 2905 | # drawn when necessary (span width > 0) |
| 2906 | self._visible = True |
| 2907 | else: |
| 2908 | self.set_visible(True) |
| 2909 | |
| 2910 | return False |
| 2911 | |
| 2912 | @property |
| 2913 | def direction(self): |
nothing calls this directly
no test coverage detected