-
Notifications
You must be signed in to change notification settings - Fork 96
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
Menu option to open preferences directory and update to util functions to pathlib #1843
Conversation
WalkthroughThe recent changes enhance the SLEAP software by adding a method to open the preferences directory and improving how configuration files are handled. In the GUI, new functions and menu items facilitate easier access to user preferences. In the utilities, the path handling and directory creation for config files have been refactored for better efficiency and readability. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GUI as SLEAP GUI
participant OS as Operating System
User->>+GUI: Trigger "Open Preferences Directory"
GUI->>+OS: Execute subprocess to open directory
OS-->>-GUI: Directory opened
GUI-->>-User: Preferences directory is now accessible
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- sleap/gui/app.py (4 hunks)
- sleap/util.py (1 hunks)
Additional comments not posted (7)
sleap/util.py (5)
276-276
: LGTM!The use of
desired_path.parent.mkdir(parents=True, exist_ok=True)
ensures that the necessary directories are created if they do not exist.
279-280
: LGTM!The check for
ignore_file_not_found
is clear and concise.
283-283
: LGTM!The condition for
get_defaults
or non-existentdesired_path
is clear and concise.
285-285
: LGTM!Converting
package_path
to aPath
object ensures consistency in path handling.
273-273
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
get_config_file
are updated to handle the new implementation.sleap/gui/app.py (2)
520-525
: LGTM! But verify the function usage in the codebase.The addition of the new menu item for opening the preference directory is approved.
However, ensure that all references to
resetPrefs
are updated to handle the new menu item.Verification successful
Verified: The new menu item for opening the preference directory is correctly integrated.
- The
resetPrefs
function is defined and referenced appropriately.- The
openPrefs
function is defined and referenced appropriately.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to `resetPrefs` are updated to handle the new menu item. # Test: Search for the function usage. Expect: Occurrences of the new menu item. rg --type python $'resetPrefs'Length of output: 60
Script:
#!/bin/bash # Description: Verify all references to `resetPrefs` and `openPrefs` are updated to handle the new menu item. # Test: Search for the function usage. Expect: Occurrences of the new menu item. rg 'resetPrefs' --glob '*.py' rg 'openPrefs' --glob '*.py'Length of output: 294
1342-1354
: LGTM! But verify the function usage in the codebase.The new function
openPrefs
is approved. It correctly usessubprocess
to open the directory in the appropriate file manager based on the user's platform.However, ensure that all references to
openPrefs
are correctly implemented in the codebase.Verification successful
Verification Successful
The function
openPrefs
is correctly implemented and referenced in the codebase. It is used in theadd_menu_item
call to add a menu item for opening the preference directory.
sleap/gui/app.py
:self.openPrefs
is correctly used in theadd_menu_item
call.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all references to `openPrefs` are correctly implemented in the codebase. # Test: Search for the function usage. Expect: Occurrences of the new function. rg --type python $'openPrefs'Length of output: 59
Script:
#!/bin/bash # Description: Verify all references to `openPrefs` are correctly implemented in the codebase. # Test: Search for the function usage. Expect: Occurrences of the new function. rg --type py 'openPrefs'Length of output: 111
Script:
#!/bin/bash # Description: Extract lines around the first occurrence of `openPrefs` in sleap/gui/app.py to understand its usage context. rg --type py --context 5 'self.openPrefs' sleap/gui/app.pyLength of output: 322
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1843 +/- ##
===========================================
+ Coverage 73.30% 74.13% +0.82%
===========================================
Files 134 135 +1
Lines 24087 24572 +485
===========================================
+ Hits 17658 18217 +559
+ Misses 6429 6355 -74 ☔ View full report in Codecov by Sentry. |
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.
Minor change but LGTM!
sleap/gui/app.py
Outdated
add_menu_item( | ||
fileMenu, | ||
"open preference directory", | ||
"Open preference directory...", |
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.
"Open preference directory...", | |
"Open Preferences Directory...", |
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- sleap/gui/app.py (4 hunks)
Files skipped from review as they are similar to previous changes (1)
- sleap/gui/app.py
Description
Right now, users are finding it a bit difficult to find the
preferences.yaml
file that stores the user preferences. Hence, adding a menu option to open the File Explorer (Windows)/Finder (MacOS)/Linux at thepreferences.yaml
directory.Types of changes
Does this address any currently open issues?
[list open issues here]
Outside contributors checklist
Thank you for contributing to SLEAP!
❤️
Summary by CodeRabbit