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 function to create app #1546

Merged
merged 1 commit into from
Oct 12, 2023
Merged

Add function to create app #1546

merged 1 commit into from
Oct 12, 2023

Conversation

roomrys
Copy link
Collaborator

@roomrys roomrys commented Oct 12, 2023

Description

When testing things, I often find myself running subsets of sleep.gui.app.main. This PR just breaks up main a little bit and adds a create_app function. Mainly for troubleshooting/testing.

Types of changes

  • Bugfix
  • New feature
  • Refactor / Code style update (no logical changes)
  • Build / CI changes
  • Documentation Update
  • Other (explain)

Does this address any currently open issues?

[list open issues here]

Outside contributors checklist

  • Review the guidelines for contributing to this repository
  • Read and sign the CLA and add yourself to the authors list
  • Make sure you are making a pull request against the develop branch (not main). Also you should start your branch off develop
  • Add tests that prove your fix is effective or that your feature works
  • Add necessary documentation (if appropriate)

Thank you for contributing to SLEAP!

❤️

Summary by CodeRabbit

Refactor:

  • Refactored sleap/gui/app.py to improve code readability and maintainability.
    • Introduced a new function create_app for creating a Qt application, enhancing modularity.
    • Renamed create_parser to create_sleap_label_parser for better clarity.
    • Removed the labels argument from the main function signature to simplify its usage.

Documentation:

  • Added a docstring to the create_sleap_label_parser function to provide more context about its purpose and usage.

@codecov
Copy link

codecov bot commented Oct 12, 2023

Codecov Report

Merging #1546 (0ab9327) into develop (6b14bca) will decrease coverage by 0.01%.
The diff coverage is 25.00%.

@@             Coverage Diff             @@
##           develop    #1546      +/-   ##
===========================================
- Coverage    73.37%   73.37%   -0.01%     
===========================================
  Files          134      134              
  Lines        23973    23976       +3     
===========================================
+ Hits         17591    17592       +1     
- Misses        6382     6384       +2     
Files Coverage Δ
sleap/gui/app.py 74.54% <25.00%> (-0.19%) ⬇️

... and 2 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@roomrys roomrys marked this pull request as ready for review October 12, 2023 14:12
@coderabbitai
Copy link

coderabbitai bot commented Oct 12, 2023

Walkthrough

The changes primarily focus on enhancing code readability and maintainability. Key modifications include renaming functions for clarity, adding docstrings for better understanding, and refactoring the main function to improve modularity. The creation of a Qt application is now handled by a dedicated function, and the main function signature has been simplified.

Changes

File Summary
sleap/gui/app.py - Removed an empty line in the dropEvent method.
- Renamed create_parser to create_sleap_label_parser and added a docstring.
- Created create_app function for Qt application creation.
- Refactored main function to use create_sleap_label_parser and removed labels argument.

🐇

In the land of code, where the shadows lie,

A rabbit hopped, with a twinkle in its eye.

With each leap and bound, the code took form,

Through the storm of bugs, a refactor was born.

Now the code is clean, the logic clear,

Celebrate the changes, give a cheer! 🎉


Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • Mention @coderabbitai in any review comment for bot assistance.
  • Note: Review comments are made on code diffs or files, not on the PR overview.

Pause Incremental Reviews

  • Insert @coderabbitai: ignore in the PR description to halt the bot's ongoing reviews. Remove the line to resume.
  • Additionally, enter @coderabbitai pause to halt the bot's ongoing reviews as any issue or review comment. To
    resume reviews, enter @coderabbitai resume as any issue or review comment.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Commits Files that changed from the base of the PR and between 6b14bca and 0ab9327.
Files selected for processing (1)
  • sleap/gui/app.py (4 hunks)
Additional comments (Suppressed): 5
sleap/gui/app.py (5)
  • 264-267: The dropEvent method has not been changed in this hunk. It appears to be identical to the old hunk.

  • 1604-1612: The function create_parser has been renamed to create_sleap_label_parser for clarity. This is a good practice as it makes the function's purpose more explicit. Ensure all calls to this function have been updated to reflect the new name.

  • 1652-1659: The creation of the Qt application, which was previously done in the main function, has been moved to a new function create_app. This improves modularity and makes the main function cleaner. Ensure all necessary initializations for the Qt application are done in this function.

  • 1662-1668: The main function now uses the renamed create_sleap_label_parser function and the new create_app function. The labels argument has been removed from the function signature, simplifying its usage. Ensure that all calls to this function have been updated to match the new signature.

  • 1677-1680: The main function now uses the create_app function to create the Qt application. This makes the main function cleaner and more readable.

@roomrys roomrys merged commit 1e0627a into develop Oct 12, 2023
9 checks passed
@roomrys roomrys deleted the liezl/add-create-app-function branch October 12, 2023 15:52
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