Gradience/src/plugins_list.py

48 lines
1.6 KiB
Python
Raw Normal View History

2022-08-11 08:16:44 +00:00
# plugins_list.py
#
# Change the look of Adwaita, with ease
# Copyright (C) 2022 Adwaita Manager Team
#
# 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-10 15:51:55 +00:00
class AdwcustomizerPluginsList:
def __init__(self):
2022-08-13 16:30:41 +00:00
self.discoverd_plugins = {
name: importlib.import_module(name)
for finder, name, ispkg
in pkgutil.iter_modules()
if name.startswith('adwcustomizer_')
}
self.plugins = {}
for plugin_id, plugin in self.plugins.items():
self.plugins[plugin_id] = plugin.AdwcustomizerPlugin()
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()