mirror of
https://github.com/wassname/sloth.git
synced 2026-07-09 00:47:53 +08:00
add imageChange slot to inserters
This gets called every time the current image in the label tool changes to make the inserter aware of this.
This commit is contained in:
@@ -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))
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user