Molara-Lab / Molara

Molara is a Python package for the visualization of chemical structures such as molecules or crystals. It provides a graphical user interface for importing structures from output files of popular computational chemistry software as well as for creating custom structures.
GNU General Public License v3.0
11 stars 0 forks source link

Feature/352 enable chosing between ball and stick and only stick #360

Closed Michel-Heinz closed 2 months ago

Michel-Heinz commented 2 months ago

The pull request for the structure customizer is here. You can open the menu under view->Open Structure Customizer You can save, delete, and load presets. The Default preset is loaded upon starting and can be overwritten.

Summary by CodeRabbit

coderabbitai[bot] commented 2 months ago

Walkthrough

The recent update in the Molara project introduces a "Structure Customizer" feature, enhancing user interaction by enabling customization of molecular structures through new UI components and settings. This update involves adjustments in GUI actions, dialog implementations, and backend modifications to support these new functionalities.

Changes

File Path Change Summary
.../Settings/Structure/Default.json, src/molara/Gui/structure_widget.py Introduced settings for stick mode, bonds, ball size, and stick size. Updated bond handling methods and removed toggle_bonds method.
src/molara/Gui/structure_customizer_dialog.py, src/molara/Gui/structure_widget.py Introduced a dialog for manipulating structure appearance in the GUI. Users can customize ball and stick sizes, toggle stick and ball modes, show/hide bonds, save/load settings, and delete saved settings.
src/molara/Structure/drawer.py, tests/molara/Structure/test_drawer.py Updated properties initialization and added methods for handling cylinder dimensions and properties in drawer.py. Increased sphere subdivisions in test setup.
tests/molara/gui/test_main_window.py Modified test case to call toggle_bonds from structure_customizer_dialog instead of structure_widget.

🐇💻✨ In the digital burrow, beneath the code's deep layer, A rabbit hopped with joy, for changes debonair. "Click and tweak," it squeaked, with glee, "For molecules, as vast as sea!" Customise your view, let structures freely sway, In Molara's land, where atoms dance and play. 🌟🔬


Recent Review Details **Configuration used: CodeRabbit UI**
Commits Files that changed from the base of the PR and between ecea99b405fb2887373c76df116e092c676bc499 and 2a230c6bf006317020b46cd7b32060833cde2846.
Files selected for processing (2) * .gitignore (1 hunks) * src/molara/Gui/structure_customizer_dialog.py (1 hunks)
Additional Context Used
GitHub Check Runs (1)
codecov/patch success (10)
src/molara/Gui/structure_customizer_dialog.py: [warning] 82-84: src/molara/Gui/structure_customizer_dialog.py#L82-L84 Added lines #L82 - L84 were not covered by tests --- src/molara/Gui/structure_customizer_dialog.py: [warning] 102-102: src/molara/Gui/structure_customizer_dialog.py#L102 Added line #L102 was not covered by tests --- src/molara/Gui/structure_customizer_dialog.py: [warning] 116-118: src/molara/Gui/structure_customizer_dialog.py#L116-L118 Added lines #L116 - L118 were not covered by tests --- src/molara/Gui/structure_customizer_dialog.py: [warning] 133-136: src/molara/Gui/structure_customizer_dialog.py#L133-L136 Added lines #L133 - L136 were not covered by tests --- src/molara/Gui/structure_customizer_dialog.py: [warning] 155-155: src/molara/Gui/structure_customizer_dialog.py#L155 Added line #L155 was not covered by tests --- src/molara/Gui/structure_customizer_dialog.py: [warning] 167-167: src/molara/Gui/structure_customizer_dialog.py#L167 Added line #L167 was not covered by tests --- src/molara/Gui/structure_customizer_dialog.py: [warning] 169-171: src/molara/Gui/structure_customizer_dialog.py#L169-L171 Added lines #L169 - L171 were not covered by tests --- src/molara/Gui/structure_customizer_dialog.py: [warning] 194-204: src/molara/Gui/structure_customizer_dialog.py#L194-L204 Added lines #L194 - L204 were not covered by tests --- src/molara/Gui/structure_customizer_dialog.py: [warning] 206-210: src/molara/Gui/structure_customizer_dialog.py#L206-L210 Added lines #L206 - L210 were not covered by tests
Additional comments not posted (3)
src/molara/Gui/structure_customizer_dialog.py (3)
`77-84`: Ensure that the `delete_settings` method is covered by tests, especially since it involves file operations which can be prone to errors. --- `86-99`: Consider adding error handling for file operations and JSON parsing in the `load_settings` method to manage exceptions such as missing files or invalid JSON data gracefully. --- `192-210`: Verify the presence of structures and that they have bonds before toggling stick mode to prevent potential errors from accessing properties on an empty list or structures without bonds.
--- 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?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` 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) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 2 months ago

Codecov Report

Attention: Patch coverage is 85.89744% with 33 lines in your changes are missing coverage. Please review.

Project coverage is 71.72%. Comparing base (7f83c43) to head (2a230c6).

Files Patch % Lines
src/molara/Gui/structure_customizer_dialog.py 76.29% 32 Missing :warning:
src/molara/Structure/drawer.py 93.33% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #360 +/- ## ========================================== + Coverage 70.83% 71.72% +0.88% ========================================== Files 38 40 +2 Lines 3251 3466 +215 ========================================== + Hits 2303 2486 +183 - Misses 948 980 +32 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

GereonFeldmann commented 2 months ago

Nice feature, looks really good so far. I have four minor issues to address.

  1. The names of the settings are not case sensitive. Is this intended?
  2. You cannot change the settings without a molecule imported. Again, is this intended?
  3. I think it would be good if we add a query, whether a setting should be deleted. This is not big of an issue atm. However, if we increases the variety of settings, this will be crucial.
  4. The json for the settings is currently in a structures folder, I guess you intend to use several json for differing settings. I think we should actually put it in one. Imo, as this is in a dictionary style, it is still clearly arranged and you will not get lost in several setting files.
Michel-Heinz commented 2 months ago

Nice feature, looks really good so far. I have four minor issues to address.

  1. The names of the settings are not case sensitive. Is this intended?
  2. You cannot change the settings without a molecule imported. Again, is this intended?
  3. I think it would be good if we add a query, whether a setting should be deleted. This is not big of an issue atm. However, if we increases the variety of settings, this will be crucial.
  4. The json for the settings is currently in a structures folder, I guess you intend to use several json for differing settings. I think we should actually put it in one. Imo, as this is in a dictionary style, it is still clearly arranged and you will not get lost in several setting files.

1 Interesting, i thought the would cas sensitive, I ll have a look 2 Never thoguht about that, but makes sense, how do you want to change something if you don t see what you are doing? 3 Already implemented, but not pushed 4 Thought about that decided not to do that, in order for user to exchange single setting files without much work :)

Michel-Heinz commented 2 months ago

@GereonFeldmann