Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion datashuttle/tui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ def rename_file_or_folder(self, path_, new_name):
path_.as_posix(),
path_.parent / f"{new_name}{path_.suffix}",
)
self.query_one("#project_manager_screen").update_active_tab_tree()
assert isinstance(
self.screen, project_manager.ProjectManagerScreen
)
self.screen.update_active_tab_tree()

except BaseException as e:
self.show_modal_error_dialog(
f"Could not rename the file or folder."
Expand Down
4 changes: 1 addition & 3 deletions datashuttle/tui/css/tui_tab.tcss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ TabScreen > TabbedContent {

#create_folders_buttons_horizontal {
height: 3;
margin: 0 0 1 0
}

#template_settings_validation_on_checkbox.-on > .toggle--button{
Expand All @@ -52,9 +53,6 @@ TabScreen > TabbedContent {
layout: horizontal;
background: transparent;
margin: 1 0 0 0;
}

#transfer_radioset:focus {
border: transparent;
}

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies = [
"fancylog>=0.4.2",
"simplejson",
"pyperclip",
"textual<=1.0.0",
"textual==3.4.0",
"show-in-file-manager",
"gitpython",
"typeguard"
Expand Down
2 changes: 1 addition & 1 deletion tests/tests_tui/test_tui_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ async def check_configs_widgets_match_configs(
assert (
configs_content.query_one(
"#configs_connect_method_radioset"
).pressed_button.label._text[0]
).pressed_button.label._text
== label
)

Expand Down
18 changes: 13 additions & 5 deletions tests/tests_tui/test_tui_datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ async def test_select_displayed_datatypes_create(

for datatype in narrow_datatype_names:
assert (
pilot.app.query_one(f"#create_{datatype}_checkbox").value
pilot.app.screen.query_one(
f"#create_{datatype}_checkbox"
).value
is False
)

Expand Down Expand Up @@ -96,7 +98,9 @@ async def test_select_displayed_datatypes_create(
for datatype in broad_datatype_names:
# check all are shown and False again (because False on reset)
assert (
pilot.app.query_one(f"#create_{datatype}_checkbox").value
pilot.app.screen.query_one(
f"#create_{datatype}_checkbox"
).value
is False
)

Expand All @@ -116,13 +120,15 @@ async def test_select_displayed_datatypes_create(
for datatype in broad_datatype_names:
# check all are shown and False again
assert (
pilot.app.query_one(f"#create_{datatype}_checkbox").value
pilot.app.screen.query_one(
f"#create_{datatype}_checkbox"
).value
is False
)

# Confirm also that narrow datatypes are not shown.
with pytest.raises(BaseException):
pilot.app.query_one(
pilot.app.screen.query_one(
f"#create_{narrow_datatype_names[0]}_checkbox"
)

Expand Down Expand Up @@ -165,7 +171,9 @@ async def test_select_displayed_datatypes_transfer(

for datatype in narrow_datatype_names:
assert (
pilot.app.query_one(f"#transfer_{datatype}_checkbox").value
pilot.app.screen.query_one(
f"#transfer_{datatype}_checkbox"
).value
is False
)

Expand Down
8 changes: 5 additions & 3 deletions tests/tests_tui/test_tui_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ async def test_validate_on_project_manager_output(

written_lines = [
ele.text
for ele in pilot.app.query_one("#validate_richlog").lines
for ele in pilot.app.screen.query_one(
"#validate_richlog"
).lines
]

assert len(written_lines) == 3
Expand Down Expand Up @@ -157,7 +159,7 @@ async def test_validate_on_project_manager_kwargs(
"validate_path_container",
]:
with pytest.raises(textual.css.query.InvalidQueryFormat):
pilot.app.query_one(id)
pilot.app.screen.query_one(id)

@pytest.mark.asyncio
async def test_validate_at_path_kwargs(self, setup_project_paths, mocker):
Expand Down Expand Up @@ -198,4 +200,4 @@ async def test_validate_at_path_kwargs(self, setup_project_paths, mocker):

# Check removed widgets, this should be removed because always local
with pytest.raises(textual.css.query.InvalidQueryFormat):
pilot.app.query_one("validate_include_central_checkbox")
pilot.app.screen.query_one("validate_include_central_checkbox")
44 changes: 21 additions & 23 deletions tests/tests_tui/test_tui_widgets_and_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async def test_new_project_configs(self, empty_project_paths):
assert (
configs_content.query_one(
"#configs_connect_method_radioset"
).pressed_button.label._text[0]
).pressed_button.label._text
== "Local Filesystem"
)

Expand Down Expand Up @@ -327,38 +327,36 @@ async def test_create_folders_widgets_display(self, setup_project_paths):
assert (
pilot.app.screen.query_one(
"#create_behav_checkbox"
).label._text[0]
).label._text
== "behav"
)
assert (
pilot.app.screen.query_one(
"#create_ephys_checkbox"
).label._text[0]
).label._text
== "ephys"
)
assert (
pilot.app.screen.query_one(
"#create_funcimg_checkbox"
).label._text[0]
).label._text
== "funcimg"
)
assert (
pilot.app.screen.query_one(
"#create_anat_checkbox"
).label._text[0]
pilot.app.screen.query_one("#create_anat_checkbox").label._text
== "anat"
)

assert (
pilot.app.screen.query_one(
"#create_folders_create_folders_button"
).label._text[0]
).label._text
== "Create Folders"
)
assert (
pilot.app.screen.query_one(
"#create_folders_settings_button"
).label._text[0]
).label._text
== "Settings"
)

Expand Down Expand Up @@ -404,7 +402,7 @@ async def test_create_folder_settings_widgets(self, setup_project_paths):
assert (
pilot.app.screen.query_one(
"#create_folders_settings_bypass_validation_checkbox"
).label._text[0]
).label._text
== "Bypass validation"
)
assert (
Expand All @@ -417,7 +415,7 @@ async def test_create_folder_settings_widgets(self, setup_project_paths):
assert (
pilot.app.screen.query_one(
"#template_settings_validation_on_checkbox"
).label._text[0]
).label._text
== "Template Validation"
)
assert (
Expand Down Expand Up @@ -453,7 +451,7 @@ async def test_create_folder_settings_widgets(self, setup_project_paths):
assert (
pilot.app.screen.query_one(
"#template_settings_radioset"
).pressed_button.label._text[0]
).pressed_button.label._text
== "Subject"
)
assert (
Expand Down Expand Up @@ -1053,19 +1051,19 @@ async def test_all_transfer_widgets(self, setup_project_paths):
assert (
pilot.app.screen.query_one(
"#transfer_all_radiobutton"
).label._text[0]
).label._text
== "All"
)
assert (
pilot.app.screen.query_one(
"#transfer_toplevel_radiobutton"
).label._text[0]
).label._text
== "Top Level"
)
assert (
pilot.app.screen.query_one(
"#transfer_custom_radiobutton"
).label._text[0]
).label._text
== "Custom"
)

