14 # |
14 # |
15 |
15 |
16 import os |
16 import os |
17 |
17 |
18 from PyQt5.QtCore import pyqtSlot, QFile, QFileInfo, QTimer, QPoint, \ |
18 from PyQt5.QtCore import pyqtSlot, QFile, QFileInfo, QTimer, QPoint, \ |
19 QMimeData, Qt, QEvent, QRegExp, qVersion, QStandardPaths |
19 QMimeData, Qt, QEvent, QRegExp, qVersion, PYQT_VERSION_STR |
20 from PyQt5.QtGui import QImageWriter, QPixmap, QCursor, QDrag, QKeySequence |
20 from PyQt5.QtGui import QImageWriter, QPixmap, QCursor, QDrag, QKeySequence |
21 from PyQt5.QtWidgets import QWidget, QApplication, QShortcut |
21 from PyQt5.QtWidgets import QWidget, QApplication, QShortcut |
22 |
22 |
23 from E5Gui import E5FileDialog, E5MessageBox |
23 from E5Gui import E5FileDialog, E5MessageBox |
24 |
24 |
73 |
73 |
74 self.__delay = int( |
74 self.__delay = int( |
75 Preferences.Prefs.settings.value("Snapshot/Delay", 0)) |
75 Preferences.Prefs.settings.value("Snapshot/Delay", 0)) |
76 self.delaySpin.setValue(self.__delay) |
76 self.delaySpin.setValue(self.__delay) |
77 |
77 |
|
78 if PYQT_VERSION_STR >= "5.0.0": |
|
79 from PyQt5.QtCore import QStandardPaths |
|
80 picturesLocation = QStandardPaths.writableLocation( |
|
81 QStandardPaths.PicturesLocation) |
|
82 else: |
|
83 from PyQt5.QtGui import QDesktopServices |
|
84 picturesLocation = QDesktopServices.storageLocation( |
|
85 QDesktopServices.PicturesLocation) |
78 self.__filename = Preferences.Prefs.settings.value( |
86 self.__filename = Preferences.Prefs.settings.value( |
79 "Snapshot/Filename", |
87 "Snapshot/Filename", |
80 os.path.join( |
88 os.path.join(picturesLocation, |
81 QStandardPaths.writableLocation( |
89 self.tr("snapshot") + "1.png")) |
82 QStandardPaths.PicturesLocation), |
|
83 self.tr("snapshot") + "1.png")) |
|
84 |
90 |
85 self.__grabber = None |
91 self.__grabber = None |
86 self.__snapshot = QPixmap() |
92 self.__snapshot = QPixmap() |
87 self.__savedPosition = QPoint() |
93 self.__savedPosition = QPoint() |
88 self.__modified = False |
94 self.__modified = False |