mirror of
https://github.com/GradienceTeam/Gradience.git
synced 2024-07-01 00:49:56 +00:00
fix: comment out self.on_apply_button() in get_default_wallpaper func to get rid of error toast on startup when build in Flatpak
* set tooltip text in monet_file_chooser_button * update copyright in window.py and add one in plugin_row.py * update local.sh and fix 'user' rule in Makefile * replace all remaining print() to buglog(), and redirect to to_slug_case in utils.py
This commit is contained in:
parent
e9ad48f100
commit
df0a5ac009
7
Makefile
7
Makefile
|
@ -7,7 +7,6 @@ global:
|
||||||
sudo ninja -C builddir install
|
sudo ninja -C builddir install
|
||||||
|
|
||||||
user:
|
user:
|
||||||
meson builddiruser
|
meson builddir --prefix="$(shell pwd)/builddir/testdir" --wipe
|
||||||
meson configure builddiruser -Dprefix="$(pwd)/builddiruser/testdir"
|
ninja -C builddir install
|
||||||
ninja -C builddiruser install
|
ninja -C builddir run
|
||||||
ninja -C builddiruser run
|
|
3
local.sh
3
local.sh
|
@ -21,7 +21,6 @@ read -p "Do you want to install Python requirements? (yes, no): " answer
|
||||||
|
|
||||||
if [[ "$answer" == "yes" ]]; then
|
if [[ "$answer" == "yes" ]]; then
|
||||||
pip3 install --user -r requirements.txt
|
pip3 install --user -r requirements.txt
|
||||||
pip3 install $(pwd)/monet/material_color_utilities_python-0.1.0-py3-none-any.whl
|
|
||||||
elif [[ "$answer" == "no" ]]; then
|
elif [[ "$answer" == "no" ]]; then
|
||||||
echo "Skipping requirements installation"
|
echo "Skipping requirements installation"
|
||||||
fi
|
fi
|
||||||
|
@ -31,7 +30,7 @@ rm -r builddir
|
||||||
|
|
||||||
echo "Rebuilding"
|
echo "Rebuilding"
|
||||||
meson builddir
|
meson builddir
|
||||||
meson configure builddir -Dprefix="$(pwd)/builddir/testdir"
|
meson configure builddir -Dprefix="$(pwd)/builddir/testdir" -Dbuildtype=debug
|
||||||
ninja -C builddir install
|
ninja -C builddir install
|
||||||
|
|
||||||
echo "Running"
|
echo "Running"
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# __init__.py
|
||||||
|
#
|
||||||
# Change the look of Adwaita, with ease
|
# Change the look of Adwaita, with ease
|
||||||
# Copyright (C) 2022 Gradience Team
|
# Copyright (C) 2022 Gradience Team
|
||||||
#
|
#
|
||||||
|
@ -13,10 +15,3 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import re
|
|
||||||
from anyascii import anyascii
|
|
||||||
|
|
||||||
|
|
||||||
def to_slug_case(non_slug):
|
|
||||||
return re.sub(r"[^0-9a-z]+", "-", anyascii(non_slug).lower()).strip("-")
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from gi.repository import Gtk, Gdk, Adw
|
from gi.repository import Gtk, Gdk, Adw
|
||||||
|
|
||||||
from .constants import rootdir
|
from .constants import rootdir
|
||||||
from . import to_slug_case
|
from .modules.utils import to_slug_case, buglog
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ class GradienceBuiltinPresetRow(Adw.ActionRow):
|
||||||
|
|
||||||
@Gtk.Template.Callback()
|
@Gtk.Template.Callback()
|
||||||
def on_apply_button_clicked(self, *_args):
|
def on_apply_button_clicked(self, *_args):
|
||||||
print("apply")
|
buglog("apply")
|
||||||
|
|
||||||
self.app.load_preset_from_resource(
|
self.app.load_preset_from_resource(
|
||||||
f"{rootdir}/presets/"
|
f"{rootdir}/presets/"
|
||||||
|
|
|
@ -155,7 +155,7 @@ class GradienceApplication(Adw.Application):
|
||||||
)
|
)
|
||||||
|
|
||||||
def load_preset_from_file(self, preset_path):
|
def load_preset_from_file(self, preset_path):
|
||||||
print("load preset from file", preset_path)
|
buglog("load preset from file", preset_path)
|
||||||
preset_text = ""
|
preset_text = ""
|
||||||
with open(preset_path, "r", encoding="utf-8") as file:
|
with open(preset_path, "r", encoding="utf-8") as file:
|
||||||
preset_text = file.read()
|
preset_text = file.read()
|
||||||
|
|
|
@ -1,3 +1,20 @@
|
||||||
|
# plugin_row.py
|
||||||
|
#
|
||||||
|
# Change the look of Adwaita, with ease
|
||||||
|
# Copyright (C) 2022 Gradience Team
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from gi.repository import Gtk, Gdk, Adw
|
from gi.repository import Gtk, Gdk, Adw
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from gi.repository import Gtk, Gdk, Adw
|
from gi.repository import Gtk, Gdk, Adw
|
||||||
|
|
||||||
from .constants import rootdir
|
from .constants import rootdir
|
||||||
from . import to_slug_case
|
from .modules.utils import to_slug_case
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ class GradiencePresetRow(Adw.ActionRow):
|
||||||
|
|
||||||
@Gtk.Template.Callback()
|
@Gtk.Template.Callback()
|
||||||
def on_apply_button_clicked(self, *_args):
|
def on_apply_button_clicked(self, *_args):
|
||||||
print("apply")
|
buglog("apply")
|
||||||
|
|
||||||
self.app.load_preset_from_file(os.path.join(
|
self.app.load_preset_from_file(os.path.join(
|
||||||
os.environ.get("XDG_CONFIG_HOME",
|
os.environ.get("XDG_CONFIG_HOME",
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
# window.py
|
# window.py
|
||||||
#
|
#
|
||||||
# Copyright 2022 Gradience Team
|
# Change the look of Adwaita, with ease
|
||||||
|
# Copyright (C) 2022 Gradience Team
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# a copy of this software and associated documentation files (the
|
# it under the terms of the GNU General Public License as published by
|
||||||
# "Software"), to deal in the Software without restriction, including
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
# without limitation the rights to use, copy, modify, merge, publish,
|
# (at your option) any later version.
|
||||||
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
# permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
# the following conditions:
|
|
||||||
#
|
#
|
||||||
# The above copyright notice and this permission notice shall be
|
# This program is distributed in the hope that it will be useful,
|
||||||
# included in all copies or substantial portions of the Software.
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -90,19 +93,24 @@ class GradienceMainWindow(Adw.ApplicationWindow):
|
||||||
|
|
||||||
self.get_default_wallpaper()
|
self.get_default_wallpaper()
|
||||||
|
|
||||||
|
# FIXME: This function works only when build using meson, because Flatpak can't access host's dconf with current config/impl
|
||||||
def get_default_wallpaper(self):
|
def get_default_wallpaper(self):
|
||||||
background_settings = Gio.Settings("org.gnome.desktop.background")
|
background_settings = Gio.Settings("org.gnome.desktop.background")
|
||||||
if self.style_manager.get_dark():
|
if self.style_manager.get_dark():
|
||||||
self.monet_image_file = background_settings.get_string(
|
picture_uri = background_settings.get_string(
|
||||||
"picture-uri-dark")
|
"picture-uri-dark")
|
||||||
else:
|
else:
|
||||||
self.monet_image_file = background_settings.get_string(
|
picture_uri = background_settings.get_string(
|
||||||
"picture-uri-dark")
|
"picture-uri")
|
||||||
self.monet_image_file = Gio.File.new_for_uri(self.monet_image_file)
|
buglog(picture_uri)
|
||||||
|
self.monet_image_file = Gio.File.new_for_uri(picture_uri)
|
||||||
image_basename = self.monet_image_file.get_basename()
|
image_basename = self.monet_image_file.get_basename()
|
||||||
|
buglog(image_basename)
|
||||||
self.monet_file_chooser_button.set_label(image_basename)
|
self.monet_file_chooser_button.set_label(image_basename)
|
||||||
self.monet_image_file = self.monet_image_file.get_path()
|
self.monet_image_file = self.monet_image_file.get_path()
|
||||||
self.on_apply_button()
|
self.monet_file_chooser_button.set_tooltip_text(self.monet_image_file)
|
||||||
|
buglog(self.monet_image_file)
|
||||||
|
#self.on_apply_button() # Comment out for now, because it always shows that annoying toast on startup
|
||||||
|
|
||||||
def on_file_picker_button_clicked(self, *args):
|
def on_file_picker_button_clicked(self, *args):
|
||||||
self.monet_file_chooser_dialog.show()
|
self.monet_file_chooser_dialog.show()
|
||||||
|
@ -116,6 +124,7 @@ class GradienceMainWindow(Adw.ApplicationWindow):
|
||||||
self.monet_image_file = self.monet_file_chooser_dialog.get_file()
|
self.monet_image_file = self.monet_file_chooser_dialog.get_file()
|
||||||
image_basename = self.monet_image_file.get_basename()
|
image_basename = self.monet_image_file.get_basename()
|
||||||
self.monet_file_chooser_button.set_label(image_basename)
|
self.monet_file_chooser_button.set_label(image_basename)
|
||||||
|
self.monet_file_chooser_button.set_tooltip_text(self.monet_image_file)
|
||||||
self.monet_file_chooser_dialog.hide()
|
self.monet_file_chooser_dialog.hide()
|
||||||
|
|
||||||
if response == Gtk.ResponseType.ACCEPT:
|
if response == Gtk.ResponseType.ACCEPT:
|
||||||
|
|
Loading…
Reference in a new issue