Skip to content

Commit 7111d34

Browse files
committed
Support folder drops in Signal and Image panels
1 parent c97c6f8 commit 7111d34

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ See DataLab [roadmap page](https://datalab-platform.com/en/contributing/roadmap.
66

77
💥 New features and enhancements:
88

9-
* Add "Open from directory" action to the "File" menu for both Signal and Image panels
9+
* New "Open from directory" feature:
10+
* This feature allows to open multiple files from a directory at once, recursively (only the files with the supported extensions by the current panel are opened)
11+
* Add "Open from directory" action to the "File" menu for both Signal and Image panels
12+
* Add support for folders when dropping files in the Signal and Image panels
1013
* Add `1/x` operation to the "Operations" menu for both Signal and Image panels:
1114
* This feature relies on the `numpy.reciprocal` function, and handles the case where the denominator is zero by catching warnings and replacing the `np.inf` values with `np.nan` values
1215
* Add `compute_inverse` method for image and signal processors

cdl/core/gui/panel/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -962,8 +962,12 @@ def handle_dropped_files(self, filenames: list[str] | None = None) -> None:
962962
Returns:
963963
None
964964
"""
965+
dirnames = [fname for fname in filenames if osp.isdir(fname)]
965966
h5_fnames = [fname for fname in filenames if fname.endswith(".h5")]
966-
other_fnames = sorted(list(set(filenames) - set(h5_fnames)))
967+
other_fnames = sorted(list(set(filenames) - set(h5_fnames) - set(dirnames)))
968+
if dirnames:
969+
for dirname in dirnames:
970+
self.load_from_directory(dirname)
967971
if h5_fnames:
968972
self.mainwindow.open_h5_files(h5_fnames, import_all=True)
969973
if other_fnames:

0 commit comments

Comments
 (0)