mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-06-14 02:16:57 +00:00
Format code with black and autopep8
This commit fixes the style issues introduced in 8bf32aa
according to the output
from black and autopep8.
Details: https://deepsource.io/gh/GradienceTeam/Gradience/transform/cc444fc5-ea75-4fb7-8fc3-a68e922e413e/
This commit is contained in:
parent
8bf32aa5b3
commit
4289a6086e
|
@ -84,9 +84,8 @@ class FirefoxGnomeThemePlugin(IPlugin):
|
|||
custom_settings = {"overwrite": True}
|
||||
css = BASE
|
||||
browser_row = Adw.EntryRow(
|
||||
title="Path to the profile directory",
|
||||
|
||||
)
|
||||
title="Path to the profile directory",
|
||||
)
|
||||
profile_dir = None
|
||||
|
||||
def activate(self):
|
||||
|
@ -135,18 +134,18 @@ class FirefoxGnomeThemePlugin(IPlugin):
|
|||
# Browser
|
||||
self.browser_pref = Adw.PreferencesGroup()
|
||||
self.browser_pref.set_title("Browser")
|
||||
self.browser_pref.set_description("Choose where profiles are stored. If you don't know what this is, leave it as default, it will work in most cases.")
|
||||
self.browser_pref.set_description(
|
||||
"Choose where profiles are stored. If you don't know what this is, leave it as default, it will work in most cases."
|
||||
)
|
||||
|
||||
self.browser_row = Adw.EntryRow(
|
||||
title="Path to the directory where profiles are stored",
|
||||
|
||||
)
|
||||
self.browser_row.set_text("~/.mozilla/firefox")
|
||||
self.browser_row.set_show_apply_button(True)
|
||||
self.browser_row.connect("apply", self.on_apply)
|
||||
self.browser_pref.add(self.browser_row)
|
||||
|
||||
|
||||
self.main_page.add(self.browser_pref)
|
||||
|
||||
self.window.add(self.main_page)
|
||||
|
@ -160,12 +159,10 @@ class FirefoxGnomeThemePlugin(IPlugin):
|
|||
else:
|
||||
self.browser_row.remove_css_class("error")
|
||||
|
||||
|
||||
|
||||
|
||||
def on_overwrite(self, widget, _):
|
||||
# This is called when the user changes the overwrite setting
|
||||
self.custom_settings["overwrite"] = not self.custom_settings["overwrite"]
|
||||
|
||||
def validate(self):
|
||||
# Normally, it would be a good idea to validate the settings here
|
||||
# But because there is only one setting and it can onbly be a boolean
|
||||
|
@ -198,21 +195,38 @@ class FirefoxGnomeThemePlugin(IPlugin):
|
|||
print("No profiles found")
|
||||
return
|
||||
else:
|
||||
self.css = self.css.format(d_1=self.palette["dark_"]["1"], d_2=self.palette["dark_"]["2"], d_3=self.palette["dark_"]["3"], d_4=self.palette["dark_"]["4"],
|
||||
l_1=self.palette["light_"]["1"], l_2=self.palette["light_"][
|
||||
"2"], l_3=self.palette["light_"]["3"], l_4=self.palette["light_"]["4"],
|
||||
bg=self.variables["window_bg_color"], fg=self.variables["window_fg_color"],
|
||||
|
||||
red=self.palette["red_"]["5"], grn=self.palette["green_"][
|
||||
"5"], ylw=self.palette["yellow_"]["5"], blu=self.palette["blue_"]["5"],
|
||||
pnk=self.palette["purple_"]["5"], cyn=self.palette["blue_"][
|
||||
"5"], wht=self.palette["light_"]["5"], blk=self.palette["dark_"]["5"],
|
||||
|
||||
b_red=self.palette["red_"]["1"], b_grn=self.palette["green_"][
|
||||
"1"], b_ylw=self.palette["yellow_"]["1"], b_blu=self.palette["blue_"]["1"],
|
||||
b_pnk=self.palette["purple_"]["1"], b_cyn=self.palette["blue_"]["1"], b_wht=self.palette["light_"]["1"], b_blk=self.palette["dark_"]["1"])
|
||||
self.css = self.css.format(
|
||||
d_1=self.palette["dark_"]["1"],
|
||||
d_2=self.palette["dark_"]["2"],
|
||||
d_3=self.palette["dark_"]["3"],
|
||||
d_4=self.palette["dark_"]["4"],
|
||||
l_1=self.palette["light_"]["1"],
|
||||
l_2=self.palette["light_"]["2"],
|
||||
l_3=self.palette["light_"]["3"],
|
||||
l_4=self.palette["light_"]["4"],
|
||||
bg=self.variables["window_bg_color"],
|
||||
fg=self.variables["window_fg_color"],
|
||||
red=self.palette["red_"]["5"],
|
||||
grn=self.palette["green_"]["5"],
|
||||
ylw=self.palette["yellow_"]["5"],
|
||||
blu=self.palette["blue_"]["5"],
|
||||
pnk=self.palette["purple_"]["5"],
|
||||
cyn=self.palette["blue_"]["5"],
|
||||
wht=self.palette["light_"]["5"],
|
||||
blk=self.palette["dark_"]["5"],
|
||||
b_red=self.palette["red_"]["1"],
|
||||
b_grn=self.palette["green_"]["1"],
|
||||
b_ylw=self.palette["yellow_"]["1"],
|
||||
b_blu=self.palette["blue_"]["1"],
|
||||
b_pnk=self.palette["purple_"]["1"],
|
||||
b_cyn=self.palette["blue_"]["1"],
|
||||
b_wht=self.palette["light_"]["1"],
|
||||
b_blk=self.palette["dark_"]["1"],
|
||||
)
|
||||
for profile in profiles:
|
||||
profile = profile / "chrome" / "firefox-gnome-theme" / "customChrome.css"
|
||||
profile = (
|
||||
profile / "chrome" / "firefox-gnome-theme" / "customChrome.css"
|
||||
)
|
||||
if profile.exists():
|
||||
if self.custom_settings["overwrite"]:
|
||||
with open(profile, "w", encoding="utf-8") as f:
|
||||
|
|
|
@ -60,10 +60,7 @@ class GradienceApplication(Adw.Application):
|
|||
settings = Gio.Settings.new(app_id)
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(
|
||||
application_id=app_id,
|
||||
flags=Gio.ApplicationFlags.FLAGS_NONE
|
||||
)
|
||||
super().__init__(application_id=app_id, flags=Gio.ApplicationFlags.FLAGS_NONE)
|
||||
self.set_resource_base_path(rootdir)
|
||||
|
||||
self.portal = Xdp.Portal()
|
||||
|
@ -180,8 +177,9 @@ class GradienceApplication(Adw.Application):
|
|||
raise KeyError("variables")
|
||||
if preset.get("palette") is None:
|
||||
raise KeyError("palette")
|
||||
presets_list[file_name.replace(".json", "")] \
|
||||
= preset["name"]
|
||||
presets_list[file_name.replace(".json", "")] = preset[
|
||||
"name"
|
||||
]
|
||||
except Exception:
|
||||
self.win.toast_overlay.add_toast(
|
||||
Adw.Toast(title=_("Failed to load preset"))
|
||||
|
@ -207,8 +205,9 @@ class GradienceApplication(Adw.Application):
|
|||
raise KeyError("variables")
|
||||
if preset.get("palette") is None:
|
||||
raise KeyError("palette")
|
||||
presets_list["user"][file_name.replace(".json", "")] \
|
||||
= preset["name"]
|
||||
presets_list["user"][file_name.replace(".json", "")] = preset[
|
||||
"name"
|
||||
]
|
||||
except Exception:
|
||||
self.win.toast_overlay.add_toast(
|
||||
Adw.Toast(title=_("Failed to load preset"))
|
||||
|
@ -398,59 +397,44 @@ class GradienceApplication(Adw.Application):
|
|||
dark_theme = theme["schemes"]["dark"]
|
||||
variable = {
|
||||
"accent_color": self.rgba_from_argb(dark_theme.primary),
|
||||
"accent_bg_color":
|
||||
self.rgba_from_argb(dark_theme.primaryContainer),
|
||||
"accent_fg_color":
|
||||
self.rgba_from_argb(dark_theme.onPrimaryContainer),
|
||||
"accent_bg_color": self.rgba_from_argb(dark_theme.primaryContainer),
|
||||
"accent_fg_color": self.rgba_from_argb(dark_theme.onPrimaryContainer),
|
||||
"destructive_color": self.rgba_from_argb(dark_theme.error),
|
||||
"destructive_bg_color":
|
||||
self.rgba_from_argb(dark_theme.errorContainer),
|
||||
"destructive_bg_color": self.rgba_from_argb(dark_theme.errorContainer),
|
||||
"destructive_fg_color": self.rgba_from_argb(
|
||||
dark_theme.onErrorContainer
|
||||
),
|
||||
"success_color": self.rgba_from_argb(dark_theme.tertiary),
|
||||
"success_bg_color": self.rgba_from_argb(dark_theme.onTertiary),
|
||||
"success_fg_color":
|
||||
self.rgba_from_argb(dark_theme.onTertiaryContainer),
|
||||
"success_fg_color": self.rgba_from_argb(dark_theme.onTertiaryContainer),
|
||||
"warning_color": self.rgba_from_argb(dark_theme.secondary),
|
||||
"warning_bg_color":
|
||||
self.rgba_from_argb(dark_theme.onSecondary),
|
||||
"warning_fg_color":
|
||||
self.rgba_from_argb(dark_theme.primary, "0.8"),
|
||||
"warning_bg_color": self.rgba_from_argb(dark_theme.onSecondary),
|
||||
"warning_fg_color": self.rgba_from_argb(dark_theme.primary, "0.8"),
|
||||
"error_color": self.rgba_from_argb(dark_theme.error),
|
||||
"error_bg_color":
|
||||
self.rgba_from_argb(dark_theme.errorContainer),
|
||||
"error_bg_color": self.rgba_from_argb(dark_theme.errorContainer),
|
||||
"error_fg_color": self.rgba_from_argb(dark_theme.onError),
|
||||
"window_bg_color": self.rgba_from_argb(dark_theme.surface),
|
||||
"window_fg_color": self.rgba_from_argb(dark_theme.onSurface),
|
||||
"view_bg_color": self.rgba_from_argb(dark_theme.surface),
|
||||
"view_fg_color": self.rgba_from_argb(dark_theme.onSurface),
|
||||
"headerbar_bg_color": self.rgba_from_argb(dark_theme.surface),
|
||||
"headerbar_fg_color":
|
||||
self.rgba_from_argb(dark_theme.onSurface),
|
||||
"headerbar_fg_color": self.rgba_from_argb(dark_theme.onSurface),
|
||||
"headerbar_border_color": self.rgba_from_argb(
|
||||
dark_theme.primary, "0.8"
|
||||
),
|
||||
"headerbar_backdrop_color": "@window_bg_color",
|
||||
"headerbar_shade_color":
|
||||
self.rgba_from_argb(dark_theme.shadow),
|
||||
"card_bg_color":
|
||||
self.rgba_from_argb(dark_theme.primary, "0.05"),
|
||||
"card_fg_color":
|
||||
self.rgba_from_argb(dark_theme.onSecondaryContainer),
|
||||
"headerbar_shade_color": self.rgba_from_argb(dark_theme.shadow),
|
||||
"card_bg_color": self.rgba_from_argb(dark_theme.primary, "0.05"),
|
||||
"card_fg_color": self.rgba_from_argb(dark_theme.onSecondaryContainer),
|
||||
"card_shade_color": self.rgba_from_argb(dark_theme.shadow),
|
||||
"dialog_bg_color":
|
||||
self.rgba_from_argb(dark_theme.secondaryContainer),
|
||||
"dialog_fg_color":
|
||||
self.rgba_from_argb(dark_theme.onSecondaryContainer),
|
||||
"popover_bg_color":
|
||||
self.rgba_from_argb(dark_theme.secondaryContainer),
|
||||
"dialog_bg_color": self.rgba_from_argb(dark_theme.secondaryContainer),
|
||||
"dialog_fg_color": self.rgba_from_argb(dark_theme.onSecondaryContainer),
|
||||
"popover_bg_color": self.rgba_from_argb(dark_theme.secondaryContainer),
|
||||
"popover_fg_color": self.rgba_from_argb(
|
||||
dark_theme.onSecondaryContainer
|
||||
),
|
||||
"shade_color": self.rgba_from_argb(dark_theme.shadow),
|
||||
"scrollbar_outline_color":
|
||||
self.rgba_from_argb(dark_theme.outline),
|
||||
"scrollbar_outline_color": self.rgba_from_argb(dark_theme.outline),
|
||||
}
|
||||
else: # light
|
||||
light_theme = theme["schemes"]["light"]
|
||||
|
@ -459,38 +443,31 @@ class GradienceApplication(Adw.Application):
|
|||
"accent_bg_color": self.rgba_from_argb(light_theme.primary),
|
||||
"accent_fg_color": self.rgba_from_argb(light_theme.onPrimary),
|
||||
"destructive_color": self.rgba_from_argb(light_theme.error),
|
||||
"destructive_bg_color":
|
||||
self.rgba_from_argb(light_theme.errorContainer),
|
||||
"destructive_bg_color": self.rgba_from_argb(light_theme.errorContainer),
|
||||
"destructive_fg_color": self.rgba_from_argb(
|
||||
light_theme.onErrorContainer
|
||||
),
|
||||
"success_color": self.rgba_from_argb(light_theme.tertiary),
|
||||
"success_bg_color":
|
||||
self.rgba_from_argb(light_theme.tertiaryContainer),
|
||||
"success_bg_color": self.rgba_from_argb(light_theme.tertiaryContainer),
|
||||
"success_fg_color": self.rgba_from_argb(
|
||||
light_theme.onTertiaryContainer
|
||||
),
|
||||
"warning_color": self.rgba_from_argb(light_theme.secondary),
|
||||
"warning_bg_color":
|
||||
self.rgba_from_argb(light_theme.secondaryContainer),
|
||||
"warning_bg_color": self.rgba_from_argb(light_theme.secondaryContainer),
|
||||
"warning_fg_color": self.rgba_from_argb(
|
||||
light_theme.onSecondaryContainer
|
||||
),
|
||||
"error_color": self.rgba_from_argb(light_theme.error),
|
||||
"error_bg_color":
|
||||
self.rgba_from_argb(light_theme.errorContainer),
|
||||
"error_bg_color": self.rgba_from_argb(light_theme.errorContainer),
|
||||
"error_fg_color": self.rgba_from_argb(light_theme.onError),
|
||||
"window_bg_color":
|
||||
self.rgba_from_argb(light_theme.secondaryContainer),
|
||||
"window_bg_color": self.rgba_from_argb(light_theme.secondaryContainer),
|
||||
"window_fg_color": self.rgba_from_argb(light_theme.onSurface),
|
||||
"view_bg_color":
|
||||
self.rgba_from_argb(light_theme.secondaryContainer),
|
||||
"view_bg_color": self.rgba_from_argb(light_theme.secondaryContainer),
|
||||
"view_fg_color": self.rgba_from_argb(light_theme.onSurface),
|
||||
"headerbar_bg_color": self.rgba_from_argb(
|
||||
light_theme.secondaryContainer
|
||||
),
|
||||
"headerbar_fg_color":
|
||||
self.rgba_from_argb(light_theme.onSurface),
|
||||
"headerbar_fg_color": self.rgba_from_argb(light_theme.onSurface),
|
||||
"headerbar_border_color": self.rgba_from_argb(
|
||||
light_theme.primary, "0.8"
|
||||
),
|
||||
|
@ -498,24 +475,19 @@ class GradienceApplication(Adw.Application):
|
|||
"headerbar_shade_color": self.rgba_from_argb(
|
||||
light_theme.secondaryContainer
|
||||
),
|
||||
"card_bg_color":
|
||||
self.rgba_from_argb(light_theme.primary, "0.05"),
|
||||
"card_fg_color":
|
||||
self.rgba_from_argb(light_theme.onSecondaryContainer),
|
||||
"card_bg_color": self.rgba_from_argb(light_theme.primary, "0.05"),
|
||||
"card_fg_color": self.rgba_from_argb(light_theme.onSecondaryContainer),
|
||||
"card_shade_color": self.rgba_from_argb(light_theme.shadow),
|
||||
"dialog_bg_color":
|
||||
self.rgba_from_argb(light_theme.secondaryContainer),
|
||||
"dialog_bg_color": self.rgba_from_argb(light_theme.secondaryContainer),
|
||||
"dialog_fg_color": self.rgba_from_argb(
|
||||
light_theme.onSecondaryContainer
|
||||
),
|
||||
"popover_bg_color":
|
||||
self.rgba_from_argb(light_theme.secondaryContainer),
|
||||
"popover_bg_color": self.rgba_from_argb(light_theme.secondaryContainer),
|
||||
"popover_fg_color": self.rgba_from_argb(
|
||||
light_theme.onSecondaryContainer
|
||||
),
|
||||
"shade_color": self.rgba_from_argb(light_theme.shadow),
|
||||
"scrollbar_outline_color":
|
||||
self.rgba_from_argb(light_theme.outline),
|
||||
"scrollbar_outline_color": self.rgba_from_argb(light_theme.outline),
|
||||
}
|
||||
|
||||
for key in variable:
|
||||
|
@ -829,16 +801,12 @@ class GradienceApplication(Adw.Application):
|
|||
pass
|
||||
else:
|
||||
with open(
|
||||
os.path.join(gtk4_dir, "gtk.css.bak"),
|
||||
"w",
|
||||
encoding="utf-8"
|
||||
os.path.join(gtk4_dir, "gtk.css.bak"), "w", encoding="utf-8"
|
||||
) as file:
|
||||
file.write(contents)
|
||||
finally:
|
||||
with open(
|
||||
os.path.join(gtk4_dir, "gtk.css"),
|
||||
"w",
|
||||
encoding="utf-8"
|
||||
os.path.join(gtk4_dir, "gtk.css"), "w", encoding="utf-8"
|
||||
) as file:
|
||||
file.write(gtk4_css)
|
||||
|
||||
|
@ -854,25 +822,19 @@ class GradienceApplication(Adw.Application):
|
|||
contents = ""
|
||||
try:
|
||||
with open(
|
||||
os.path.join(gtk3_dir, "gtk.css"),
|
||||
"r",
|
||||
encoding="utf-8"
|
||||
os.path.join(gtk3_dir, "gtk.css"), "r", encoding="utf-8"
|
||||
) as file:
|
||||
contents = file.read()
|
||||
except FileNotFoundError: # first run
|
||||
pass
|
||||
else:
|
||||
with open(
|
||||
os.path.join(gtk3_dir, "gtk.css.bak"),
|
||||
"w",
|
||||
encoding="utf-8"
|
||||
os.path.join(gtk3_dir, "gtk.css.bak"), "w", encoding="utf-8"
|
||||
) as file:
|
||||
file.write(contents)
|
||||
finally:
|
||||
with open(
|
||||
os.path.join(gtk3_dir, "gtk.css"),
|
||||
"w",
|
||||
encoding="utf-8"
|
||||
os.path.join(gtk3_dir, "gtk.css"), "w", encoding="utf-8"
|
||||
) as file:
|
||||
file.write(gtk3_css)
|
||||
|
||||
|
@ -980,8 +942,8 @@ class GradienceApplication(Adw.Application):
|
|||
artists=["David Lapshin https://github.com/daudix-UFO"],
|
||||
designers=["David Lapshin https://github.com/daudix-UFO"],
|
||||
# Translators: This is a place to put your credits (formats:
|
||||
# "Name https://example.com" or "Name <email@example.com>",
|
||||
# no quotes) and is not meant to be translated literally.
|
||||
# "Name https://example.com" or "Name <email@example.com>",
|
||||
# no quotes) and is not meant to be translated literally.
|
||||
# TODO: Automate this process using CI, because not everyone knows
|
||||
# about this
|
||||
translator_credits="""Maxime V https://www.transifex.com/user/profile/Adaoh/
|
||||
|
|
|
@ -58,13 +58,7 @@ def get_user_flatpak_path():
|
|||
return GLib.build_filenamev([userDataDir, "flatpak"])
|
||||
|
||||
|
||||
def user_save_keyfile(
|
||||
toast_overlay,
|
||||
settings,
|
||||
user_keyfile,
|
||||
filename,
|
||||
gtk_ver
|
||||
):
|
||||
def user_save_keyfile(toast_overlay, settings, user_keyfile, filename, gtk_ver):
|
||||
try:
|
||||
user_keyfile.save_to_file(filename)
|
||||
except GLib.GError as e:
|
||||
|
@ -83,13 +77,7 @@ def user_save_keyfile(
|
|||
)
|
||||
|
||||
|
||||
def global_save_keyfile(
|
||||
toast_overlay,
|
||||
settings,
|
||||
global_keyfile,
|
||||
filename,
|
||||
gtk_ver
|
||||
):
|
||||
def global_save_keyfile(toast_overlay, settings, global_keyfile, filename, gtk_ver):
|
||||
try:
|
||||
global_keyfile.save_to_file(filename)
|
||||
except GLib.GError as e:
|
||||
|
|
|
@ -22,14 +22,7 @@ class Preset:
|
|||
name = "new_preset"
|
||||
badges = {}
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
name=None,
|
||||
repo=None,
|
||||
preset_path=None,
|
||||
text=None,
|
||||
preset=None
|
||||
):
|
||||
def __init__(self, name=None, repo=None, preset_path=None, text=None, preset=None):
|
||||
if text: # load from ressource
|
||||
self.load_preset(text=text)
|
||||
elif preset: # css or dict
|
||||
|
|
|
@ -34,13 +34,7 @@ class GradienceOption(Adw.ActionRow):
|
|||
explanation_button = Gtk.Template.Child("explanation-button")
|
||||
explanation_label = Gtk.Template.Child("explanation-label")
|
||||
|
||||
def __init__(self,
|
||||
name,
|
||||
title,
|
||||
explanation,
|
||||
adw_gtk3_support="yes",
|
||||
**kwargs
|
||||
):
|
||||
def __init__(self, name, title, explanation, adw_gtk3_support="yes", **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
self.set_name(name)
|
||||
|
@ -52,8 +46,10 @@ class GradienceOption(Adw.ActionRow):
|
|||
elif adw_gtk3_support == "partial":
|
||||
self.warning_button.add_css_class("warning")
|
||||
self.warning_label.set_label(
|
||||
_("This option is only partially supported by the adw-gtk3 \
|
||||
theme.")
|
||||
_(
|
||||
"This option is only partially supported by the adw-gtk3 \
|
||||
theme."
|
||||
)
|
||||
)
|
||||
elif adw_gtk3_support == "no":
|
||||
self.warning_button.add_css_class("error")
|
||||
|
|
|
@ -59,8 +59,9 @@ class GradiencePaletteShades(Adw.ActionRow):
|
|||
Gtk.Application.get_default().is_ready
|
||||
and kwargs.get("update_from") == "color_value"
|
||||
):
|
||||
Gtk.Application.get_default().palette[self.prefix][str(i)] = \
|
||||
shades[str(i)]
|
||||
Gtk.Application.get_default().palette[self.prefix][str(i)] = shades[
|
||||
str(i)
|
||||
]
|
||||
|
||||
if (
|
||||
Gtk.Application.get_default().is_ready
|
||||
|
|
|
@ -46,7 +46,9 @@ class GradiencePluginRow(Adw.ActionRow):
|
|||
self.plugins_list = plugins_list
|
||||
|
||||
self.plugin_object = plugin_object
|
||||
if not os.path.exists(USER_PLUGIN_DIR / f"{self.plugin_object.plugin_id}.yapsy-plugin"):
|
||||
if not os.path.exists(
|
||||
USER_PLUGIN_DIR / f"{self.plugin_object.plugin_id}.yapsy-plugin"
|
||||
):
|
||||
self.remove_button.set_visible(False)
|
||||
|
||||
self.set_name(plugin_object.plugin_id)
|
||||
|
@ -73,11 +75,9 @@ class GradiencePluginRow(Adw.ActionRow):
|
|||
os.remove(plugin_yapsy_file)
|
||||
except FileNotFoundError:
|
||||
error_dialog = Adw.MessageDialog(
|
||||
#transient_for=self.props.active_window,
|
||||
# transient_for=self.props.active_window,
|
||||
heading=_("Unable to remove"),
|
||||
body=_(
|
||||
"This is a system plugin, and cannot be removed. "
|
||||
)
|
||||
body=_("This is a system plugin, and cannot be removed. "),
|
||||
)
|
||||
error_dialog.add_response("close", _("Close"))
|
||||
error_dialog.present()
|
||||
|
|
|
@ -34,6 +34,7 @@ SYSTEM_PLUGIN_DIR = os.path.join(
|
|||
"plugins",
|
||||
)
|
||||
|
||||
|
||||
class GradiencePluginsList:
|
||||
"""Represent the plugin group in Advanced"""
|
||||
|
||||
|
@ -113,8 +114,7 @@ class GradiencePluginsList:
|
|||
def save(self):
|
||||
saved = {}
|
||||
for pluginInfo in self.pm.getAllPlugins():
|
||||
saved[pluginInfo.plugin_object.plugin_id] = \
|
||||
pluginInfo.plugin_object.save()
|
||||
saved[pluginInfo.plugin_object.plugin_id] = pluginInfo.plugin_object.save()
|
||||
return saved
|
||||
|
||||
def validate(self):
|
||||
|
|
|
@ -118,9 +118,7 @@ class GradiencePresetRow(Adw.ExpanderRow):
|
|||
self.delete_toast.set_button_label(_("Undo"))
|
||||
self.delete_toast.connect("dismissed", self.on_delete_toast_dismissed)
|
||||
self.delete_toast.connect(
|
||||
"button-clicked",
|
||||
self.on_undo_button_clicked
|
||||
)
|
||||
"button-clicked", self.on_undo_button_clicked)
|
||||
|
||||
self.toast_overlay.add_toast(self.delete_toast)
|
||||
|
||||
|
@ -211,5 +209,3 @@ class GradiencePresetRow(Adw.ExpanderRow):
|
|||
self.win.reload_pref_group()
|
||||
|
||||
self.delete_preset = True
|
||||
|
||||
|
||||
|
|
|
@ -62,10 +62,12 @@ class GradiencePresetWindow(Adw.Window):
|
|||
custom_presets = {}
|
||||
|
||||
official_repositories = {
|
||||
_("Official"):
|
||||
"https://github.com/GradienceTeam/Community/raw/next/official.json",
|
||||
_("Curated"):
|
||||
"https://github.com/GradienceTeam/Community/raw/next/curated.json"
|
||||
_(
|
||||
"Official"
|
||||
): "https://github.com/GradienceTeam/Community/raw/next/official.json",
|
||||
_(
|
||||
"Curated"
|
||||
): "https://github.com/GradienceTeam/Community/raw/next/curated.json",
|
||||
}
|
||||
|
||||
search_results_list = []
|
||||
|
@ -291,8 +293,12 @@ class GradiencePresetWindow(Adw.Window):
|
|||
Adw.Toast(title=_("Preset imported")))
|
||||
else:
|
||||
self.toast_overlay.add_toast(
|
||||
Adw.Toast(title=_("Unsupported file format, must be \
|
||||
.json"))
|
||||
Adw.Toast(
|
||||
title=_(
|
||||
"Unsupported file format, must be \
|
||||
.json"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
self.reload_pref_group()
|
||||
|
@ -330,8 +336,9 @@ class GradiencePresetWindow(Adw.Window):
|
|||
raise KeyError("variables")
|
||||
if preset.get("palette") is None:
|
||||
raise KeyError("palette")
|
||||
presets_list[file_name.replace(".json", "")] = \
|
||||
preset["name"]
|
||||
presets_list[file_name.replace(".json", "")] = preset[
|
||||
"name"
|
||||
]
|
||||
except Exception:
|
||||
self.toast_overlay.add_toast(
|
||||
Adw.Toast(title=_("Failed to load preset"))
|
||||
|
@ -356,8 +363,9 @@ class GradiencePresetWindow(Adw.Window):
|
|||
raise KeyError("variables")
|
||||
if preset.get("palette") is None:
|
||||
raise KeyError("palette")
|
||||
presets_list["user"][file_name.replace(".json", "")] \
|
||||
= preset["name"]
|
||||
presets_list["user"][file_name.replace(".json", "")] = preset[
|
||||
"name"
|
||||
]
|
||||
except Exception:
|
||||
self.toast_overlay.add_toast(
|
||||
Adw.Toast(title=_("Failed to load preset"))
|
||||
|
|
|
@ -18,13 +18,7 @@
|
|||
|
||||
|
||||
class GradienceSetting:
|
||||
def __init__(self,
|
||||
name,
|
||||
title,
|
||||
value_type,
|
||||
explanation=None,
|
||||
default_value=None
|
||||
):
|
||||
def __init__(self, name, title, value_type, explanation=None, default_value=None):
|
||||
# TODO supported types:
|
||||
# text
|
||||
# integer
|
||||
|
|
|
@ -275,8 +275,10 @@ settings_schema = {
|
|||
{
|
||||
"name": "card_colors",
|
||||
"title": _("Card Colors"),
|
||||
"description": _("These colors are used for cards and boxed \
|
||||
lists."),
|
||||
"description": _(
|
||||
"These colors are used for cards and boxed \
|
||||
lists."
|
||||
),
|
||||
"variables": [
|
||||
{
|
||||
"name": "card_bg_color",
|
||||
|
|
|
@ -56,13 +56,13 @@ class GradienceWelcomeWindow(Adw.Window):
|
|||
]
|
||||
|
||||
carousel_pages = [
|
||||
"welcome", # 0
|
||||
"release", # 1
|
||||
"agreement", # 2
|
||||
"gradience", # 3
|
||||
"configure", # 4
|
||||
"download", # 5
|
||||
"finish", # 6
|
||||
"welcome", # 0
|
||||
"release", # 1
|
||||
"agreement", # 2
|
||||
"gradience", # 3
|
||||
"configure", # 4
|
||||
"download", # 5
|
||||
"finish", # 6
|
||||
]
|
||||
|
||||
page_welcome = Gtk.Template.Child()
|
||||
|
@ -142,15 +142,15 @@ class GradienceWelcomeWindow(Adw.Window):
|
|||
self.btn_next.set_visible(True)
|
||||
self.btn_install.set_visible(False)
|
||||
if self.update:
|
||||
self.window.last_opened_version = \
|
||||
self.window.settings.set_string("last-opened-version", version)
|
||||
self.window.last_opened_version = self.window.settings.set_string(
|
||||
"last-opened-version", version
|
||||
)
|
||||
self.btn_close.set_sensitive(True)
|
||||
self.label_skip.set_visible(False)
|
||||
self.next_page(index=5)
|
||||
else:
|
||||
self.next_page()
|
||||
|
||||
|
||||
@staticmethod
|
||||
def quit(widget=False):
|
||||
sys.exit()
|
||||
|
|
Loading…
Reference in a new issue