diff --git a/doc/configuration.rst b/doc/configuration.rst index b320ea3..136f391 100644 --- a/doc/configuration.rst +++ b/doc/configuration.rst @@ -135,6 +135,23 @@ PLUGINS Did not think to much about this yet. This is rather for v2.0. Could image to be able to define some kind of plugin that might do some preprocessing on an image, e.g. detect all faces and convert them into labels. +.. _SCENE_BACKGROUND: + +SCENE_BACKGROUND +---------------- + +Default:: + + Qt.darkGray + +Allows to set the scene background to a custom color or pattern. Expects a QBrush. A more +complex background could be a regular box pattern which might simplify the exact resizing of +annotations that extend over image boundaries:: + + from PyQt4.QtGui import QBrush + from PyQt4.QtCore import Qt + SCENE_BACKGROUND = QBrush(Qt.darkGray, Qt.CrossPattern) + Extending default values ======================== diff --git a/sloth/gui/annotationscene.py b/sloth/gui/annotationscene.py index b295034..9a80113 100644 --- a/sloth/gui/annotationscene.py +++ b/sloth/gui/annotationscene.py @@ -5,6 +5,7 @@ from sloth.items import * from sloth.core.exceptions import InvalidArgumentException from sloth.annotations.model import AnnotationModelItem from sloth.utils import toQImage +from sloth.conf import config import logging LOG = logging.getLogger(__name__) @@ -23,7 +24,10 @@ class AnnotationScene(QGraphicsScene): self._itemfactory = Factory(items) self._inserterfactory = Factory(inserters) - self.setBackgroundBrush(Qt.darkGray) + try: + self.setBackgroundBrush(config.SCENE_BACKGROUND) + except: + self.setBackgroundBrush(Qt.darkGray) self.reset() #