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 get_current_plugin_settings #550

Merged

Conversation

Jhonnyr97
Copy link
Contributor

Description

I created a new get_current_plugin_settings method in MadHatter to get the current plugin settings

Related to issue #(482)

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@pieroit
Copy link
Member

pieroit commented Nov 8, 2023

Looks good, merging tomorrow

@pieroit
Copy link
Member

pieroit commented Nov 20, 2023

Thanks @Jhonnyr97 sorry for the delay!
I generalized a little the method taking inspiration from @sambarza here (cheshire-cat-ai/docs#66 (comment)). The idea is to grant access to the plugin obj, from which you can get path, id, save and load settings easily.
utils.get_current_plugin_path not needed anymore

Now we can do from within a plugin:

cat.mad_hatter.get_plugin().id # gets plugin folder name
cat.mad_hatter.get_plugin().path # gets plugin folder path
cat.mad_hatter.get_plugin().load_settings()
cat.mad_hatter.get_plugin().save_settings(settings)

@pieroit pieroit merged commit acb3bb4 into cheshire-cat-ai:develop Nov 20, 2023
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