diff --git a/sloth/annotations/model.py b/sloth/annotations/model.py index bb1f016..40acb9d 100644 --- a/sloth/annotations/model.py +++ b/sloth/annotations/model.py @@ -255,6 +255,7 @@ class RootModelItem(ModelItem): def appendFileItem(self, fileinfo): item = FileModelItem.create(fileinfo) self.appendChild(item) + return item def appendFileItems(self, fileinfos): start1 = time.time() diff --git a/sloth/core/commands.py b/sloth/core/commands.py index 9566a8f..284ae64 100644 --- a/sloth/core/commands.py +++ b/sloth/core/commands.py @@ -76,6 +76,10 @@ class AppendFilesCommand(BaseCommand): """ args = ' [ ...]' help = __doc__.strip() + option_list = BaseCommand.option_list + ( + make_option('-u', '--unlabeled', action='store_true', default=False, + help='Mark appended files as unlabeled.'), + ) def handle(self, *args, **options): if len(args) < 2: @@ -88,7 +92,9 @@ class AppendFilesCommand(BaseCommand): rel_filename = os.path.relpath(filename, os.path.dirname(args[0])) except: pass - self.labeltool.addImageFile(rel_filename) + item = self.labeltool.addImageFile(rel_filename) + if options['unlabeled']: + item.setUnlabeled(True) self.labeltool.saveAnnotations(args[0]) diff --git a/sloth/core/labeltool.py b/sloth/core/labeltool.py index 8fcb19b..5b47d65 100755 --- a/sloth/core/labeltool.py +++ b/sloth/core/labeltool.py @@ -329,7 +329,7 @@ class LabelTool(QObject): 'class': 'image', 'annotations': [ ], } - self._model._root.appendFileItem(fileitem) + return self._model._root.appendFileItem(fileitem) def addVideoFile(self, fname): fileitem = {