Add ability to take screenshots in-app and insert them into the page
All checks were successful
CI / test (push) Successful in 3m21s
Lint / test (push) Successful in 28s
Trivy / test (push) Successful in 21s

This commit is contained in:
Miguel Jacq 2025-11-17 17:43:23 +11:00
parent eedf48dc6a
commit 34349c6133
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
8 changed files with 204 additions and 12 deletions

View file

@ -978,6 +978,7 @@ class MainWindow(QMainWindow):
tb.historyRequested.connect(self._open_history)
tb.insertImageRequested.connect(self._on_insert_image)
tb.insertScreenshotRequested.connect(self._start_screenshot)
self._toolbar_bound = True
@ -1051,6 +1052,21 @@ class MainWindow(QMainWindow):
for path_str in paths:
self.editor.insert_image_from_path(Path(path_str))
# ----------- Screenshot handler ------------#
def _start_screenshot(self):
ready = QMessageBox.information(
self,
strings._("screenshot"),
strings._("screenshot_get_ready"),
QMessageBox.Ok,
)
if ready == QMessageBox.Ok:
QGuiApplication.processEvents()
QTimer.singleShot(5000, self._do_screenshot_capture)
def _do_screenshot_capture(self):
self.editor.take_screenshot()
# ----------- Tags handler ----------------#
def _update_tag_views_for_date(self, date_iso: str):
if hasattr(self, "tags"):