OctoPrint / Plugin-Examples

MIT License
20 stars 18 forks source link

Example of how to retrieve settings from Non SettingsPlugin classes? #4

Open eaton opened 6 years ago

eaton commented 6 years ago

I'm creating a variation on the Comment Remover plugin, but it also needs a handful of settings. octoprint.filemanager.util.LineProcessorStream doesn't appear to have easy access to self._settings, though, so retrieving them when it's time to actually process things is a bit tricky.

Is there a recommended/correct way to retrieve them outside of the plugin class itself?

foosel commented 6 years ago

I'd subclass the utility class and provide the settings object as a constructor parameter to the subclass instance.