2022-08-11 08:16:44 +00:00
|
|
|
# plugin.py
|
|
|
|
#
|
|
|
|
# Change the look of Adwaita, with ease
|
2022-08-15 23:21:58 +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 15:51:55 +00:00
|
|
|
|
2022-09-07 15:52:50 +00:00
|
|
|
class GradiencePluginCore:
|
2022-08-10 15:51:55 +00:00
|
|
|
def __init__(self):
|
|
|
|
self.title = None
|
2022-08-19 13:30:42 +00:00
|
|
|
self.author = None
|
|
|
|
self.description = None
|
2022-08-10 15:51:55 +00:00
|
|
|
|
|
|
|
self.colors = None
|
|
|
|
self.palette = None
|
|
|
|
|
|
|
|
# Custom settings shown on a separate view
|
|
|
|
self.custom_settings = {}
|
|
|
|
# A dict to alias parameters to different names
|
|
|
|
# Key is the alias name, value is the parameter name
|
|
|
|
# Parameter can be any key in colors, palette or custom settings
|
|
|
|
self.alias_dict = {}
|
|
|
|
|
|
|
|
def update_builtin_parameters(self, colors, palette):
|
|
|
|
self.colors = colors
|
|
|
|
self.palette = palette
|
|
|
|
|
|
|
|
def load_custom_settings(self, settings):
|
|
|
|
for setting_key, setting in self.custom_settings:
|
|
|
|
self.custom_settings[setting_key].set_value(settings[setting_key])
|
|
|
|
|
|
|
|
def get_custom_settings_for_preset(self):
|
|
|
|
setting_dict = {}
|
|
|
|
for setting_key, setting in self.custom_settings:
|
2022-08-10 15:56:06 +00:00
|
|
|
return setting_dict[setting_key]
|
2022-08-10 15:51:55 +00:00
|
|
|
|
|
|
|
def get_alias_values(self):
|
|
|
|
alias_values = {}
|
|
|
|
for key, value in self.alias_dict.items():
|
2022-08-11 16:39:52 +00:00
|
|
|
alias_values[key] = self.colors.get(
|
|
|
|
value, self.palette.get(value, self.custom_settings.get(value))
|
|
|
|
)
|
2022-08-10 15:51:55 +00:00
|
|
|
return alias_values
|
|
|
|
|
|
|
|
def validate(self):
|
2022-08-10 15:56:06 +00:00
|
|
|
raise NotImplementedError()
|
2022-08-10 15:51:55 +00:00
|
|
|
|
2022-08-13 16:30:41 +00:00
|
|
|
def apply(self, dark_theme=False):
|
2022-08-10 15:56:06 +00:00
|
|
|
raise NotImplementedError()
|
|
|
|
|
|
|
|
def save(self):
|
2022-08-13 16:30:41 +00:00
|
|
|
raise NotImplementedError()
|