2022-10-10 19:52:45 +00:00
|
|
|
# repo.py
|
|
|
|
#
|
|
|
|
# Change the look of Adwaita, with ease
|
|
|
|
# Copyright (C) 2022 Gradience 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.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# 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-10-10 19:45:47 +00:00
|
|
|
from gradience.utils.utils import to_slug_case
|
|
|
|
from gradience.utils.preset import Preset, presets_dir
|
2022-09-14 12:49:39 +00:00
|
|
|
import os
|
|
|
|
|
2022-09-14 12:50:12 +00:00
|
|
|
|
2022-09-14 12:49:39 +00:00
|
|
|
class Repo:
|
|
|
|
presets = {}
|
2022-09-14 12:50:12 +00:00
|
|
|
|
2022-09-14 12:49:39 +00:00
|
|
|
def __init__(self, name):
|
|
|
|
self.name = to_slug_case(name)
|
2022-10-02 01:57:29 +00:00
|
|
|
self.path = os.path.join(presets_dir, name)
|
2022-09-14 12:49:39 +00:00
|
|
|
self.presets = self.get_presets()
|
|
|
|
|
|
|
|
def get_presets(self):
|
|
|
|
presets = {}
|
|
|
|
for preset in os.listdir(self.path):
|
|
|
|
if preset.endswith(".json"):
|
2022-11-20 03:02:16 +00:00
|
|
|
presets[preset[:-5]] = Preset(os.path.join(self.path, preset))
|
2022-09-14 12:49:39 +00:00
|
|
|
return presets
|