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 a preferences window #2167

Merged
merged 12 commits into from
Oct 26, 2022
Merged

Add a preferences window #2167

merged 12 commits into from
Oct 26, 2022

Conversation

krzywon
Copy link
Contributor

@krzywon krzywon commented Aug 19, 2022

This adds a preferences panel that can be opened from the File menu. There is a helper class for adding property widgets, a help file, and some basic unit tests.

I'm opening this as a draft because @lucas-wilkins is actively working on the config files for #2164 and we plan to combine our efforts once both are ready.

Fixes #2166

@wpotrzebowski wpotrzebowski added the Discuss At The Call Issues to be discussed at the fortnightly call label Aug 29, 2022
@wpotrzebowski wpotrzebowski removed the Discuss At The Call Issues to be discussed at the fortnightly call label Aug 30, 2022
@lucas-wilkins
Copy link
Contributor

See #2176 for why your tests are failing, merge the associated branch for fix, or merge main when #2178 is merged in.

@lucas-wilkins
Copy link
Contributor

Hey, I'm pretty close to having the config stuff updated. There's a lot of changes, but it should be pretty simple to use. Just ironing out bugs that are only detected when building the installers.

self.restoreDefaultMethods = []
# Set defaults values for the list and stacked widgets
self.stackedWidget.setCurrentIndex(0)
self.listWidget.setCurrentRow(0)
Copy link
Member

Choose a reason for hiding this comment

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

why is this necessary in the __init__ method? Aren't current indices/rows set to 0 anyway on instantiation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not necessary, but a good practice to ensure the two widgets are at the same point.

elif btn.text() == 'OK':
self.close()
elif btn.text() == 'Help':
self.help()
Copy link
Member

Choose a reason for hiding this comment

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

it's probably better to create separate slots for all the buttons rather than compare with the text property. Those texts can change and updating the handlers is not an obvious follow up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed. This was a placeholder.

src/sas/qtgui/Utilities/PreferencesPanel.py Outdated Show resolved Hide resolved
@wpotrzebowski
Copy link
Contributor

@krzywon is this PR still in DRAFT state?

@krzywon
Copy link
Contributor Author

krzywon commented Oct 4, 2022

@krzywon is this PR still in DRAFT state?

This is waiting on #2168 to be finalized. Once it is, I will need to make a few changes here to account for the configuration changes.

@krzywon krzywon marked this pull request as ready for review October 14, 2022 21:48
@krzywon
Copy link
Contributor Author

krzywon commented Oct 14, 2022

I have updated the window to account for changes made to the configuration system in PR #2168. There are a few outstanding modifications needed, as noted by @rozyczko, otherwise, this is ready for review.

Question: There are at least three ways forward from here - which one is preferred? I plan to work on 2 and 3 (and beyond) during the code camp if that makes a difference:

  1. I can keep this PR as bare as possible with just the blank window. Other settings can then be moved into the window by submitting separate PRs.
  2. I can add to this PR by creating a basic widget that houses the existing configuration values. (default file extensions, open folders, toolbar visibility, etc.)
  3. Along with (2), I can also move certain preferences into this window, including the fitting options, and the fitting optimizer selection tool.

@lucas-wilkins
Copy link
Contributor

Regarding option 2:

I can add to this PR by creating a basic widget that houses the existing configuration values. (default file extensions, open folders, toolbar visibility, etc.)

I'm not sure how many of these need to be in a preferences panel. I fact, I'm not sure some of them belong in the config, I just wasn't sure about removing them from it at the time.

Copy link
Contributor

@wpotrzebowski wpotrzebowski left a comment

Choose a reason for hiding this comment

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

I think it is good enough to give basis for Preferences windows. I've vote for merging it and move on with remaining functionality later

@rozyczko
Copy link
Member

One potential issue is with multiple config files design. Should we not expect tab-per-config file view rather than have all config items thrown into a single window/view?
On the other hand, this GUI should offer a view on the json file generated by SasView rather than on the python files with definitions/defaults, so it's probably moot.

@krzywon
Copy link
Contributor Author

krzywon commented Oct 25, 2022

Should we not expect tab-per-config file view rather than have all config items thrown into a single window/view?

My vision is to have separate tabs for separate preference types. Plotting options would be separate from fitting optimizers, which would be separate from GPU options, etc. Calling the config from different tabs is straightforward, but would be cumbersome for the user to have everything bundled together.

@krzywon
Copy link
Contributor Author

krzywon commented Oct 26, 2022

I merged main, updated my unit tests, and added tests for the preferences widget generator. Assuming CI succeeds, this should now be ready to merge

@wpotrzebowski wpotrzebowski merged commit 13ce228 into main Oct 26, 2022
@wpotrzebowski wpotrzebowski deleted the preferences-window branch October 26, 2022 08:19
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.

Create Centralized Preferences Window
4 participants