Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
figure_enter_event uses now LocationEvent instead of Event. Fix issue #9812.#9814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -2010,8 +2010,14 @@ def enter_notify_event(self, guiEvent=None, xy=None): | ||
if xy is not None: | ||
x, y = xy | ||
self._lastx, self._lasty = x, y | ||
else: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Can you add a warning here like warnings.warn('enter_notify_event expects a location but your backend did not pass one. ''This may become mandatory in the future',stacklevel=2) ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. cbook.warn_deprecated? | ||
x = None | ||
y = None | ||
cbook.warn_deprecated('3.0', 'enter_notify_event expects a ' | ||
'location but ' | ||
'your backend did not pass one.') | ||
event =LocationEvent('figure_enter_event', self, x, y, guiEvent) | ||
self.callbacks.process('figure_enter_event', event) | ||
@cbook.deprecated("2.1") | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -299,7 +299,8 @@ def get_width_height(self): | ||
return int(w / self._dpi_ratio), int(h / self._dpi_ratio) | ||
def enterEvent(self, event): | ||
x, y = self.mouseEventCoords(event.pos()) | ||
FigureCanvasBase.enter_notify_event(self, guiEvent=event, xy=(x, y)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This can just be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Could do but that would break some inconsistency with the other event as well. For example
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Fair. I suppose those could also all be changed to normal method calls, but that is beyond the scope of this PR. | ||
def leaveEvent(self, event): | ||
QtWidgets.QApplication.restoreOverrideCursor() | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1053,7 +1053,10 @@ def _onLeave(self, evt): | ||
def _onEnter(self, evt): | ||
"""Mouse has entered the window.""" | ||
x = evt.GetX() | ||
y = self.figure.bbox.height - evt.GetY() | ||
evt.Skip() | ||
FigureCanvasBase.enter_notify_event(self, guiEvent=evt, xy=(x, y)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. This can also just be | ||
class FigureCanvasWx(_FigureCanvasWxBase): | ||