57 self.copyButton.setIcon(EricPixmapCache.getIcon("editCopy")) |
57 self.copyButton.setIcon(EricPixmapCache.getIcon("editCopy")) |
58 self.copyPreviewButton.setIcon(EricPixmapCache.getIcon("editCopy")) |
58 self.copyPreviewButton.setIcon(EricPixmapCache.getIcon("editCopy")) |
59 self.setWindowIcon(EricPixmapCache.getIcon("ericSnap")) |
59 self.setWindowIcon(EricPixmapCache.getIcon("ericSnap")) |
60 |
60 |
61 if DesktopUtilities.isWaylandSession(): |
61 if DesktopUtilities.isWaylandSession(): |
62 from .SnapshotWaylandGrabber import ( # __IGNORE_WARNING_I101__ |
62 self.__grabber = None |
63 SnapshotWaylandGrabber, |
|
64 ) |
|
65 |
|
66 self.__grabber = SnapshotWaylandGrabber(self) |
|
67 else: |
63 else: |
68 from .SnapshotDefaultGrabber import ( # __IGNORE_WARNING_I101__ |
64 from .SnapshotDefaultGrabber import ( # __IGNORE_WARNING_I101__ |
69 SnapshotDefaultGrabber, |
65 SnapshotDefaultGrabber, |
70 ) |
66 ) |
71 |
67 |
72 self.__grabber = SnapshotDefaultGrabber(self) |
68 self.__grabber = SnapshotDefaultGrabber(self) |
73 self.decorationsCheckBox.hide() |
69 self.decorationsCheckBox.hide() |
74 self.mouseCursorCheckBox.hide() |
70 self.mouseCursorCheckBox.hide() |
75 self.__grabber.grabbed.connect(self.__captured) |
71 |
76 supportedModes = self.__grabber.supportedModes() |
72 if self.__grabber: |
|
73 self.__grabber.grabbed.connect(self.__captured) |
|
74 supportedModes = self.__grabber.supportedModes() |
77 |
75 |
78 if SnapshotModes.FULLSCREEN in supportedModes: |
76 if SnapshotModes.FULLSCREEN in supportedModes: |
79 self.modeCombo.addItem(self.tr("Fullscreen"), SnapshotModes.FULLSCREEN) |
77 self.modeCombo.addItem(self.tr("Fullscreen"), SnapshotModes.FULLSCREEN) |
80 if ( |
78 if ( |
81 SnapshotModes.SELECTEDSCREEN in supportedModes |
79 SnapshotModes.SELECTEDSCREEN in supportedModes |
320 @pyqtSlot() |
318 @pyqtSlot() |
321 def on_takeButton_clicked(self): |
319 def on_takeButton_clicked(self): |
322 """ |
320 """ |
323 Private slot to take a snapshot. |
321 Private slot to take a snapshot. |
324 """ |
322 """ |
325 self.__savedPosition = self.pos() |
323 if self.__grabber: |
326 self.hide() |
324 self.__savedPosition = self.pos() |
327 |
325 self.hide() |
328 self.__grabber.grab( |
326 |
329 self.modeCombo.itemData(self.modeCombo.currentIndex()), |
327 self.__grabber.grab( |
330 self.delaySpin.value(), |
328 self.modeCombo.itemData(self.modeCombo.currentIndex()), |
331 self.mouseCursorCheckBox.isChecked(), |
329 self.delaySpin.value(), |
332 self.decorationsCheckBox.isChecked(), |
330 self.mouseCursorCheckBox.isChecked(), |
333 ) |
331 self.decorationsCheckBox.isChecked(), |
|
332 ) |
|
333 |
|
334 else: |
|
335 EricMessageBox.critical( |
|
336 self, |
|
337 self.tr("Snapshot"), |
|
338 self.tr( |
|
339 "The snapshot functionality is not available for Wayland based" |
|
340 " desktop environments." |
|
341 ), |
|
342 ) |
334 |
343 |
335 def __redisplay(self): |
344 def __redisplay(self): |
336 """ |
345 """ |
337 Private method to redisplay the window. |
346 Private method to redisplay the window. |
338 """ |
347 """ |