Add the file filter function where needed

This commit is contained in:
Veronica Berglyd Olsen
2024-02-11 20:59:29 +01:00
parent 642b5e3681
commit 701fe29de9
5 changed files with 16 additions and 24 deletions
+3 -5
View File
@@ -36,6 +36,7 @@ from PyQt5.QtWidgets import (
)
from novelwriter import CONFIG, SHARED
from novelwriter.common import formatFileFilter
from novelwriter.core.spellcheck import UserDictionary
from novelwriter.extensions.configlayout import NColourLabel
@@ -184,12 +185,9 @@ class GuiWordList(QDialog):
SHARED.info(self.tr(
"Note: The import file must be a plain text file with UTF-8 or ASCII encoding."
))
extFilter = [
"{0} (*.txt)".format(self.tr("Text files")),
"{0} (*)".format(self.tr("All files")),
]
ffilter = formatFileFilter(["*.txt", "*"])
path, _ = QFileDialog.getOpenFileName(
self, self.tr("Import File"), str(Path.home()), filter=";;".join(extFilter)
self, self.tr("Import File"), str(Path.home()), filter=ffilter
)
if path:
try: