Skip to content

Commit 9da6d2f

Browse files
author
Joseph Yu
committed
Merge branches 'fix-none-pixmap-using-pyqt', 'katana-partial-qicon-fix' 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
3 parents 764a4a2 + 3036ef1 + 4f55d56 commit 9da6d2f

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

python/context_selector/context_widget.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
99
# not expressly granted therein are reserved by Shotgun Software Inc.
1010

11+
from functools import partial
1112
import os
1213
import sgtk
1314
from sgtk.platform.qt import QtCore, QtGui
@@ -487,7 +488,12 @@ def _get_qaction_for_context(self, context):
487488
action.setText(context_display)
488489
action.setIcon(QtGui.QIcon(icon_path))
489490
action.setData(context)
490-
action.triggered.connect(lambda: self._on_context_activated(context))
491+
492+
def run_on_context_activated(context):
493+
self._on_context_activated(context)
494+
495+
func = partial(run_on_context_activated, context)
496+
action.triggered.connect(func)
491497

492498
return action
493499

python/screen_grab/screen_grab.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
from sgtk.platform.qt import QtCore, QtGui
1616
import sgtk
1717

18+
QT_MAJOR = int(QtCore.qVersion().split(".")[0]) # Works for PySide* and PyQt*
19+
1820

1921
class ScreenGrabber(QtGui.QDialog):
2022
"""
@@ -332,10 +334,19 @@ def get_desktop_pixmap(rect):
332334
:returns: Captured image
333335
:rtype: :class:`~PySide.QtGui.QPixmap`
334336
"""
335-
desktop = QtGui.QApplication.desktop()
336-
return QtGui.QPixmap.grabWindow(
337-
desktop.winId(), rect.x(), rect.y(), rect.width(), rect.height()
338-
)
337+
x_y_w_h = rect.x(), rect.y(), rect.width(), rect.height()
338+
339+
if QT_MAJOR == 5:
340+
screen = QtGui.QApplication.primaryScreen()
341+
pixmap = screen.grabWindow(0, *x_y_w_h)
342+
elif QT_MAJOR == 4:
343+
desktop = QtGui.QApplication.desktop()
344+
pixmap = QtGui.QPixmap.grabWindow(desktop.winId(), *x_y_w_h)
345+
else:
346+
message = "Screen capture not implmented for Qt %d"
347+
raise NotImplementedError(message % QT_MAJOR)
348+
349+
return pixmap
339350

340351

341352
# Backwards compatibility, as this used to be a module-level

python/search_completer/global_search_completer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def _handle_search_results(self, data):
202202

203203
item.setData(shotgun_model.sanitize_for_qt_model(d), self.SG_DATA_ROLE)
204204

205-
item.setIcon(self._pixmaps.no_thumbnail)
205+
item.setIcon(QtGui.QIcon(self._pixmaps.no_thumbnail))
206206

207207
if d.get("image") and self._sg_data_retriever:
208208
uid = self._sg_data_retriever.request_thumbnail(

0 commit comments

Comments
 (0)