mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-08-23 07:52:32 +00:00
Format code with black and autopep8
This commit fixes the style issues introduced in 7cf729d
according to the output
from black and autopep8.
Details: https://deepsource.io/gh/GradienceTeam/Gradience/transform/ca6ade89-7037-4252-b2a6-c3adad8825d7/
This commit is contained in:
parent
7cf729dfef
commit
1c882452fc
3 changed files with 14 additions and 15 deletions
|
@ -52,7 +52,6 @@ PRESET_DIR = os.path.join(
|
|||
)
|
||||
|
||||
|
||||
|
||||
class GradienceApplication(Adw.Application):
|
||||
"""The main application singleton class."""
|
||||
|
||||
|
@ -145,7 +144,6 @@ class GradienceApplication(Adw.Application):
|
|||
if self.props.active_window.presets_menu.get_n_items() > 1:
|
||||
self.props.active_window.presets_menu.remove(1)
|
||||
|
||||
|
||||
if not os.path.exists(PRESET_DIR):
|
||||
os.makedirs(PRESET_DIR)
|
||||
|
||||
|
@ -301,6 +299,7 @@ class GradienceApplication(Adw.Application):
|
|||
preset_path, 0).get_data().decode()
|
||||
self.preset = Preset(text=preset_text)
|
||||
self.load_preset_variables_from_preset()
|
||||
|
||||
def load_preset_variables_from_preset(self, preset=None):
|
||||
if preset is not None:
|
||||
self.preset = preset
|
||||
|
|
|
@ -20,9 +20,9 @@ class Preset:
|
|||
plugins = {}
|
||||
|
||||
def __init__(self, name=None, repo=None, preset_path=None, text=None, preset=None):
|
||||
if text: # load from ressource
|
||||
if text: # load from ressource
|
||||
self.load_preset(text=text)
|
||||
elif preset: # css or dict
|
||||
elif preset: # css or dict
|
||||
self.load_preset(preset=preset)
|
||||
else:
|
||||
self.preset_name = name
|
||||
|
@ -35,7 +35,8 @@ class Preset:
|
|||
else:
|
||||
self.repo = repo
|
||||
if preset_path is None:
|
||||
self.preset_path = os.path.join(PRESET_DIR, repo, self.name + ".json")
|
||||
self.preset_path = os.path.join(
|
||||
PRESET_DIR, repo, self.name + ".json")
|
||||
else:
|
||||
self.preset_path = preset_path
|
||||
self.load_preset()
|
||||
|
@ -49,13 +50,10 @@ class Preset:
|
|||
if text:
|
||||
preset_text = text
|
||||
else:
|
||||
with open(
|
||||
self.preset_path, "r", encoding="utf-8"
|
||||
) as file:
|
||||
with open(self.preset_path, "r", encoding="utf-8") as file:
|
||||
preset_text = file.read()
|
||||
preset = json.loads(preset_text)
|
||||
|
||||
|
||||
self.name = preset["name"]
|
||||
self.preset_name = to_slug_case(self.name)
|
||||
self.variables = preset["variables"]
|
||||
|
@ -71,10 +69,10 @@ class Preset:
|
|||
|
||||
def save_preset(self, name=None, plugins_list=None, to=None):
|
||||
if not os.path.exists(
|
||||
os.path.join(
|
||||
PRESET_DIR,
|
||||
"user",
|
||||
)
|
||||
os.path.join(
|
||||
PRESET_DIR,
|
||||
"user",
|
||||
)
|
||||
):
|
||||
os.makedirs(
|
||||
os.path.join(
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from .utils import buglog, to_slug_case
|
||||
from .preset import Preset
|
||||
import os
|
||||
|
||||
PRESET_DIR = os.path.join(
|
||||
|
@ -5,10 +7,10 @@ PRESET_DIR = os.path.join(
|
|||
"presets",
|
||||
)
|
||||
|
||||
from .preset import Preset
|
||||
from .utils import buglog, to_slug_case
|
||||
|
||||
class Repo:
|
||||
presets = {}
|
||||
|
||||
def __init__(self, name):
|
||||
self.name = to_slug_case(name)
|
||||
self.path = os.path.join(PRESET_DIR, name)
|
||||
|
|
Loading…
Reference in a new issue