mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-10-06 09:37:52 +00:00
fix: create curated, user, official if they dosen't exists
This commit is contained in:
parent
31206e8291
commit
2e95f2d5e3
1 changed files with 29 additions and 21 deletions
|
@ -204,29 +204,37 @@ class GradienceApplication(Adw.Application):
|
|||
|
||||
buglog(self.custom_presets)
|
||||
custom_menu_section = Gio.Menu()
|
||||
if (
|
||||
self.custom_presets["user"]
|
||||
or self.custom_presets["curated"]
|
||||
or self.custom_presets["official"]
|
||||
):
|
||||
for repo, content in self.custom_presets.items():
|
||||
try:
|
||||
if (
|
||||
self.custom_presets["user"]
|
||||
or self.custom_presets["curated"]
|
||||
or self.custom_presets["official"]
|
||||
):
|
||||
for repo, content in self.custom_presets.items():
|
||||
|
||||
for preset, preset_name in content.items():
|
||||
menu_item = Gio.MenuItem()
|
||||
menu_item.set_label(preset_name)
|
||||
if not preset.startswith("error"):
|
||||
menu_item.set_action_and_target_value(
|
||||
"app.load_preset", GLib.Variant(
|
||||
"s", "custom-" + preset)
|
||||
)
|
||||
else:
|
||||
menu_item.set_action_and_target_value("")
|
||||
custom_menu_section.append_item(menu_item)
|
||||
else:
|
||||
menu_item = Gio.MenuItem()
|
||||
menu_item.set_label("No presets found")
|
||||
custom_menu_section.append_item(menu_item)
|
||||
for preset, preset_name in content.items():
|
||||
menu_item = Gio.MenuItem()
|
||||
menu_item.set_label(preset_name)
|
||||
if not preset.startswith("error"):
|
||||
menu_item.set_action_and_target_value(
|
||||
"app.load_preset", GLib.Variant(
|
||||
"s", "custom-" + preset)
|
||||
)
|
||||
else:
|
||||
menu_item.set_action_and_target_value("")
|
||||
custom_menu_section.append_item(menu_item)
|
||||
else:
|
||||
menu_item = Gio.MenuItem()
|
||||
menu_item.set_label("No presets found")
|
||||
custom_menu_section.append_item(menu_item)
|
||||
|
||||
except KeyError:
|
||||
if not os.path.exists(os.path.json(PRESET_DIR, "user")):
|
||||
os.makedirs(os.path.json(PRESET_DIR, "user"))
|
||||
if not os.path.exists(os.path.json(PRESET_DIR, "curated")):
|
||||
os.makedirs(os.path.json(PRESET_DIR, "curated"))
|
||||
if not os.path.exists(os.path.json(PRESET_DIR, "official")):
|
||||
os.makedirs(os.path.json(PRESET_DIR, "official"))
|
||||
open_in_file_manager_item = Gio.MenuItem()
|
||||
open_in_file_manager_item.set_label(_("Open in File Manager"))
|
||||
open_in_file_manager_item.set_action_and_target_value(
|
||||
|
|
Loading…
Reference in a new issue