Skip to content
Snippets Groups Projects
Commit 4b641259 authored by Lan Dam's avatar Lan Dam
Browse files

let user select one of the folders data/, sdata/

parent 7379932b
No related branches found
No related tags found
1 merge request!190let user select one of the folders data/, sdata/
Pipeline #3030 passed with stage
in 2 minutes and 15 seconds
This commit is part of merge request !190. Comments created here will be created in the context of that merge request.
......@@ -39,6 +39,9 @@ from sohstationviewer.view.util.functions import (
check_chan_wildcards_format, check_masspos,
)
from sohstationviewer.view.channel_prefer_dialog import ChannelPreferDialog
from sohstationviewer.view.create_muti_buttons_dialog import (
create_multi_buttons_dialog
)
from sohstationviewer.controller.processing import detect_data_type
from sohstationviewer.controller.util import (
......@@ -508,12 +511,40 @@ class MainWindow(QtWidgets.QMainWindow, UIMainWindow):
else:
self.list_of_dir = [root_dir.joinpath('sdata')]
else:
# When "From Data Card" checkbox is checked, sub directories of the
# current dir (root_dir) will be displayed in File List box.
# When "From Data Card" checkbox isn't checked, sub directories of
# the current dir (root_dir) will be displayed in File List box.
# User can select one or more sub-directories to process from.
self.list_of_dir = [
root_dir.joinpath(item.text())
for item in self.open_files_list.selectedItems()]
has_data_sdata = False
for folder in self.list_of_dir:
has_data_sdata = check_data_sdata(folder)
if has_data_sdata:
break
if has_data_sdata:
if len(self.list_of_dir) > 1:
msg = ("More than one folders are selected. At least one "
"of them has sub-folders data/ and sdata/.\n\n"
"It confuses SOH View.\n\n"
"SOH View will read only one folder with "
"sub-folder data/ and sdata/.")
raise Exception(msg)
else:
msg = ("The selected folder contains 2 data folders:\n"
"'data/', 'sdata/'.\n\n"
"Please select one of them to read data from.")
result = create_multi_buttons_dialog(
msg, ['data/', 'sdata/'], abort_is_0=True)
if result == 0:
self.list_of_dir = [
self.list_of_dir[0].joinpath('data')]
elif result == 1:
self.list_of_dir = [
self.list_of_dir[0].joinpath('sdata')]
else:
raise Exception('Process is cancelled by user.')
if self.list_of_dir == []:
msg = "No directories have been selected."
raise Exception(msg)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment