Add option to appendfiles to mark appended files as unlabeled

This commit is contained in:
Mika Fischer
2011-08-02 13:16:46 +02:00
parent d9e992c0f2
commit e70e51ed7a
3 changed files with 9 additions and 2 deletions
+1
View File
@@ -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()
+7 -1
View File
@@ -76,6 +76,10 @@ class AppendFilesCommand(BaseCommand):
"""
args = '<labelfile> <file1> [<file2> ...]'
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])
+1 -1
View File
@@ -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 = {