Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit df0a5ac

Browse files
committed
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
1 parent e9ad48f commit df0a5ac

8 files changed

+53
-34
lines changed

Makefile

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ global:
77
sudo ninja -C builddir install
88

99
user:
10-
meson builddiruser
11-
meson configure builddiruser -Dprefix="$(pwd)/builddiruser/testdir"
12-
ninja -C builddiruser install
13-
ninja -C builddiruser run
10+
meson builddir --prefix="$(shell pwd)/builddir/testdir" --wipe
11+
ninja -C builddir install
12+
ninja -C builddir run

local.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ read -p "Do you want to install Python requirements? (yes, no): " answer
2121

2222
if [[ "$answer" == "yes" ]]; then
2323
pip3 install --user -r requirements.txt
24-
pip3 install $(pwd)/monet/material_color_utilities_python-0.1.0-py3-none-any.whl
2524
elif [[ "$answer" == "no" ]]; then
2625
echo "Skipping requirements installation"
2726
fi
@@ -31,7 +30,7 @@ rm -r builddir
3130

3231
echo "Rebuilding"
3332
meson builddir
34-
meson configure builddir -Dprefix="$(pwd)/builddir/testdir"
33+
meson configure builddir -Dprefix="$(pwd)/builddir/testdir" -Dbuildtype=debug
3534
ninja -C builddir install
3635

3736
echo "Running"

src/__init__.py

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# __init__.py
2+
#
13
# Change the look of Adwaita, with ease
24
# Copyright (C) 2022 Gradience Team
35
#
@@ -12,11 +14,4 @@
1214
# GNU General Public License for more details.
1315
#
1416
# You should have received a copy of the GNU General Public License
15-
# along with this program. If not, see <https://www.gnu.org/licenses/>.
16-
17-
import re
18-
from anyascii import anyascii
19-
20-
21-
def to_slug_case(non_slug):
22-
return re.sub(r"[^0-9a-z]+", "-", anyascii(non_slug).lower()).strip("-")
17+
# along with this program. If not, see <https://www.gnu.org/licenses/>.

src/builtin_preset_row.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from gi.repository import Gtk, Gdk, Adw
22

33
from .constants import rootdir
4-
from . import to_slug_case
4+
from .modules.utils import to_slug_case, buglog
55
import json
66
import os
77

@@ -29,7 +29,7 @@ def __init__(self, name, toast_overlay, author="", **kwargs):
2929

3030
@Gtk.Template.Callback()
3131
def on_apply_button_clicked(self, *_args):
32-
print("apply")
32+
buglog("apply")
3333

3434
self.app.load_preset_from_resource(
3535
f"{rootdir}/presets/"

src/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def open_dir_callback(_, result):
155155
)
156156

157157
def load_preset_from_file(self, preset_path):
158-
print("load preset from file", preset_path)
158+
buglog("load preset from file", preset_path)
159159
preset_text = ""
160160
with open(preset_path, "r", encoding="utf-8") as file:
161161
preset_text = file.read()

src/plugin_row.py

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# plugin_row.py
2+
#
3+
# Change the look of Adwaita, with ease
4+
# Copyright (C) 2022 Gradience Team
5+
#
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
118

219
from gi.repository import Gtk, Gdk, Adw
320

src/preset_row.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from gi.repository import Gtk, Gdk, Adw
22

33
from .constants import rootdir
4-
from . import to_slug_case
4+
from .modules.utils import to_slug_case
55
import json
66
import os
77

@@ -36,7 +36,7 @@ def __init__(self, name, win, author="", **kwargs):
3636

3737
@Gtk.Template.Callback()
3838
def on_apply_button_clicked(self, *_args):
39-
print("apply")
39+
buglog("apply")
4040

4141
self.app.load_preset_from_file(os.path.join(
4242
os.environ.get("XDG_CONFIG_HOME",

src/window.py

+24-15
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
# window.py
22
#
3-
# Copyright 2022 Gradience Team
3+
# Change the look of Adwaita, with ease
4+
# Copyright (C) 2022 Gradience Team
45
#
5-
# Permission is hereby granted, free of charge, to any person obtaining
6-
# a copy of this software and associated documentation files (the
7-
# "Software"), to deal in the Software without restriction, including
8-
# without limitation the rights to use, copy, modify, merge, publish,
9-
# distribute, sublicense, and/or sell copies of the Software, and to
10-
# permit persons to whom the Software is furnished to do so, subject to
11-
# the following conditions:
6+
# This program is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
1210
#
13-
# The above copyright notice and this permission notice shall be
14-
# included in all copies or substantial portions of the Software.
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
1515
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
18+
1619

1720
import os
1821

@@ -90,19 +93,24 @@ def __init__(self, **kwargs):
9093

9194
self.get_default_wallpaper()
9295

96+
# FIXME: This function works only when build using meson, because Flatpak can't access host's dconf with current config/impl
9397
def get_default_wallpaper(self):
9498
background_settings = Gio.Settings("org.gnome.desktop.background")
9599
if self.style_manager.get_dark():
96-
self.monet_image_file = background_settings.get_string(
100+
picture_uri = background_settings.get_string(
97101
"picture-uri-dark")
98102
else:
99-
self.monet_image_file = background_settings.get_string(
100-
"picture-uri-dark")
101-
self.monet_image_file = Gio.File.new_for_uri(self.monet_image_file)
103+
picture_uri = background_settings.get_string(
104+
"picture-uri")
105+
buglog(picture_uri)
106+
self.monet_image_file = Gio.File.new_for_uri(picture_uri)
102107
image_basename = self.monet_image_file.get_basename()
108+
buglog(image_basename)
103109
self.monet_file_chooser_button.set_label(image_basename)
104110
self.monet_image_file = self.monet_image_file.get_path()
105-
self.on_apply_button()
111+
self.monet_file_chooser_button.set_tooltip_text(self.monet_image_file)
112+
buglog(self.monet_image_file)
113+
#self.on_apply_button() # Comment out for now, because it always shows that annoying toast on startup
106114

107115
def on_file_picker_button_clicked(self, *args):
108116
self.monet_file_chooser_dialog.show()
@@ -116,6 +124,7 @@ def on_monet_file_chooser_response(self, widget, response):
116124
self.monet_image_file = self.monet_file_chooser_dialog.get_file()
117125
image_basename = self.monet_image_file.get_basename()
118126
self.monet_file_chooser_button.set_label(image_basename)
127+
self.monet_file_chooser_button.set_tooltip_text(self.monet_image_file)
119128
self.monet_file_chooser_dialog.hide()
120129

121130
if response == Gtk.ResponseType.ACCEPT:

0 commit comments

Comments
 (0)