Format code with black and autopep8

This commit fixes the style issues introduced in 358cd41 according to the output
from black and autopep8.

Details: https://deepsource.io/gh/GradienceTeam/Gradience/transform/936b0b83-12eb-4103-a3f4-3f142542db0a/
This commit is contained in:
deepsource-autofix[bot] 2022-09-25 21:11:04 +00:00 committed by GitHub
parent 358cd41f9f
commit d5501996a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,9 +84,8 @@ class FirefoxGnomeThemePlugin(IPlugin):
custom_settings = {"overwrite": True} custom_settings = {"overwrite": True}
css = BASE css = BASE
browser_row = Adw.EntryRow( browser_row = Adw.EntryRow(
title="Path to the profile directory", title="Path to the profile directory",
)
)
profile_dir = None profile_dir = None
def activate(self): def activate(self):
@ -118,7 +117,7 @@ class FirefoxGnomeThemePlugin(IPlugin):
self.apply_pref = Adw.PreferencesGroup() self.apply_pref = Adw.PreferencesGroup()
self.apply_pref.set_title("Apply") self.apply_pref.set_title("Apply")
self.apply_pref.set_description("Preferences for applying the theme") self.apply_pref.set_description("Preferences for applying the theme")
self.overwrite_row = Adw.ActionRow( self.overwrite_row = Adw.ActionRow(
title="Overwrite", title="Overwrite",
subtitle="Overwrite the existing userChrome.css file", subtitle="Overwrite the existing userChrome.css file",
@ -131,27 +130,27 @@ class FirefoxGnomeThemePlugin(IPlugin):
self.overwrite_row.connect("activate", self.on_overwrite) self.overwrite_row.connect("activate", self.on_overwrite)
self.apply_pref.add(self.overwrite_row) self.apply_pref.add(self.overwrite_row)
self.main_page.add(self.apply_pref) self.main_page.add(self.apply_pref)
# Browser # Browser
self.browser_pref = Adw.PreferencesGroup() self.browser_pref = Adw.PreferencesGroup()
self.browser_pref.set_title("Browser") 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( self.browser_row = Adw.EntryRow(
title="Path to the directory where profiles are stored", title="Path to the directory where profiles are stored",
) )
self.browser_row.set_text("~/.mozilla/firefox") self.browser_row.set_text("~/.mozilla/firefox")
self.browser_row.set_show_apply_button(True) self.browser_row.set_show_apply_button(True)
self.browser_row.connect("apply", self.on_apply) self.browser_row.connect("apply", self.on_apply)
self.browser_pref.add(self.browser_row) self.browser_pref.add(self.browser_row)
self.main_page.add(self.browser_pref) self.main_page.add(self.browser_pref)
self.window.add(self.main_page) self.window.add(self.main_page)
self.window.present() self.window.present()
def on_apply(self, widget): def on_apply(self, widget):
self.profile_dir = Path(self.browser_row.get_text()).expanduser() self.profile_dir = Path(self.browser_row.get_text()).expanduser()
print(self.profile_dir) print(self.profile_dir)
@ -160,13 +159,11 @@ class FirefoxGnomeThemePlugin(IPlugin):
self.profile_dir = None self.profile_dir = None
else: else:
self.browser_row.remove_css_class("error") self.browser_row.remove_css_class("error")
def on_overwrite(self, widget, _): def on_overwrite(self, widget, _):
# This is called when the user changes the overwrite setting # This is called when the user changes the overwrite setting
self.custom_settings["overwrite"] = not self.custom_settings["overwrite"] self.custom_settings["overwrite"] = not self.custom_settings["overwrite"]
def validate(self): def validate(self):
# Normally, it would be a good idea to validate the settings here # 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 # But because there is only one setting and it can onbly be a boolean
@ -177,7 +174,7 @@ class FirefoxGnomeThemePlugin(IPlugin):
def apply(self, dark_theme=False): def apply(self, dark_theme=False):
# This is called when the user clicks on the apply button (the one in the headerbar) # This is called when the user clicks on the apply button (the one in the headerbar)
# You can use dark_theme to know if the user wants a dark theme or not # You can use dark_theme to know if the user wants a dark theme or not
print("Applying Firefox Gnome Theme") print("Applying Firefox Gnome Theme")
print(self.custom_settings["overwrite"]) print(self.custom_settings["overwrite"])
if self.profile_dir: if self.profile_dir:
@ -201,23 +198,40 @@ class FirefoxGnomeThemePlugin(IPlugin):
print("No profiles found") print("No profiles found")
return return
else: 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"], self.css = self.css.format(
l_1=self.palette["light_"]["1"], l_2=self.palette["light_"][ d_1=self.palette["dark_"]["1"],
"2"], l_3=self.palette["light_"]["3"], l_4=self.palette["light_"]["4"], d_2=self.palette["dark_"]["2"],
bg=self.variables["window_bg_color"], fg=self.variables["window_fg_color"], d_3=self.palette["dark_"]["3"],
d_4=self.palette["dark_"]["4"],
red=self.palette["red_"]["5"], grn=self.palette["green_"][ l_1=self.palette["light_"]["1"],
"5"], ylw=self.palette["yellow_"]["5"], blu=self.palette["blue_"]["5"], l_2=self.palette["light_"]["2"],
pnk=self.palette["purple_"]["5"], cyn=self.palette["blue_"][ l_3=self.palette["light_"]["3"],
"5"], wht=self.palette["light_"]["5"], blk=self.palette["dark_"]["5"], l_4=self.palette["light_"]["4"],
bg=self.variables["window_bg_color"],
b_red=self.palette["red_"]["1"], b_grn=self.palette["green_"][ fg=self.variables["window_fg_color"],
"1"], b_ylw=self.palette["yellow_"]["1"], b_blu=self.palette["blue_"]["1"], red=self.palette["red_"]["5"],
b_pnk=self.palette["purple_"]["1"], b_cyn=self.palette["blue_"]["1"], b_wht=self.palette["light_"]["1"], b_blk=self.palette["dark_"]["1"]) 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"],
)
print(self.css) print(self.css)
for profile in profiles: for profile in profiles:
print(profile) print(profile)
profile = profile / "chrome" / "firefox-gnome-theme" / "customChrome.css" profile = (
profile / "chrome" / "firefox-gnome-theme" / "customChrome.css"
)
if profile.exists(): if profile.exists():
if self.custom_settings["overwrite"]: if self.custom_settings["overwrite"]:
with open(profile, "w", encoding="utf-8") as f: with open(profile, "w", encoding="utf-8") as f: