activity-browser icon indicating copy to clipboard operation
activity-browser copied to clipboard

Improve calculation setup dialogs with retry and pre-population

Open Copilot opened this issue 4 months ago • 0 comments

Summary

This PR improves the user experience when creating, duplicating, and renaming calculation setups by implementing automatic retry with name pre-population when duplicate names are encountered.

Changes

1. Automatic Retry on Duplicate Names (CSNew & CSDuplicate)

Previously, when a user entered a duplicate calculation setup name, an error dialog would appear and the operation would be cancelled, requiring the user to start over from the beginning.

Now, after the error dialog, the input dialog automatically reopens with the previously entered name pre-filled, allowing the user to easily modify it and try again.

Example workflow:

  • User creates new calculation setup named "my_setup"
  • "my_setup" already exists, warning appears
  • Dialog reopens with "my_setup" already filled in
  • User changes to "my_setup_v2" and continues

2. Pre-populate Old Name in Rename Dialog (CSRename)

When renaming a calculation setup, the dialog now shows the current name as editable text (not a placeholder), making it much easier to make small modifications to existing names.

Before: Empty input field
After: Input field contains the current calculation setup name, ready to edit

Additionally, CSRename now includes the same retry logic as CSNew and CSDuplicate.

Technical Details

  • Modified QInputDialog.getText() calls to use the text parameter for pre-population
  • Changed duplicate name handling from immediate return to while loop for retry
  • Added default_name parameter to CSNew.get_cs_name() method
  • All changes follow existing code patterns and pass flake8 linting

Testing

Added 5 comprehensive test cases:

  • test_cs_new_retry_on_duplicate - Verifies CSNew retry behavior
  • test_cs_new_cancel_on_retry - Ensures cancel works during retry
  • test_cs_duplicate_retry_on_duplicate - Verifies CSDuplicate retry behavior
  • test_cs_rename_retry_on_duplicate - Verifies CSRename retry behavior
  • test_cs_rename_prepopulates_old_name - Confirms old name pre-population

All existing tests continue to pass.

Related Issues

Fixes items 1 and 2 from #[issue_number]

Item 3 (Reordering FU's & IC's) is tracked separately in #1100

Original prompt

This section details on the original issue you should resolve

<issue_title>Calculation setup improvements</issue_title> <issue_description>- [ ] When creating a new calc setup (either copy or new), a name must be given, which must be unique. If the name already exists, an error is given. It would be nice if AB automatically opens the dialog again with the name previously entered

  • [ ] When renaming a calculation setup, a dialog is given. It would be nice if the dialog provides the old name already (not as placeholder, but as real text)
  • [ ] Reordering FU's & IC's (also impacts result ordering) LCA-ActivityBrowser/activity-browser#1100 </issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes LCA-ActivityBrowser/activity-browser#1108


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot avatar Oct 16 '25 12:10 Copilot