diff --git a/easymacro.py b/easymacro.py index 88dfe6a..c1d1363 100644 --- a/easymacro.py +++ b/easymacro.py @@ -50,7 +50,7 @@ from functools import wraps from pathlib import Path from pprint import pprint from string import Template -from typing import Any +from typing import Any, Union from urllib.request import Request, urlopen from urllib.error import URLError, HTTPError @@ -4248,15 +4248,11 @@ class Paths(object): return path @classmethod - def get_file(cls, init_dir: str='', filters=(), multiple: bool=False): + def get_file(cls, init_dir: str='', filters: str='', multiple: bool=False): """ init_folder: folder default open multiple: True for multiple selected - filters: Example - ( - ('XML', '*.xml'), - ('TXT', '*.txt'), - ) + filters: 'xml' or 'xml,txt' """ if not init_dir: init_dir = cls.documents @@ -4268,6 +4264,7 @@ class Paths(object): file_picker.setMultiSelectionMode(multiple) if filters: + filters = [(f.upper(), f'*.{f.lower()}') for f in filters.split(',')] file_picker.setCurrentFilter(filters[0][0]) for f in filters: file_picker.appendFilter(f[0], f[1]) diff --git a/files/ZAZPip_v0.6.0.oxt b/files/ZAZPip_v0.6.0.oxt index da50cd5..d5e2e55 100644 Binary files a/files/ZAZPip_v0.6.0.oxt and b/files/ZAZPip_v0.6.0.oxt differ diff --git a/source/pythonpath/easymacro.py b/source/pythonpath/easymacro.py index 16563ad..c1d1363 100644 --- a/source/pythonpath/easymacro.py +++ b/source/pythonpath/easymacro.py @@ -50,7 +50,7 @@ from functools import wraps from pathlib import Path from pprint import pprint from string import Template -from typing import Any +from typing import Any, Union from urllib.request import Request, urlopen from urllib.error import URLError, HTTPError @@ -4248,15 +4248,11 @@ class Paths(object): return path @classmethod - def get_file(cls, init_dir='', filters=(), multiple=False): + def get_file(cls, init_dir: str='', filters: str='', multiple: bool=False): """ init_folder: folder default open multiple: True for multiple selected - filters: Example - ( - ('XML', '*.xml'), - ('TXT', '*.txt'), - ) + filters: 'xml' or 'xml,txt' """ if not init_dir: init_dir = cls.documents @@ -4268,6 +4264,7 @@ class Paths(object): file_picker.setMultiSelectionMode(multiple) if filters: + filters = [(f.upper(), f'*.{f.lower()}') for f in filters.split(',')] file_picker.setCurrentFilter(filters[0][0]) for f in filters: file_picker.appendFilter(f[0], f[1]) diff --git a/source/pythonpath/main.py b/source/pythonpath/main.py index cd46fb8..9eb9b85 100644 --- a/source/pythonpath/main.py +++ b/source/pythonpath/main.py @@ -285,7 +285,7 @@ class Controllers(object): @app.catch_exception def cmd_explore_action(self, event): - file_name = app.paths.get_file(filters=(('TXT', '*.txt'),)) + file_name = app.paths.get_file(filters='txt') self.d.txt_search.value = file_name app.debug(file_name) return