89 |
89 |
90 delay = int(Preferences.Prefs.settings.value("Snapshot/Delay", 0)) |
90 delay = int(Preferences.Prefs.settings.value("Snapshot/Delay", 0)) |
91 self.delaySpin.setValue(delay) |
91 self.delaySpin.setValue(delay) |
92 |
92 |
93 picturesLocation = QStandardPaths.writableLocation( |
93 picturesLocation = QStandardPaths.writableLocation( |
94 QStandardPaths.PicturesLocation) |
94 QStandardPaths.StandardLocation.PicturesLocation) |
95 self.__filename = Preferences.Prefs.settings.value( |
95 self.__filename = Preferences.Prefs.settings.value( |
96 "Snapshot/Filename", |
96 "Snapshot/Filename", |
97 os.path.join(picturesLocation, |
97 os.path.join(picturesLocation, |
98 self.tr("snapshot") + "1.png")) |
98 self.tr("snapshot") + "1.png")) |
99 |
99 |
152 def __initShortcuts(self): |
152 def __initShortcuts(self): |
153 """ |
153 """ |
154 Private method to initialize the keyboard shortcuts. |
154 Private method to initialize the keyboard shortcuts. |
155 """ |
155 """ |
156 self.__quitShortcut = QShortcut( |
156 self.__quitShortcut = QShortcut( |
157 QKeySequence(QKeySequence.Quit), self, self.close) |
157 QKeySequence(QKeySequence.StandardKey.Quit), self, self.close) |
158 |
158 |
159 self.__copyShortcut = QShortcut( |
159 self.__copyShortcut = QShortcut( |
160 QKeySequence(QKeySequence.Copy), self, |
160 QKeySequence(QKeySequence.StandardKey.Copy), self, |
161 self.copyButton.animateClick) |
161 self.copyButton.animateClick) |
162 |
162 |
163 self.__quickSaveShortcut = QShortcut( |
163 self.__quickSaveShortcut = QShortcut( |
164 QKeySequence(Qt.Key_Q), self, self.__quickSave) |
164 QKeySequence(Qt.Key.Key_Q), self, self.__quickSave) |
165 |
165 |
166 self.__save1Shortcut = QShortcut( |
166 self.__save1Shortcut = QShortcut( |
167 QKeySequence(QKeySequence.Save), self, |
167 QKeySequence(QKeySequence.StandardKey.Save), self, |
168 self.saveButton.animateClick) |
168 self.saveButton.animateClick) |
169 self.__save2Shortcut = QShortcut( |
169 self.__save2Shortcut = QShortcut( |
170 QKeySequence(Qt.Key_S), self, self.saveButton.animateClick) |
170 QKeySequence(Qt.Key.Key_S), self, self.saveButton.animateClick) |
171 |
171 |
172 self.__grab1Shortcut = QShortcut( |
172 self.__grab1Shortcut = QShortcut( |
173 QKeySequence(QKeySequence.New), self, self.takeButton.animateClick) |
173 QKeySequence(QKeySequence.StandardKey.New), |
|
174 self, self.takeButton.animateClick) |
174 self.__grab2Shortcut = QShortcut( |
175 self.__grab2Shortcut = QShortcut( |
175 QKeySequence(Qt.Key_N), self, self.takeButton.animateClick) |
176 QKeySequence(Qt.Key.Key_N), self, self.takeButton.animateClick) |
176 self.__grab3Shortcut = QShortcut( |
177 self.__grab3Shortcut = QShortcut( |
177 QKeySequence(Qt.Key_Space), self, self.takeButton.animateClick) |
178 QKeySequence(Qt.Key.Key_Space), self, self.takeButton.animateClick) |
178 |
179 |
179 def __quickSave(self): |
180 def __quickSave(self): |
180 """ |
181 """ |
181 Private slot to save the snapshot bypassing the file selection dialog. |
182 Private slot to save the snapshot bypassing the file selection dialog. |
182 """ |
183 """ |
375 drag = QDrag(self) |
376 drag = QDrag(self) |
376 mimeData = QMimeData() |
377 mimeData = QMimeData() |
377 mimeData.setImageData(self.__snapshot) |
378 mimeData.setImageData(self.__snapshot) |
378 drag.setMimeData(mimeData) |
379 drag.setMimeData(mimeData) |
379 drag.setPixmap(self.preview.pixmap()) |
380 drag.setPixmap(self.preview.pixmap()) |
380 drag.exec(Qt.CopyAction) |
381 drag.exec(Qt.DropAction.CopyAction) |
381 |
382 |
382 def closeEvent(self, evt): |
383 def closeEvent(self, evt): |
383 """ |
384 """ |
384 Protected method handling the close event. |
385 Protected method handling the close event. |
385 |
386 |