Expand Down Expand Up @@ -1095,7 +1093,7 @@ async def test_all_transfer_widgets(self, setup_project_paths):
assert (
pilot.app.screen.query_one(
"#transfer_transfer_button"
).label._text[0]
).label._text
== "Transfer"
)

Expand Down Expand Up @@ -1163,44 +1161,44 @@ async def test_all_transfer_widgets(self, setup_project_paths):
assert (
pilot.app.screen.query_one(
"#transfer_behav_checkbox"
).label._text[0]
).label._text
== "behav"
)
assert (
pilot.app.screen.query_one(
"#transfer_ephys_checkbox"
).label._text[0]
).label._text
== "ephys"
)
assert (
pilot.app.screen.query_one(
"#transfer_funcimg_checkbox"
).label._text[0]
).label._text
== "funcimg"
)
assert (
pilot.app.screen.query_one(
"#transfer_anat_checkbox"
).label._text[0]
).label._text
== "anat"
)

assert (
pilot.app.screen.query_one(
"#transfer_all_checkbox"
).label._text[0]
).label._text
== "all"
)
assert (
pilot.app.screen.query_one(
"#transfer_all_datatype_checkbox"
).label._text[0]
).label._text
== "all datatype"
)
assert (
pilot.app.screen.query_one(
"#transfer_all_non_datatype_checkbox"
).label._text[0]
).label._text
== "all non datatype"
)

Expand Down
Loading