Skip to content
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 validation to create folders #276

Merged
merged 14 commits into from
Jan 12, 2024

Conversation

JoeZiminski
Copy link
Member

@JoeZiminski JoeZiminski commented Nov 15, 2023

This PR makes improvement to the 'Create' tab on the project manager screen that is used to create folders. It adds:

  • Online validation of the subject / sessions that are input into the "Subject" and "Session" input widgets. Under the hood these call datashuttle validation functions.
  • A new 'template settings' popup window that allows setting regexp options used as sub / ses name 'templates' that validation can also (optionally) be performed against. These are based on the changes made in Add name templates and improve validation #278
  • Double-left clikcing on an input widget will auto-fill with the current template, if it is not set it will just fill with the prefix e.g. sub-.
  • Double right-clicking on an input will auto-fill with the next suggested sub / ses number. If templates is on, it will replace the relevant key-value pair with the suggested key-value.
  • Note all validation and next sub / ses suggestions are currently done based on the local folder only.
    As part of the above two general features atr introduced:
  • ClickableInput, a Input where clicks emit a signal as suggested by Textual here
  • a new decorator require_double_click. This will run the function it decorates if a double-click signal is detected, otherwise nothing will happen (the logic is the same as previous implementation only generalised).

There are no tests except for manual testing. There is no TUI documentation at the moment.

@JoeZiminski JoeZiminski changed the base branch from main to tui-dev-branch November 15, 2023 09:12
@JoeZiminski JoeZiminski force-pushed the add_validation_to_create_folders branch 13 times, most recently from d16bf05 to 79d89a7 Compare November 16, 2023 10:55
@JoeZiminski JoeZiminski changed the base branch from tui-dev-branch to add_name_templates_and_improve_validation November 16, 2023 10:57
@JoeZiminski JoeZiminski marked this pull request as draft November 16, 2023 12:03
@JoeZiminski JoeZiminski requested a review from b-peri November 16, 2023 12:03
@JoeZiminski JoeZiminski force-pushed the add_validation_to_create_folders branch from 79d89a7 to ae40cdc Compare November 22, 2023 13:48
@JoeZiminski
Copy link
Member Author

JoeZiminski commented Nov 22, 2023

TODO: for some reason the right-click autofill is not working on macos.

Copy link
Collaborator

@b-peri b-peri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Joe, thanks a lot for this very extensive (and very cool) PR! I've added a few additional commits to clean up some redundant code in the .tcss files and template_settings.py, but otherwise this seems great as is!

One note: As you likely already noticed yourself, create_folders.py is starting to get a bit bloated (and hard to read!), so I think we'll need to come back and refactor out some of the auxiliary logic down the line (esp. things like validators). We can meet to discuss this once #265 is done and dusted if that works?

@JoeZiminski
Copy link
Member Author

Hey @b-peri thanks for the review and additions! That sounds great to discuss refactoring after #265 I think that will be a good time for a clean up, cheers!

@b-peri b-peri mentioned this pull request Dec 1, 2023
@JoeZiminski JoeZiminski force-pushed the add_name_templates_and_improve_validation branch from e1d0058 to fb7440a Compare January 11, 2024 17:12
@JoeZiminski JoeZiminski force-pushed the add_validation_to_create_folders branch from 960a6bb to 79a8917 Compare January 11, 2024 17:20
@JoeZiminski JoeZiminski changed the base branch from add_name_templates_and_improve_validation to tui-dev-branch January 11, 2024 17:21
@JoeZiminski JoeZiminski marked this pull request as ready for review January 11, 2024 17:21
@JoeZiminski JoeZiminski merged commit dd9a078 into tui-dev-branch Jan 12, 2024
16 checks passed
@JoeZiminski JoeZiminski deleted the add_validation_to_create_folders branch January 12, 2024 11:46
@JoeZiminski JoeZiminski restored the add_validation_to_create_folders branch January 12, 2024 12:42
@JoeZiminski JoeZiminski deleted the add_validation_to_create_folders branch January 12, 2024 12:43
JoeZiminski added a commit that referenced this pull request Jan 12, 2024
* Add validation to subject and session Inputs.

* Load datatype checkbox status from a persistent settings file stored in project config folder.

* Introduce CreateFolderSettings page to manage the template names.

* Format and give functionality to the template settings page.

* Add hyperlink, small tidy ups.

* Tidy up css and add light-mode for new widgets.

* Refactoring and tidy ups on TUI modules.

* Handle nonetype templates properly.

* Small refactorings and tidy-ups.

* Align + tidy up CreateFoldersTab button widgets

* Minor cleanups `tui_menu.tcss`

* Update project selector menubar to allow vertical scroll bar.

* Update datatype dict on mount so that any persistent settings are reflected in `datatype_dict`.

* Some more minor cleanup

---------

Co-authored-by: b-peri <[email protected]>
JoeZiminski added a commit that referenced this pull request Feb 1, 2024
* Add validation to subject and session Inputs.

* Load datatype checkbox status from a persistent settings file stored in project config folder.

* Introduce CreateFolderSettings page to manage the template names.

* Format and give functionality to the template settings page.

* Add hyperlink, small tidy ups.

* Tidy up css and add light-mode for new widgets.

* Refactoring and tidy ups on TUI modules.

* Handle nonetype templates properly.

* Small refactorings and tidy-ups.

* Align + tidy up CreateFoldersTab button widgets

* Minor cleanups `tui_menu.tcss`

* Update project selector menubar to allow vertical scroll bar.

* Update datatype dict on mount so that any persistent settings are reflected in `datatype_dict`.

* Some more minor cleanup

---------

Co-authored-by: b-peri <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants