Skip to content

Commit bde4f73

Browse files
committed
Fix: update file loading behavior to ignore errors when loading unsupported files
Fix #164
1 parent eb3f6de commit bde4f73

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ See DataLab [roadmap page](https://datalab-platform.com/en/contributing/roadmap.
1919
* Fixed [Issue #161](https://github.com/DataLab-Platform/DataLab/issues/161) - Refresh image items only if necessary (when editing ROI, pasting/deleting metadata)
2020
* Fixed [Issue #162](https://github.com/DataLab-Platform/DataLab/issues/162) - View in a new window: when displaying multiple images, the item list panel should be visible
2121
* Fixed [Issue #163](https://github.com/DataLab-Platform/DataLab/issues/163) - Open from directory: expected one group per folder when loading multiple files
22+
* Fixed [Issue #164](https://github.com/DataLab-Platform/DataLab/issues/164) - Open from directory: unsupported files should be ignored when loading files recursively, to avoid warning popup dialog boxes
2223

2324
## DataLab Version 0.19.0 ##
2425

cdl/core/gui/panel/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -919,7 +919,7 @@ def load_from_directory(self, directory: str | None = None) -> list[TypeObj]:
919919
if osp.isfile(osp.join(path, fname))
920920
]
921921
new_objs = self.load_from_files(
922-
fnames, create_group=False, ignore_unknown=True
922+
fnames, create_group=False, ignore_errors=True
923923
)
924924
objs += new_objs
925925
if len(new_objs) == 0:
@@ -930,7 +930,7 @@ def load_from_files(
930930
self,
931931
filenames: list[str] | None = None,
932932
create_group: bool = False,
933-
ignore_unknown: bool = False,
933+
ignore_errors: bool = False,
934934
) -> list[TypeObj]:
935935
"""Open objects from file (signals/images), add them to DataLab and return them.
936936
@@ -939,7 +939,7 @@ def load_from_files(
939939
create_group: if True, create a new group if more than one object is loaded
940940
for a single file. Defaults to False: all objects are added to the current
941941
group.
942-
ignore_unknown: if True, ignore unknown file types (default: False)
942+
ignore_errors: if True, ignore errors when loading files. Defaults to False.
943943
944944
Returns:
945945
list of new objects
@@ -957,8 +957,8 @@ def load_from_files(
957957
Conf.main.base_dir.set(filename)
958958
try:
959959
objs += self.__load_from_file(filename, create_group=create_group)
960-
except NotImplementedError as exc:
961-
if ignore_unknown:
960+
except Exception as exc: # pylint: disable=broad-except
961+
if ignore_errors:
962962
# Ignore unknown file types
963963
pass
964964
else:

doc/locale/fr/LC_MESSAGES/api/core.gui/panel.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ msgid ""
88
msgstr ""
99
"Project-Id-Version: DataLab \n"
1010
"Report-Msgid-Bugs-To: \n"
11-
"POT-Creation-Date: 2025-04-08 10:13+0200\n"
11+
"POT-Creation-Date: 2025-04-08 10:22+0200\n"
1212
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1313
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1414
"Language: fr\n"
@@ -346,7 +346,7 @@ msgstr ""
346346
msgid "if True, create a new group if more than one object is loaded for a single file. Defaults to False: all objects are added to the current group."
347347
msgstr ""
348348

349-
msgid "if True, ignore unknown file types (default: False)"
349+
msgid "if True, ignore errors when loading files. Defaults to False."
350350
msgstr ""
351351

352352
msgid "Save selected objects to files (signal/image)."

doc/locale/fr/LC_MESSAGES/contributing/changelog.po

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: DataLab \n"
99
"Report-Msgid-Bugs-To: \n"
10-
"POT-Creation-Date: 2025-04-08 10:13+0200\n"
10+
"POT-Creation-Date: 2025-04-08 10:22+0200\n"
1111
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
1212
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
1313
"Language: fr\n"
@@ -69,6 +69,10 @@ msgstr "Correction de l'[Issue #162](https://github.com/DataLab-Platform/DataLab
6969
msgid "Fixed [Issue #163](https://github.com/DataLab-Platform/DataLab/issues/163) - Open from directory: expected one group per folder when loading multiple files"
7070
msgstr "Ceci corrige l'[Issue #163](https://github.com/DataLab-Platform/DataLab/issues/163) - Ouvrir depuis le répertoire : un groupe par dossier attendu lors du chargement de plusieurs fichiers"
7171

72+
#, fuzzy
73+
msgid "Fixed [Issue #164](https://github.com/DataLab-Platform/DataLab/issues/164) - Open from directory: unsupported files should be ignored when loading files recursively, to avoid warning popup dialog boxes"
74+
msgstr "Ceci corrige l'[Issue #163](https://github.com/DataLab-Platform/DataLab/issues/163) - Ouvrir depuis le répertoire : un groupe par dossier attendu lors du chargement de plusieurs fichiers"
75+
7276
msgid "DataLab Version 0.19.0"
7377
msgstr "DataLab Version 0.19.0"
7478

@@ -2208,3 +2212,4 @@ msgstr "Symétrie (verticale/horizontale)"
22082212

22092213
msgid "Console: added configurable external editor (default: VSCode) to follow the traceback links to the source code"
22102214
msgstr "Console : ajout d'un éditeur externe configurable (par défaut : VSCode) pour suivre les liens de poursuite vers le code source"
2215+

0 commit comments

Comments
 (0)