Fix filters in open and save dialogs

This commit is contained in:
Mika Fischer
2011-06-08 17:56:29 +02:00
parent d134d55d25
commit 8e4617574e
2 changed files with 5 additions and 3 deletions
+3
View File
@@ -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.
+2 -3
View File
@@ -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))