-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Switch the cursor to a busy cursor while redrawing. #6603
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ | |
cursors.HAND : Gdk.Cursor.new(Gdk.CursorType.HAND2), | ||
cursors.POINTER : Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR), | ||
cursors.SELECT_REGION : Gdk.Cursor.new(Gdk.CursorType.TCROSS), | ||
cursors.WAIT : Gdk.Cursor.new(Gdk.CursorType.WATCH), | ||
} | ||
|
||
|
||
|
@@ -499,7 +500,7 @@ def set_message(self, s): | |
|
||
def set_cursor(self, cursor): | ||
self.canvas.get_property("window").set_cursor(cursord[cursor]) | ||
#self.canvas.set_cursor(cursord[cursor]) | ||
Gtk.main_iteration() | ||
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. why are you adding this cal to 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. Because otherwise the cursor is actually not set on the GUI (see docstring changed in CanvasBase.set_cursor). Basically, what happens is Notification that a redraw is necessary. Note that the GUI event loop doesn't get to run between [cursor is set] and [possibly long computation], so depending on the details of the toolkit, the cursor change may not actually appear to the user before the end of the computation. Letting the GUI event loop run once allows it to change the cursor. (And upon testing, I see that Qt does not need this, probably because its version of setCursor triggers(?) the event loop.) |
||
|
||
def release(self, event): | ||
try: del self._pixmapBack | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going to fail with new tool manager, toolbar doesn't have a set_cursor method anymore.
I have to think in a clean way of doing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a completely different note... you are doing this to the AGG backend, a non-interactive backend. How does this code interact with the combined backends like GtkAgg and such? Would this code get called twice?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never got an answer about why this is being done for the AGG backend.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aye, but from what I gather set_cursor will move from the toolbar to the canvas.
I'm +1 on doing this now so that we get a clean PR, but @tacaswell disagrees.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OceanWolf, was that a response to my question? I am not sure how your response applies, since the AGG backend has a canvas, too. Why is there any cursor-handling code for the agg backend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, It applies only in the sense that the code here has already been slated for removal. Only a partial answer to your question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, missed the comments.
The reason to put this here is the same reason why canvas.toolbar exists on all canvases (possibly None) rather than only on interactive ones: because there is no InteractiveCanvas class in the hierarchy :-) (Note that this is orthogonal with the toolmanager question)