diff --git a/sloth/annotations/container.py b/sloth/annotations/container.py index e955e0e..8f5e09a 100644 --- a/sloth/annotations/container.py +++ b/sloth/annotations/container.py @@ -34,6 +34,9 @@ class AnnotationContainerFactory: item = import_callable(item) self.containers_.append((pattern, item)) + def patterns(self): + return [pattern for pattern, item in self.containers_] + def create(self, filename, *args, **kwargs): """ Create a container for the filename. diff --git a/sloth/gui/labeltool.py b/sloth/gui/labeltool.py index dacfd58..fdad8df 100755 --- a/sloth/gui/labeltool.py +++ b/sloth/gui/labeltool.py @@ -231,8 +231,7 @@ class MainWindow(QMainWindow): (len(self.container_.filename()) > 0): path = QFileInfo(self.container_.filename()).path() - # TODO: compile a list from all the patterns in self.container_factory_ - format_str = ' '.join(['*']) + format_str = ' '.join(self.container_factory_.patterns()) fname = QFileDialog.getOpenFileName(self, "%s - Load Annotations" % APP_NAME, path, "%s annotation files (%s)" % (APP_NAME, format_str)) @@ -246,7 +245,7 @@ class MainWindow(QMainWindow): def fileSaveAs(self): fname = '.' # self.annotations.filename() or '.' - format_str = ' '.join(['*.txt']) + format_str = ' '.join(self.container_factory_.patterns()) fname = QFileDialog.getSaveFileName(self, "%s - Save Annotations" % APP_NAME, fname, "%s annotation files (%s)" % (APP_NAME, format_str))