mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-08-29 18:32:32 +00:00
ci: autopep8 action fixes
This commit is contained in:
parent
40b74723e9
commit
61961112fb
8 changed files with 62 additions and 57 deletions
14
src/main.py
14
src/main.py
|
@ -329,9 +329,8 @@ class GradienceApplication(Adw.Application):
|
|||
)
|
||||
self.props.active_window.save_preset_button.add_css_class("warning")
|
||||
|
||||
self.props.active_window.save_preset_button.get_child().set_tooltip_text(
|
||||
_("Unsaved changes")
|
||||
)
|
||||
self.props.active_window.save_preset_button.get_child(
|
||||
).set_tooltip_text(_("Unsaved changes"))
|
||||
|
||||
def clear_dirty(self):
|
||||
self.is_dirty = False
|
||||
|
@ -340,9 +339,8 @@ class GradienceApplication(Adw.Application):
|
|||
)
|
||||
self.props.active_window.save_preset_button.remove_css_class("warning")
|
||||
self.props.active_window.save_preset_button.get_child().set_label("")
|
||||
self.props.active_window.save_preset_button.get_child().set_tooltip_text(
|
||||
_("Save changes")
|
||||
)
|
||||
self.props.active_window.save_preset_button.get_child(
|
||||
).set_tooltip_text(_("Save changes"))
|
||||
|
||||
def reload_variables(self):
|
||||
parsing_errors = []
|
||||
|
@ -400,9 +398,7 @@ class GradienceApplication(Adw.Application):
|
|||
def show_apply_color_scheme_dialog(self, *_args):
|
||||
dialog = GradienceAppTypeDialog(
|
||||
_("Apply this color scheme?"),
|
||||
_(
|
||||
"Warning: any custom CSS files for those app types will be irreversibly overwritten!"
|
||||
),
|
||||
_("Warning: any custom CSS files for those app types will be irreversibly overwritten!"),
|
||||
"apply",
|
||||
_("Apply"),
|
||||
Adw.ResponseAppearance.SUGGESTED,
|
||||
|
|
|
@ -58,7 +58,12 @@ 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:
|
||||
|
@ -77,7 +82,12 @@ def user_save_keyfile(toast_overlay, settings, user_keyfile, filename, gtk_ver):
|
|||
)
|
||||
|
||||
|
||||
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:
|
||||
|
|
|
@ -34,7 +34,13 @@ 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)
|
||||
|
@ -46,8 +52,7 @@ 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")
|
||||
self.warning_label.set_label(
|
||||
|
|
|
@ -59,9 +59,8 @@ 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
|
||||
|
|
|
@ -64,10 +64,7 @@ class GradiencePluginsList:
|
|||
group = Adw.PreferencesGroup()
|
||||
group.set_title(_("Plugins"))
|
||||
group.set_description(
|
||||
_(
|
||||
"Plugins add additional features to Gradience, plugins are made by Gradience community and can make issues."
|
||||
)
|
||||
)
|
||||
_("Plugins add additional features to Gradience, plugins are made by Gradience community and can make issues."))
|
||||
if self.pm:
|
||||
for pluginInfo in self.pm.getAllPlugins():
|
||||
row = GradiencePluginRow(pluginInfo.plugin_object)
|
||||
|
|
|
@ -56,8 +56,7 @@ class GradiencePresetWindow(Adw.Window):
|
|||
custom_presets = {}
|
||||
|
||||
official_repositories = {
|
||||
"Official": "https://github.com/GradienceTeam/Community/raw/main/presets.json"
|
||||
}
|
||||
"Official": "https://github.com/GradienceTeam/Community/raw/main/presets.json"}
|
||||
|
||||
search_results_list = []
|
||||
|
||||
|
@ -253,9 +252,8 @@ class GradiencePresetWindow(Adw.Window):
|
|||
self.toast_overlay.add_toast(
|
||||
Adw.Toast(title=_("Preset imported")))
|
||||
else:
|
||||
self.toast_overlay.add_toast(
|
||||
Adw.Toast(title=_("Unsupported file format, must be .json"))
|
||||
)
|
||||
self.toast_overlay.add_toast(Adw.Toast(
|
||||
title=_("Unsupported file format, must be .json")))
|
||||
|
||||
self.reload_pref_group()
|
||||
|
||||
|
@ -291,9 +289,8 @@ 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"))
|
||||
|
@ -318,9 +315,8 @@ 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"))
|
||||
|
@ -339,10 +335,7 @@ class GradiencePresetWindow(Adw.Window):
|
|||
self.preset_list = Adw.PreferencesGroup()
|
||||
self.preset_list.set_title(_("User Presets"))
|
||||
self.preset_list.set_description(
|
||||
_(
|
||||
'See <a href="https://github.com/GradienceTeam/Community">GradienceTeam/Community</a> on Github for more presets'
|
||||
)
|
||||
)
|
||||
_('See <a href="https://github.com/GradienceTeam/Community">GradienceTeam/Community</a> on Github for more presets'))
|
||||
|
||||
if self.custom_presets:
|
||||
for repo, presets in self.custom_presets.items():
|
||||
|
@ -353,9 +346,6 @@ class GradiencePresetWindow(Adw.Window):
|
|||
else:
|
||||
self.preset_empty = Adw.ActionRow()
|
||||
self.preset_empty.set_title(
|
||||
_(
|
||||
"No preset found! Use the import button to import one or search one on the Explore tab"
|
||||
)
|
||||
)
|
||||
_("No preset found! Use the import button to import one or search one on the Explore tab"))
|
||||
self.preset_list.add(self.preset_empty)
|
||||
self.installed.add(self.preset_list)
|
||||
|
|
|
@ -18,7 +18,13 @@
|
|||
|
||||
|
||||
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
|
||||
|
|
|
@ -64,19 +64,27 @@ class GradienceMainWindow(Adw.ApplicationWindow):
|
|||
self.settings = Gio.Settings(app_id)
|
||||
|
||||
self.settings.bind(
|
||||
"window-width", self, "default-width", Gio.SettingsBindFlags.DEFAULT
|
||||
)
|
||||
"window-width",
|
||||
self,
|
||||
"default-width",
|
||||
Gio.SettingsBindFlags.DEFAULT)
|
||||
|
||||
self.settings.bind(
|
||||
"window-height", self, "default-height", Gio.SettingsBindFlags.DEFAULT
|
||||
)
|
||||
"window-height",
|
||||
self,
|
||||
"default-height",
|
||||
Gio.SettingsBindFlags.DEFAULT)
|
||||
self.settings.bind(
|
||||
"window-maximized", self, "maximized", Gio.SettingsBindFlags.DEFAULT
|
||||
)
|
||||
"window-maximized",
|
||||
self,
|
||||
"maximized",
|
||||
Gio.SettingsBindFlags.DEFAULT)
|
||||
|
||||
self.settings.bind(
|
||||
"window-fullscreen", self, "fullscreened", Gio.SettingsBindFlags.DEFAULT
|
||||
)
|
||||
"window-fullscreen",
|
||||
self,
|
||||
"fullscreened",
|
||||
Gio.SettingsBindFlags.DEFAULT)
|
||||
|
||||
self.connect("close-request", self.__close_window)
|
||||
self.style_manager = self.get_application().style_manager
|
||||
|
@ -131,10 +139,7 @@ class GradienceMainWindow(Adw.ApplicationWindow):
|
|||
self.monet_pref_group.set_name("monet")
|
||||
self.monet_pref_group.set_title(_("Monet Engine"))
|
||||
self.monet_pref_group.set_description(
|
||||
_(
|
||||
"Monet is an engine that generates a Material Design 3 palette from an image's color."
|
||||
)
|
||||
)
|
||||
_("Monet is an engine that generates a Material Design 3 palette from an image's color."))
|
||||
|
||||
self.apply_button = Gtk.Button()
|
||||
self.apply_button.set_label(_("Apply"))
|
||||
|
@ -269,10 +274,7 @@ class GradienceMainWindow(Adw.ApplicationWindow):
|
|||
palette_pref_group.set_name("palette_colors")
|
||||
palette_pref_group.set_title(_("Palette Colors"))
|
||||
palette_pref_group.set_description(
|
||||
_(
|
||||
'Named palette colors used by some applications. Default colors follow the <a href="https://developer.gnome.org/hig/reference/palette.html">GNOME Human Interface Guidelines</a>.'
|
||||
)
|
||||
)
|
||||
_('Named palette colors used by some applications. Default colors follow the <a href="https://developer.gnome.org/hig/reference/palette.html">GNOME Human Interface Guidelines</a>.'))
|
||||
for color in settings_schema["palette"]:
|
||||
palette_shades = GradiencePaletteShades(
|
||||
color["prefix"], color["title"], color["n_shades"]
|
||||
|
|
Loading…
Reference in a new issue