mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-10-01 07:47:53 +00:00
Moving some window-specific code to window file
This commit is contained in:
parent
c9377d8d4b
commit
8cc3e47f38
2 changed files with 41 additions and 36 deletions
35
src/main.py
35
src/main.py
|
@ -86,41 +86,6 @@ class AdwcustomizerApplication(Adw.Application):
|
|||
if not win:
|
||||
win = AdwcustomizerMainWindow(application=self)
|
||||
|
||||
for group in settings_schema["groups"]:
|
||||
pref_group = Adw.PreferencesGroup()
|
||||
pref_group.set_name(group["name"])
|
||||
pref_group.set_title(group["title"])
|
||||
pref_group.set_description(group["description"])
|
||||
|
||||
for variable in group["variables"]:
|
||||
pref_variable = AdwcustomizerOption(variable["name"],
|
||||
variable["title"],
|
||||
variable["adw_gtk3_support"],
|
||||
variable.get("explanation"))
|
||||
pref_group.add(pref_variable)
|
||||
self.pref_variables[variable["name"]] = pref_variable
|
||||
|
||||
win.content.add(pref_group)
|
||||
|
||||
palette_pref_group = Adw.PreferencesGroup()
|
||||
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>."))
|
||||
for color in settings_schema["palette"]:
|
||||
palette_shades = AdwcustomizerPaletteShades(color["prefix"],
|
||||
color["title"],
|
||||
color["n_shades"])
|
||||
palette_pref_group.add(palette_shades)
|
||||
self.pref_palette_shades[color["prefix"]] = palette_shades
|
||||
win.content.add(palette_pref_group)
|
||||
|
||||
self.custom_css_group = AdwcustomizerCustomCSSGroup()
|
||||
for app_type in settings_schema["custom_css_app_types"]:
|
||||
self.custom_css[app_type] = ""
|
||||
self.custom_css_group.load_custom_css(self.custom_css)
|
||||
win.content.add(self.custom_css_group)
|
||||
|
||||
|
||||
self.create_action("open_preset_directory", self.open_preset_directory)
|
||||
self.create_stateful_action("load_preset", GLib.VariantType.new('s'), GLib.Variant('s', 'adwaita'), self.load_preset_action)
|
||||
self.create_action("apply_color_scheme", self.show_apply_color_scheme_dialog)
|
||||
|
|
|
@ -26,8 +26,13 @@
|
|||
# use or other dealings in this Software without prior written
|
||||
# authorization.
|
||||
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk, Adw
|
||||
from .error import AdwcustomizerError
|
||||
from .settings_schema import settings_schema
|
||||
from .palette_shades import AdwcustomizerPaletteShades
|
||||
from .option import AdwcustomizerOption
|
||||
from .app_type_dialog import AdwcustomizerAppTypeDialog
|
||||
from .custom_css_group import AdwcustomizerCustomCSSGroup
|
||||
|
||||
@Gtk.Template(resource_path='/com/github/ArtyIF/AdwCustomizer/ui/window.ui')
|
||||
class AdwcustomizerMainWindow(Gtk.ApplicationWindow):
|
||||
|
@ -44,6 +49,41 @@ class AdwcustomizerMainWindow(Gtk.ApplicationWindow):
|
|||
super().__init__(**kwargs)
|
||||
self.presets_dropdown.get_popover().connect("show", self.on_presets_dropdown_activate)
|
||||
|
||||
for group in settings_schema["groups"]:
|
||||
pref_group = Adw.PreferencesGroup()
|
||||
pref_group.set_name(group["name"])
|
||||
pref_group.set_title(group["title"])
|
||||
pref_group.set_description(group["description"])
|
||||
|
||||
for variable in group["variables"]:
|
||||
pref_variable = AdwcustomizerOption(variable["name"],
|
||||
variable["title"],
|
||||
variable["adw_gtk3_support"],
|
||||
variable.get("explanation"))
|
||||
pref_group.add(pref_variable)
|
||||
self.get_application().pref_variables[variable["name"]] = pref_variable
|
||||
|
||||
self.content.add(pref_group)
|
||||
|
||||
palette_pref_group = Adw.PreferencesGroup()
|
||||
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>."))
|
||||
for color in settings_schema["palette"]:
|
||||
palette_shades = AdwcustomizerPaletteShades(color["prefix"],
|
||||
color["title"],
|
||||
color["n_shades"])
|
||||
palette_pref_group.add(palette_shades)
|
||||
self.get_application().pref_palette_shades[color["prefix"]] = palette_shades
|
||||
self.content.add(palette_pref_group)
|
||||
|
||||
custom_css_group = AdwcustomizerCustomCSSGroup()
|
||||
for app_type in settings_schema["custom_css_app_types"]:
|
||||
self.get_application().custom_css[app_type] = ""
|
||||
custom_css_group.load_custom_css(self.get_application().custom_css)
|
||||
self.content.add(custom_css_group)
|
||||
self.get_application().custom_css_group = custom_css_group
|
||||
|
||||
def update_errors(self, errors):
|
||||
child = self.errors_list.get_row_at_index(0)
|
||||
while child is not None:
|
||||
|
|
Loading…
Reference in a new issue