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

Add profile previews and basic settings sub-panel #66

Merged
merged 9 commits into from
Jul 19, 2021
Merged

Conversation

yoda-vid
Copy link
Collaborator

The profiles tab contains dropdown selectors for ROI, atlas, and grid search profiles, but currently it provides little guidance on selecting a profile without having to look into the source code. This PR adds profile previews, where selecting a profile shows the profile contents in a new text area. The profile is simply the dictionary pretty-formatted to show the settings keys and value pairs.

Previously loading new profiles required pressing the "Load profiles" button, which may be unintuitive since the "Add profile" could also be interpreted to fully add it. This PR removes the "Load profiles" step so that pressing the "Add" button adds it to the table and sets it up. The "Load profiles" button is renamed to "Rescan" and now serves only to rescan the profiles directory to find any new profiles. This button may not be necessary since the directory is rescanned each time a new profile category is selected, but it makes the operation explicit and allows rescanning for the currently selected category. The profile selectors are also reorganized to clarify that the profile category selector is separate from individual profiles.

This PR also adds a new section at the bottom of the panel for software settings/preferences. Currently it has only two fields, with one showing the current version including a Git commit hash if available for developmental versions. The other field is a preferences reset button, which clears preferences saved by TraitsUI, currently only window size/position. This addition is in preparation for additional preferences such as profiles, files, etc.

yoda-vid added 9 commits July 15, 2021 10:36
Add a section to configure settings in the GUI profiles panel. This section shows the package version based on the setup script and the Git commit hash if available. A button allows the user to reset preferences, which currently only stores the window size/position through TraitsUI.

- Library function to parse the Git commit hash directly from the `.git` folder, inspired by https://stackoverflow.com/a/56245722/1911852
- Import the setup script in the GUI to access the version string
- Add the controls as a new section at the bottom of the profiles tab
- Stop checking the TraitsUI database during its setup once the package prefs have been found
The atlas profiles setup triggered by loading profiles inadvertently updated the atlas profiles with the grid profiles' names, fixed here.
The GUI profiles section has used the add button to add a profile to the table, while the load button needed to be pressed to apply these changes to the set profiles. As a simplification, set up profiles as soon as they are added to the table, which avoids the need to press the load button. Use the load button only rescan the profiles folder for additional profiles to add for the given category.
Check for existing profiles before attempting to set the first one when changing the profiles category. Also, simplify setting up the profile names.
- Clarify the profile category dropdown to specify that it is not a profile itself but selects a group of profiles
- Move the channel boxes to the category row to reduce the number of rows
- Separate the profile dropdown into a separate row with the buttons to indicate that they are related to each other
- Shorten the add button name now that it is on the same row as the profile dropdown
- Rename the load button to "Rescan" to indicate that it only rescans the available profiles
Split out getting a profile from adding a profile to get the profile dictionary.
Provide new text areas that show:
- A preview of the selected profile
- The combined profile for the selected category after merging all sub-profiles
Get the version string from `setup.py` using the strategy described in https://packaging.python.org/guides/single-sourcing-package-version/ for setuptools. The version info is extracted from the installed metadata based on the value in the setup script. Make installing the `importlib-metadata` package explicitly required for Python < 3.8 now that the package is imported, though the overall dependencies should be unchanged since TraitsUI requires this package. Provide a library function to get the version string, with the option of appending the Git commit short hash. Use this function to get the version rather than importing the setup script in the GUI.
Use `--version` to get the version string and exit.
@yoda-vid yoda-vid added the enhancement New feature or request label Jul 16, 2021
@yoda-vid yoda-vid added this to the v1.5.0 milestone Jul 16, 2021
@yoda-vid yoda-vid merged commit 3869b5f into master Jul 19, 2021
@yoda-vid yoda-vid deleted the prefs_subpanel branch July 19, 2021 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant