-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TUI] Add Transfer Tab #281
[TUI] Add Transfer Tab #281
Conversation
I've now somewhat arbitrarily set this PR to merge into |
The core transfer functionality has now been implemented. However, there are a few features that I've decided to leave be for now, that we will likely want to come back to in a later PR:
|
Hey @b-peri just had a quick play around with this, it's frikkin awesome!! Really like the design it is very intutitive, played around with uploading a few files and it worked perfectly, really nice! I agree with the things to save for later PRs, (1) I think will become part of a more general refactoring and thinking on how to split the transfer options from the general configs. It definately makes sense to split them for the TUI, and maybe even for the API. (2) and (3) are really cool feature but could be aims to add after initial relaese, we can make some issues for these. Just dumping some misc. thoughts here I made as I used it just now so I don't forget, will come back with proper review ASAP!
Looking forward to playing with it more! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[EDITING] Hey Brandon this is looking great! I think this feels very intuitive to use and supports a lot of functionality. It is really cool to press the button then see the data appear in the new folders! The code is very well written and can follow easily what is going on and the logic flow. Please see some suggestions on the code and some misc items below:
-
I exposed some of the testing utils, see
tests/quick_make_project.py
which might come in handy for quickly making a toy project for manually testing. We can move this code out of the PR before merge. -
It would be cool to add the double-click functionality from the create tab to the transfer tab e.g. on the 'Custom' select if you double click a subject folder it adds it to the subject input box. It could append it using a comma seperator rather than replace the existing. This isn't high-priority for this PR though (and actually playing around with it the implementation for the create inputs is a little buggy / confusing, so this should be changed first).
-
For large files or long transfers, the TUI freezes which isn't a bad thing as it stops people trying to transfer again while previously transfer in progress. However might be nice to change the popup message to 'transferring' ( or even even with dynamic update from
rclone
's show-progress functionality, though I'm not sure how this would work in practice).
For the create tab, I think moving the 'settings' button from the bottom makes sense as it was a weird place for it. I did like the idea of having some separation between the functional 'Make Project' button and auxillary 'Settings' button. In my head I had it as the region 'this is the doing region where I click to create folders'. I'm not sure if this is completely made up notion specific to me😅 or is a useful distinction to have, if so maybe the 'settings' button could be moved just to the right edge of the screen? Also, there is textual rendering issue in which if the screen is very small so the overflow scroll bar appears, if you scroll to the bottom the buttons are not shown fully. We could tackle these formatting issues on another PR.
Thanks again for this! Feel free to call any comment or suggestion out of scope for this PR and we can create an issue and tackle it later. There are a lot of things to consider for the transfer tab and it is quite complex (the implementation is very neat considering the underlying complexity) so makes sense to split across a few PRs.
datashuttle/tui/tabs/transfer.py
Outdated
[ | ||
(folder, folder) | ||
for folder in canonical_folders.get_top_level_folders() | ||
if (self.project.get_local_path() / folder).exists() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I wonder if it is worth having this as a datashuttle util
Hey Joe, thanks again for your extensive review! I've now implemented all of the short-term fixes we discussed during our meeting last week, so this PR should be good to go for now! I'll throw up separate issues for the remaining items. |
Just some small final notes:
|
960a6bb
to
79a8917
Compare
dd9a078
to
48e4ed9
Compare
Hey Brandon, Thanks a lot for this, that's awesome about the styling! I added a couple of commits, many are prototype / suggestions so let me know what you think:
I tried in this PR to remove all the fancy styling Textualize does to the DirectoryTree guides as I found them distracting from the colouring on the transfer tab. I think it configs tab is also easier to read without all the random flashing colors but it does also look more boring. Also, not all cases are caught because I am still randomly getting orange and green flashes so will require a bit more work if we keep. ``Add extra checkboxes to datatype transfer tab custom` (Note this is further edited in commit This adds the
This makes a lot of changes to both There is quite a lot of looping here, this is quite fast for smaller projects but if a project have many folders and files it might get quite slow. I'm not certain whether if it is possible to do without so many loops or we can cache some values somewhere. But for now we can keep a note of it and address optimisation later once the need is more pressing and tests are written. The only other things I can think of (let me know if I missed anything) are:
So this seems like it's going to be pain, unfortunately at least I find the color change on click is quite distracting. Maybe we can find a way around this if we need a deeper sublcassing of DirectoryTree when we try to deal with the refreshing behaviour.
Overall it's really coming along, extremely satisfying to use and looks fantastic! |
…Not staged for transfer'" This reverts commit 39fab16.
Hey @b-peri sorry for the delay on this! I added a few new features and did some refactorings, please let me know what you think and if you disagree with any changes made. I think the main thing left to sort out is the refreshing of the tree such that the selected node stays open, for which there is that open PR on textual. I tried to use their fork and the feature worked nicely but was getting random async event errors. We can look into this more but will wait to hear back from Will on that thread before proceeding. Some changes / new additions:
I think once this is merged into tui-dev-branch are basically ready to merge tui-dev-branch! Still some small changes to me made to the TUI but it is basically done!! |
8bdcfe8
into
neuroinformatics-unit:tui-dev-branch
* Refactored input validators into `tui\utils\tui_validators.py` * Implemented all basic widgets and styling to Transfer tab * Implemented draft DirectoryTree widget with dynamic styling * Added FilteredTree widget to omit hidden files * Implemented core transfer functionality * Small styling tweaks and refactoring of DirectoryTree tcss * Refined `DirectoryTree` styling and implemented `ConfirmScreen` modal dialog * Fixed weird formatting on `CreateFoldersTab` button widget * Add a make project convenience script to tests, TODO: move this commit. * Remove validation from transfer tab inputs. * Use input's value to pass to datashuttle for custom transfer. * Minor bug fixes & tweaks to styling * Remove validation code missed on last commit. * Added double-click functionality and fixed `CreateFoldersTab` settings button styling * Removed `FilteredTree` and fixed `DirectoryTree` label styling bug * Added docstrings, minor cleanup, minor bugfixes * Refactored TransferStatusTree updating functions * Cleaned up `TransferStatusTree.format_transfer_label` * Added docstring to `TransferStatusTree.format_transfer_label` * Refactored all transfer tree updating logic to `TransferStatusTree` * Corrected minor typo in `TransferTab` * `TransferTab` > `DirectoryTree` double-click now appends instead of replacing * Update filetree + diff_paths after switching top level folder * Try DIrectoryTree with grey guide styling. * Add extra checkboxes to datatype transfer tab custom. * Fix change made when playing around. * Prototypy commit to extend diff colors to all top level folder + propogate new file color up the directories. * Refactor DatatypeCheckboxes for new transfer tab edition. * Accept list input to create tab. * Add custom directory tree to avoid some CSS styling. * Prototype setting custom datatypes that are not selected to 'Not staged for transfer' * Revert "Prototype setting custom datatypes that are not selected to 'Not staged for transfer'" This reverts commit 39fab16. * Remove 'no staged for transfer' for now. * Filter out .datashuttle/logs from the directorytrees * Filter out .datashuttle/logs from the directorytrees * Add copy key to directorytree. * Append to input with CTRL+A. * Refresh directorytree on ctrl+R or tab change - in progress. * Finalise refreshin on tab change and using CTRL+R * Finalise refreshin on tab change and using CTRL+R * Remove options button. * Add top level folder selector to custom transfer tab. * Add top level folder selector to custom transfer tab. * Document and refactoring. * Finish documentating. * Small refactor, add CTRL+O to open filesystem browser. * Add copy and open key press functionality to Inputs. * Fix bug on transfer files. * Fix `test_rclone_check` tests after extending to multiple top level folders. --------- Co-authored-by: JoeZiminski <[email protected]>
Requires #276
Description
This PR adds transfer functionality to the TUI's
ProjectManager
screen. As proposed previously (#265), this new functionality has been implemented using the following widgets:DirectoryTree
widget which dynamically displays the transfer status of files in the local project folder.RadioButton
widget through which the user can select their desired transfer mode (from "All", "Top Level", and "Custom")Container
which dynamically renders mode-specific input widgets according to the transfer mode selected above.Switch
widget that allows users to select whether they wish to upload or download their project data.Button
which passes the provided inputs to the appropriate transfer function.ConfirmScreen
modal dialog, which is displayed after the transfer button is pressed.Button
, which currently does nothing.References
Closes #265
Like previous TUI PRs, this PR has only been tested manually. There is also not yet any TUI documentation.