mirror of
https://github.com/wassname/sloth.git
synced 2026-07-26 13:38:05 +08:00
Fix filters in open and save dialogs
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user