diff --git a/sloth/gui/annotationscene.py b/sloth/gui/annotationscene.py index 56bc73a..ee98ed1 100644 --- a/sloth/gui/annotationscene.py +++ b/sloth/gui/annotationscene.py @@ -115,6 +115,7 @@ class AnnotationScene(QGraphicsScene): def onInserterFinished(self): self.sender().inserterFinished.disconnect(self.onInserterFinished) + self._labeltool.currentImageChanged.disconnect(self.sender()) self._labeltool.exitInsertMode() self._inserter = None @@ -131,6 +132,7 @@ class AnnotationScene(QGraphicsScene): if inserter is None: raise InvalidArgumentException("Could not find inserter for class '%s' with default properties '%s'" % (label_class, default_properties)) inserter.inserterFinished.connect(self.onInserterFinished) + self._labeltool.currentImageChanged.connect(inserter.imageChange) self._inserter = inserter LOG.debug("Created inserter for class '%s' with default properties '%s'" % (label_class, default_properties)) diff --git a/sloth/items/inserters.py b/sloth/items/inserters.py index 50f9fdc..5719ed0 100644 --- a/sloth/items/inserters.py +++ b/sloth/items/inserters.py @@ -28,6 +28,12 @@ class ItemInserter(QObject): def keyPressEvent(self, event, image_item): event.ignore() + def imageChange(self): + """ + Slot which gets called if the current image in the labeltool changes. + """ + pass + def allowOutOfSceneEvents(self): return False