Skip to content

Commit 678d683

Browse files
committed
Add logging for image loading in Page class
1 parent 0930175 commit 678d683

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/models/page.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1+
import logging
2+
13
from PySide6.QtGui import QImage, QPixmap
24

5+
from src.models.constants import LOGGING_VERBOSITY
6+
7+
logger = logging.getLogger(__name__)
8+
logger.setLevel(LOGGING_VERBOSITY)
9+
310

411
class Page:
512
"""
@@ -33,8 +40,13 @@ def getPixmap(self):
3340
# and convert it to a QPixmap
3441
image = QImage()
3542

43+
logger.debug("Loading image from data")
44+
3645
if image.loadFromData(self._data):
3746
self._pixmap = QPixmap.fromImage(image)
47+
logger.debug("Image loaded successfully")
48+
else:
49+
logger.error("Failed to load image from data")
3850

3951
return self._pixmap
4052

0 commit comments

Comments
 (0)