2022-08-11 08:16:44 +00:00
|
|
|
# plugins_list.py
|
|
|
|
#
|
|
|
|
# Change the look of Adwaita, with ease
|
2022-08-15 23:23:21 +00:00
|
|
|
# Copyright (C) 2022 Gradience Team
|
2022-08-11 08:16:44 +00:00
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2022-08-11 16:39:52 +00:00
|
|
|
#
|
2022-08-11 08:16:44 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2022-08-11 16:39:52 +00:00
|
|
|
#
|
2022-08-11 08:16:44 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
|
2022-08-10 16:24:28 +00:00
|
|
|
import os
|
|
|
|
from pathlib import Path
|
|
|
|
import importlib
|
2022-08-13 16:30:41 +00:00
|
|
|
import pkgutil
|
2022-08-11 16:39:52 +00:00
|
|
|
|
2022-08-17 21:35:59 +00:00
|
|
|
|
2022-08-19 12:32:02 +00:00
|
|
|
class GradiencePluginsList:
|
2022-08-10 15:51:55 +00:00
|
|
|
def __init__(self):
|
2022-08-17 21:35:59 +00:00
|
|
|
self.discoverd_plugins = {
|
2022-08-13 16:30:41 +00:00
|
|
|
name: importlib.import_module(name)
|
|
|
|
for finder, name, ispkg
|
|
|
|
in pkgutil.iter_modules()
|
2022-08-19 12:32:02 +00:00
|
|
|
if name.startswith('gradience_')
|
2022-08-13 16:30:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
self.plugins = {}
|
|
|
|
|
|
|
|
for plugin_id, plugin in self.plugins.items():
|
2022-08-19 12:32:02 +00:00
|
|
|
self.plugins[plugin_id] = plugin.GradiencePlugin()
|
2022-08-10 16:24:28 +00:00
|
|
|
|
2022-08-13 16:30:41 +00:00
|
|
|
print(self.plugins)
|
2022-08-10 16:24:28 +00:00
|
|
|
|
2022-08-10 15:51:55 +00:00
|
|
|
def load_all_custom_settings(self, settings):
|
|
|
|
for plugin_id, plugin in self.plugins.items():
|
2022-08-13 16:30:41 +00:00
|
|
|
plugin.load_custom_settings(settings)
|
2022-08-10 15:51:55 +00:00
|
|
|
|
|
|
|
def get_all_custom_settings_for_preset(self):
|
|
|
|
custom_settings = {}
|
|
|
|
for plugin_id, plugin in self.plugins.items():
|
2022-08-11 16:39:52 +00:00
|
|
|
custom_settings[plugin_id] = plugin.get_custom_settings_for_preset()
|