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

Qt 4/5 specific screen grab routines #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

j0yu
Copy link

@j0yu j0yu commented Apr 24, 2020

This is a squash of wwfxuk's fork's 3677f70 and e9b03bc

Qt4's QPixmap.grabWindow has been removed in Qt5 and their Qt5 Screenshot Example has changed to use QScreen.grabWindow.

Discovered with Katana 3.1 (PyQy5), this PR fixes the following error:

AttributeError: type object 'QPixmap' has no attribute 'grabWindow'
An AttributeError occurred in "screen_grab.py": type object 'QPixmap' has no attribute 'grabWindow' root    2020-04-23T15:33:37
Traceback (most recent call last):
  File "/path/to/pipe/config/install/app_store/tk-framework-widget/v0.2.7/python/thumbnail_widget/thumbnail_widget.py", line 138, in _on_camera_clicked
    pm = self._on_screenshot()
  File "/path/to/pipe/config/install/app_store/tk-framework-widget/v0.2.7/python/thumbnail_widget/thumbnail_widget.py", line 230, in _on_screenshot
    pm = screen_grab.screen_capture()
  File "/path/to/pipe/config/install/git/tk-framework-qtwidgets.git/v2.8.5+wwfx.1.0.1/python/screen_grab/screen_grab.py", line 188, in screen_capture
    pixmap = get_desktop_pixmap(tool.capture_rect)
  File "/path/to/pipe/config/install/git/tk-framework-qtwidgets.git/v2.8.5+wwfx.1.0.1/python/screen_grab/screen_grab.py", line 336, in get_desktop_pixmap
    return QtGui.QPixmap.grabWindow(
AttributeError: type object 'QPixmap' has no attribute 'grabWindow'

image

Also includes similar fix for Maya 2019 to #95

See also:

j0yu pushed a commit to wwfxuk/tk-framework-qtwidgets that referenced this pull request Apr 28, 2020
…x' and 'qt5-screen-grab'

See in order on https://github.com:
- shotgunsoftware/pull/92 to match
  wwfxuk/tk-framework-qtwidgets/tree/v2.8.3%2Bwwfx.1.0.0
- /pull/2 to match
  wwfxuk/tk-framework-qtwidgets/tree/v2.8.3%2Bwwfx.1.1.0
- shotgunsoftware/pull/105 to match
  wwfxuk/tk-framework-qtwidgets/tree/v2.8.5%2Bwwfx.1.0.2
@jfboismenu
Copy link
Contributor

Hi @j0yu , thank you for this. I'm going to track this JIRA so we can have a developer take a look at the fix.

@jfboismenu jfboismenu added the Logged logged in Jira label Jun 4, 2020
Joseph Yu added 2 commits March 10, 2021 16:38
Squash of wwfxuk's fork: 3677f70 and e9b03bc
* Initial fix

* Py3 friendly long

* Fixed missing :, extra comment space
@j0yu j0yu force-pushed the qt5-screen-grab branch from c25c4cc to 526b2a8 Compare March 10, 2021 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Logged logged in Jira
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants