screenshot ok

This commit is contained in:
Dr Marc 2025-09-25 16:22:46 +02:00
parent 97833345a8
commit e6321920ec

View file

@ -6,7 +6,7 @@ from PySide6.QtGui import QAction
from PySide6.QtWebEngineWidgets import QWebEngineView
from PySide6.QtWebEngineCore import QWebEngineContextMenuRequest
from PySide6.QtCore import QUrl, Qt
from PySide6.QtCore import QUrl, Qt, QIODevice, QByteArray, QBuffer
from pathlib import Path
import io
@ -96,9 +96,11 @@ class BrowserWindow(QMainWindow):
return
def handle_pixmap(pix):
buffer = io.BytesIO()
byte_array = QByteArray()
buffer = QBuffer(byte_array)
buffer.open(QIODevice.OpenModeFlag.WriteOnly)
pix.save(buffer, "PNG")
png_data = buffer.getvalue()
png_data = byte_array.data()
if self.current_page_id:
screenshot_id = save_screenshot(self.current_page_id, png_data)
self.prompt_tag(screenshot_id)