Skip to content
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

Small drag & drop fixes #6163

Merged
merged 2 commits into from
Nov 30, 2024

Conversation

johnhaddon
Copy link
Member

Couple of small fixes for problems that cropped up while writing a custom editor at Cinesite.

When the drag originates outside Gaffer, `event.sourceWidget` is `None`, in which case we were getting the following error :

```
ERROR :   File "/home/john/dev/build/gaffer-1.4/startup/gui/graphEditor.py", line 253, in __dropLocationData
ERROR :     sourceEditor = event.sourceWidget.ancestor( GafferUI.Editor )
ERROR : AttributeError: 'NoneType' object has no attribute 'ancestor'
```

This had gone unnoticed before, because typically such events were being accepted by `__fileDragEnter()` first and never reached the location drop handler. But when the file is of an unhandled type, the file handler returns False and the location handler comes into play.
Our assumption was that such drags would always comes from outside of Gaffer - the foreign drag handling was originally added so that we could drag files from the system browser into the GraphEditor. In that case there is no source of information for `sourceWidget`.

But some folks prefer to code their Gaffer extensions in pure Qt, with a tiny shim to host them in GafferUI. In this case, we _can_ find a suitable `sourceWidget`, which we now do.
@johnhaddon johnhaddon self-assigned this Nov 27, 2024
@murraystevenson murraystevenson merged commit f45b0f1 into GafferHQ:1.4_maintenance Nov 30, 2024
5 checks passed
@johnhaddon johnhaddon deleted the dragDropFixes branch December 10, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Pending release
Development

Successfully merging this pull request may close these issues.

2 participants