Removed all palette references for now

Will implement the palettes later.

Also refactored the code a bit
This commit is contained in:
ArtyIF 2022-07-18 11:10:00 +03:00
parent 054da9af7e
commit 67c61a9e04
6 changed files with 12 additions and 172 deletions

View file

@ -1,5 +1,5 @@
project('adwcustomizer',
version: '0.0.9',
version: '0.0.10',
meson_version: '>= 0.59.0',
default_options: [ 'warning_level=2',
'werror=false',

View file

@ -70,7 +70,7 @@ class AdwcustomizerApplication(Adw.Application):
pref_group.set_description(group["description"])
for variable in group["variables"]:
pref_variable = AdwcustomizerOption(variable["name"], variable["title"], variable.get("explanation"), "#00000000")
pref_variable = AdwcustomizerOption(variable["name"], variable["title"], variable.get("explanation"))
pref_group.add(pref_variable)
self.pref_variables[variable["name"]] = pref_variable
@ -95,12 +95,7 @@ class AdwcustomizerApplication(Adw.Application):
self.props.active_window.set_current_preset_name(preset["name"])
self.variables = preset["variables"]
for key in self.variables.keys():
if key in self.pref_variables:
self.pref_variables[key].update_value(self.variables[key])
self.reload_variables()
self.load_preset_variables()
def load_preset_from_resource(self, preset_path):
preset_text = Gio.resources_lookup_data(preset_path, 0).get_data().decode()
@ -108,7 +103,9 @@ class AdwcustomizerApplication(Adw.Application):
self.props.active_window.set_current_preset_name(preset["name"])
self.variables = preset["variables"]
self.load_preset_variables()
def load_preset_variables(self):
for key in self.variables.keys():
if key in self.pref_variables:
self.pref_variables[key].update_value(self.variables[key])
@ -128,8 +125,8 @@ class AdwcustomizerApplication(Adw.Application):
Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER + 1)
def load_preset_action(self, widget, *args):
if args[0].get_string().startswith("custom_"):
self.load_preset_from_file(os.environ['XDG_CONFIG_HOME'] + "/adwcustomizer/presets/" + args[0].get_string().replace("custom_", "") + ".json")
if args[0].get_string().startswith("custom-"):
self.load_preset_from_file(os.environ['XDG_CONFIG_HOME'] + "/adwcustomizer/presets/" + args[0].get_string().replace("custom-", "") + ".json")
else:
self.load_preset_from_resource('/com/github/ArtyIF/AdwCustomizer/presets/' + args[0].get_string() + '.json')
Gio.SimpleAction.set_state(self.lookup_action("load_preset"), args[0])
@ -187,7 +184,7 @@ class AdwcustomizerApplication(Adw.Application):
application_name='AdwCustomizer',
application_icon='com.github.ArtyIF.AdwCustomizer',
developer_name='ArtyIF',
version='0.0.9',
version='0.0.10',
developers=['ArtyIF'],
copyright='© 2022 ArtyIF')

View file

@ -1,4 +1,4 @@
# window.py
# option.py
#
# Copyright 2022 ArtyIF
#
@ -40,7 +40,7 @@ class AdwcustomizerOption(Adw.ActionRow):
explanation_button = Gtk.Template.Child("explanation-button")
explanation_label = Gtk.Template.Child("explanation-label")
def __init__(self, name, title, explanation, value, **kwargs):
def __init__(self, name, title, explanation, **kwargs):
super().__init__(**kwargs)
self.set_name(name)
@ -49,8 +49,6 @@ class AdwcustomizerOption(Adw.ActionRow):
if (explanation is None):
self.explanation_button.set_visible(False)
self.update_value(value)
@Gtk.Template.Callback()
def on_color_value_changed(self, *args):
self.update_value(self.color_value.get_rgba().to_string(), update_from="color_value")

View file

@ -45,63 +45,5 @@
"shade_color": "#383838",
"scrollbar_outline_color": "rgba(0, 0, 0, 0.5)"
},
"palette": [
[
"#99c1f1",
"#62a0ea",
"#3584e4",
"#1c71d8",
"#1a5fb4"
],
[
"#8ff0a4",
"#57e389",
"#33d17a",
"#2ec27e",
"#26a269"
],
[
"#f9f06b",
"#f8e45c",
"#f6d32d",
"#f5c211",
"#e5a50a"
],
[
"#f66151",
"#ed333b",
"#e01b24",
"#c01c28",
"#a51d2d"
],
[
"#dc8add",
"#c061cb",
"#9141ac",
"#813d9c",
"#613583"
],
[
"#cdab8f",
"#b5835a",
"#986a44",
"#865e3c",
"#63452c"
],
[
"#ffffff",
"#f6f5f4",
"#deddda",
"#c0bfbc",
"#9a9996"
],
[
"#77767b",
"#5e5c64",
"#3d3846",
"#241f31",
"#000000"
]
]
}
}

View file

@ -45,63 +45,5 @@
"shade_color": "#ffffff",
"scrollbar_outline_color": "#ffffff"
},
"palette": [
[
"#99c1f1",
"#62a0ea",
"#3584e4",
"#1c71d8",
"#1a5fb4"
],
[
"#8ff0a4",
"#57e389",
"#33d17a",
"#2ec27e",
"#26a269"
],
[
"#f9f06b",
"#f8e45c",
"#f6d32d",
"#f5c211",
"#e5a50a"
],
[
"#f66151",
"#ed333b",
"#e01b24",
"#c01c28",
"#a51d2d"
],
[
"#dc8add",
"#c061cb",
"#9141ac",
"#813d9c",
"#613583"
],
[
"#cdab8f",
"#b5835a",
"#986a44",
"#865e3c",
"#63452c"
],
[
"#ffffff",
"#f6f5f4",
"#deddda",
"#c0bfbc",
"#9a9996"
],
[
"#77767b",
"#5e5c64",
"#3d3846",
"#241f31",
"#000000"
]
]
}
}

View file

@ -260,44 +260,5 @@
}
]
}
],
"palette_shades_amount": 5,
"palette": [
{
"prefix": "blue_",
"title": "Blue"
},
{
"prefix": "green_",
"title": "Green"
},
{
"prefix": "yellow_",
"title": "Yellow"
},
{
"prefix": "orange_",
"title": "Orange"
},
{
"prefix": "red_",
"title": "Red"
},
{
"prefix": "purple_",
"title": "Purple"
},
{
"prefix": "brown_",
"title": "Brown"
},
{
"prefix": "light_",
"title": "Light"
},
{
"prefix": "dark_",
"title": "Dark"
}
]
}