A bunch of improvements (#250)

This commit is contained in:
0xMRTT 2022-08-24 10:56:35 +02:00 committed by GitHub
commit 33603cb1b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 172 additions and 81 deletions

View file

@ -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

View file

@ -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"

View file

@ -13,9 +13,9 @@ python = import('python')
# Project information # Project information
PROJECT_URL = 'https://github.com/GradienceTeam/Gradience' PROJECT_URL = 'https://github.com/GradienceTeam/Gradience'
BUGTRACKER_URL = 'https://github.com/tfuxu/themeteor/issues' BUGTRACKER_URL = 'https://github.com/GradienceTeam/Gradience/issues'
HELP_URL = 'https://github.com/orgs/GradienceTeam/discussions' HELP_URL = 'https://github.com/orgs/GradienceTeam/discussions'
TRANSLATE_URL = 'https://www.transifex.com/Gradienceteam/Gradience' TRANSLATE_URL = 'https://hosted.weblate.org/projects/GradienceTeam/gradience/'
# Constants # Constants
PROJECT_RDNN_NAME = 'com.github.GradienceTeam.Gradience' PROJECT_RDNN_NAME = 'com.github.GradienceTeam.Gradience'

View file

@ -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
# #
@ -12,11 +14,4 @@
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# 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("-")

View file

@ -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/"

View file

@ -19,9 +19,10 @@
rootdir = '/com/github/GradienceTeam/Gradience' rootdir = '/com/github/GradienceTeam/Gradience'
app_id = '@APP_ID@' app_id = '@APP_ID@'
rel_ver = '@RELEASE_VER@'
version = '@VERSION@' version = '@VERSION@'
build_type = '@BUILD_TYPE@' build_type = '@BUILD_TYPE@'
project_url = '@PROJECT_URL@' project_url = '@PROJECT_URL@'
bugtracker_url = '@BUGTRACKER_URL@' bugtracker_url = '@BUGTRACKER_URL@'
help_url = '@HELP_URL@' help_url = '@HELP_URL@'
trnaslate_url = '@TRANSLATE_URL@' translate_url = '@TRANSLATE_URL@'

View file

@ -19,7 +19,6 @@
import sys import sys
import json import json
import os import os
import re
import traceback import traceback
import gi import gi
@ -32,10 +31,10 @@ from .palette_shades import GradiencePaletteShades
from .option import GradienceOption from .option import GradienceOption
from .app_type_dialog import GradienceAppTypeDialog from .app_type_dialog import GradienceAppTypeDialog
from .custom_css_group import GradienceCustomCSSGroup from .custom_css_group import GradienceCustomCSSGroup
from .constants import rootdir, app_id, version, bugtracker_url, help_url, project_url from .constants import rootdir, app_id, rel_ver, version, bugtracker_url, help_url, project_url
from .welcome import GradienceWelcomeWindow from .welcome import GradienceWelcomeWindow
from .presets_manager_window import GradiencePresetWindow from .presets_manager_window import GradiencePresetWindow
from . import to_slug_case from .modules.utils import to_slug_case, buglog
class GradienceApplication(Adw.Application): class GradienceApplication(Adw.Application):
@ -73,7 +72,7 @@ class GradienceApplication(Adw.Application):
self.settings.get_value("disabled-plugins")) self.settings.get_value("disabled-plugins"))
self.first_run = self.settings.get_boolean("first-run") self.first_run = self.settings.get_boolean("first-run")
print(f"disabled plugins: {self.disabled_plugins}") buglog(f"disabled plugins: {self.disabled_plugins}")
self.style_manager = Adw.StyleManager.get_default() self.style_manager = Adw.StyleManager.get_default()
@ -127,11 +126,11 @@ class GradienceApplication(Adw.Application):
) )
if self.first_run: if self.first_run:
print("first run") buglog("first run")
welcome = GradienceWelcomeWindow(self.win) welcome = GradienceWelcomeWindow(self.win)
welcome.present() welcome.present()
else: else:
print("normal run") buglog("normal run")
self.win.present() self.win.present()
def open_preset_directory(self, *_args): def open_preset_directory(self, *_args):
@ -156,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()
@ -631,19 +630,22 @@ class GradienceApplication(Adw.Application):
# Translators: This is a place to put your credits (formats: "Name # Translators: This is a place to put your credits (formats: "Name
# https://example.com" or "Name <email@example.com>", no quotes) # https://example.com" or "Name <email@example.com>", no quotes)
# and is not meant to be translated literally. # and is not meant to be translated literally.
# TODO: Automate this process using CI, because not everyone knows about this
translator_credits="""Maxime V https://www.transifex.com/user/profile/Adaoh/ translator_credits="""Maxime V https://www.transifex.com/user/profile/Adaoh/
FineFindus https://github.com/FineFindus FineFindus https://github.com/FineFindus
Karol Lademan https://www.transifex.com/user/profile/karlod/ Karol Lademan https://www.transifex.com/user/profile/karlod/
Monty Monteusz https://www.transifex.com/user/profile/MontyQIQI/ Monty Monteusz https://www.transifex.com/user/profile/MontyQIQI/
Renato Corrêa https://www.transifex.com/user/profile/renatocrrs/ Renato Corrêa https://www.transifex.com/user/profile/renatocrrs/
Aggelos Tselios https://www.transifex.com/user/profile/AndroGR/ Aggelos Tselios https://www.transifex.com/user/profile/AndroGR/
David "Daudix UFO" Lapshin https://github.com/daudix-UFO' David "Daudix UFO" Lapshin https://github.com/daudix-UFO
0xMRTT https://github.com/0xMRTT 0xMRTT https://github.com/0xMRTT
tfuxu https://github.com/tfuxu
Juanjo Cillero https://www.transifex.com/user/profile/renux918/ Juanjo Cillero https://www.transifex.com/user/profile/renux918/
Taylan Tatlı https://www.transifex.com/user/profile/TaylanTatli34/""", Taylan Tatlı https://www.transifex.com/user/profile/TaylanTatli34/""",
copyright="© 2022 Gradience Team", copyright="© 2022 Gradience Team",
license_type=Gtk.License.GPL_3_0, license_type=Gtk.License.GPL_3_0,
version=version, version=version,
release_notes_version=rel_ver,
release_notes=_(""" release_notes=_("""
<ul> <ul>
<li>Add AdwViewSwitcher in the header bar.</li> <li>Add AdwViewSwitcher in the header bar.</li>
@ -708,7 +710,7 @@ This app is written in Python and uses GTK 4 and libadwaita.
self.set_accels_for_action(f"app.{name}", shortcuts) self.set_accels_for_action(f"app.{name}", shortcuts)
def reload_plugins(self): def reload_plugins(self):
print("reload plugins") buglog("reload plugins")
self.win.plugins_group = self.win.plugins_list.to_group() self.win.plugins_group = self.win.plugins_list.to_group()
def show_adwaita_demo(self, *_args): def show_adwaita_demo(self, *_args):

View file

@ -37,7 +37,16 @@ configure_file(
configure_file( configure_file(
input: 'constants.py.in', input: 'constants.py.in',
output: 'constants.py', output: 'constants.py',
configuration: conf, configuration: configuration_data({
'APP_ID': APPLICATION_ID,
'RELEASE_VER': meson.project_version(),
'VERSION': meson.project_version() + VERSION_SUFFIX,
'BUILD_TYPE': get_option('buildtype'),
'PROJECT_URL': PROJECT_URL,
'BUGTRACKER_URL': BUGTRACKER_URL,
'HELP_URL': HELP_URL,
'TRANSLATE_URL': TRANSLATE_URL
}),
install: true, install: true,
install_dir: PY_INSTALLDIR.get_install_dir() / 'gradience', install_dir: PY_INSTALLDIR.get_install_dir() / 'gradience',
) )
@ -71,4 +80,12 @@ gradience_sources = [
] ]
PY_INSTALLDIR.install_sources(gradience_sources, subdir: 'gradience') PY_INSTALLDIR.install_sources(gradience_sources, subdir: 'gradience')
#install_data(gradience_sources, install_dir: MODULE_DIR) #install_data(gradience_sources, install_dir: MODULE_DIR)
# Install modules
gradience_modules = [
'modules/__init__.py',
'modules/utils.py'
]
PY_INSTALLDIR.install_sources(gradience_modules, subdir: 'gradience/modules')

17
src/modules/__init__.py Normal file
View file

@ -0,0 +1,17 @@
# __init__.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/>.

35
src/modules/utils.py Normal file
View file

@ -0,0 +1,35 @@
# utils.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/>.
import re
from anyascii import anyascii
from gradience.constants import build_type
def to_slug_case(non_slug):
return re.sub(r"[^0-9a-z]+", "-", anyascii(non_slug).lower()).strip("-")
# Use it instead of print(), so there isn't any output in stdout if Gradience was build in release mode
# TODO: Can be replaced with `logging` module [https://docs.python.org/3/library/logging.html] in future
def buglog(*args):
if build_type == "debug":
message = ""
for obj in args:
message += str(obj)
return print(f"[DEBUG]: {message}")

View file

@ -1,6 +1,24 @@
# 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
from .modules.utils import buglog
from .constants import rootdir from .constants import rootdir
@ -21,14 +39,14 @@ class GradiencePluginRow(Adw.ActionRow):
@Gtk.Template.Callback() @Gtk.Template.Callback()
def on_settings_plugin_clicked(self, *_args): def on_settings_plugin_clicked(self, *_args):
print("settings") buglog("settings")
@Gtk.Template.Callback() @Gtk.Template.Callback()
def on_remove_plugin_clicked(self, *_args): def on_remove_plugin_clicked(self, *_args):
print("removed") buglog("removed")
@Gtk.Template.Callback() @Gtk.Template.Callback()
def on_switch_toggled(self, *_args): def on_switch_toggled(self, *_args):
print("toggled") buglog("toggled")
Gtk.Application.get_default().reload_plugins() Gtk.Application.get_default().reload_plugins()

View file

@ -16,14 +16,16 @@
# 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 sys
import os import os
from pathlib import Path
import importlib import importlib
import pkgutil import pkgutil
from .plugin_row import GradiencePluginRow
from gi.repository import Gtk, Adw, Gio, Gdk from gi.repository import Gtk, Adw, Gio, Gdk
import sys from pathlib import Path
from .modules.utils import buglog
from .plugin_row import GradiencePluginRow
class GradiencePluginsList: class GradiencePluginsList:
@ -41,7 +43,7 @@ class GradiencePluginsList:
for plugin_id, plugin in self.discoverd_plugins.items(): for plugin_id, plugin in self.discoverd_plugins.items():
self.plugins[plugin_id] = plugin.GradiencePlugin() self.plugins[plugin_id] = plugin.GradiencePlugin()
print(self.plugins) buglog(self.plugins)
def load_all_custom_settings(self, settings): def load_all_custom_settings(self, settings):
for plugin_id, plugin in self.plugins.items(): for plugin_id, plugin in self.plugins.items():

View file

@ -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",

View file

@ -24,6 +24,8 @@ import traceback
from gi.repository import GLib from gi.repository import GLib
from .modules.utils import buglog
class RunAsync(threading.Thread): class RunAsync(threading.Thread):
def __init__(self, task_func, callback=None, *args, **kwargs): def __init__(self, task_func, callback=None, *args, **kwargs):
@ -44,12 +46,12 @@ class RunAsync(threading.Thread):
result = None result = None
error = None error = None
print(f"Running async job [{self.task_func}].") buglog(f"Running async job [{self.task_func}].")
try: try:
result = self.task_func(*args, **kwargs) result = self.task_func(*args, **kwargs)
except Exception as exception: except Exception as exception:
print("Error while running async job: " buglog("Error while running async job: "
f"{self.task_func}\nException: {exception}") f"{self.task_func}\nException: {exception}")
error = exception error = exception
@ -57,6 +59,6 @@ class RunAsync(threading.Thread):
traceback.print_tb(trace) traceback.print_tb(trace)
traceback_info = '\n'.join(traceback.format_tb(trace)) traceback_info = '\n'.join(traceback.format_tb(trace))
print([str(exception), traceback_info]) buglog([str(exception), traceback_info])
self.source_id = GLib.idle_add(self.callback, result, error) self.source_id = GLib.idle_add(self.callback, result, error)
return self.source_id return self.source_id

View file

@ -16,10 +16,13 @@
# 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/>.
from gi.repository import Gtk, Adw, Gio, Gdk
from .constants import rootdir
import time import time
from gi.repository import Gtk, Adw, Gio, Gdk
from .run_async import RunAsync from .run_async import RunAsync
from .modules.utils import buglog
from .constants import rootdir
@Gtk.Template(resource_path=f"{rootdir}/ui/welcome.ui") @Gtk.Template(resource_path=f"{rootdir}/ui/welcome.ui")
@ -115,15 +118,15 @@ class GradienceWelcomeWindow(Adw.Window):
quit() quit()
def check_adw_gtk3(self): def check_adw_gtk3(self):
print("check if adw-gtk3 installed") buglog("check if adw-gtk3 installed")
return True return True
def adw_gtk3(self): def adw_gtk3(self):
if not self.check_adw_gtk3(): # install if not self.check_adw_gtk3(): # install
print("install adw-gtk3") buglog("install adw-gtk3")
def configure_system(self): def configure_system(self):
print("confiure system") buglog("configure system")
def install_runner(self, widget): def install_runner(self, widget):
def set_completed(result, error=False): def set_completed(result, error=False):

View file

@ -1,45 +1,40 @@
# 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.
# #
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # You should have received a copy of the GNU General Public License
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # along with this program. If not, see <https://www.gnu.org/licenses/>.
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, import os
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name(s) of the above copyright
# holders shall not be used in advertising or otherwise to promote the sale,
# use or other dealings in this Software without prior written
# authorization.
from gi.repository import Gtk, Adw, Gio, Gdk from gi.repository import Gtk, Adw, Gio, Gdk
from svglib.svglib import svg2rlg
from reportlab.graphics import renderPM
from material_color_utilities_python import *
from .error import GradienceError from .error import GradienceError
from .settings_schema import settings_schema from .settings_schema import settings_schema
from .palette_shades import GradiencePaletteShades from .palette_shades import GradiencePaletteShades
from .option import GradienceOption from .option import GradienceOption
from .app_type_dialog import GradienceAppTypeDialog from .app_type_dialog import GradienceAppTypeDialog
from .custom_css_group import GradienceCustomCSSGroup from .custom_css_group import GradienceCustomCSSGroup
from material_color_utilities_python import *
from .constants import rootdir, app_id, build_type
from .presets_manager_window import GradiencePresetWindow from .presets_manager_window import GradiencePresetWindow
from .plugins_list import GradiencePluginsList from .plugins_list import GradiencePluginsList
from svglib.svglib import svg2rlg from .modules.utils import buglog
from reportlab.graphics import renderPM from .constants import rootdir, app_id, build_type
import os
@Gtk.Template(resource_path=f"{rootdir}/ui/window.ui") @Gtk.Template(resource_path=f"{rootdir}/ui/window.ui")
@ -98,32 +93,38 @@ 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()
def __close_window(self, widegt): def __close_window(self, widegt):
if self.get_application().is_dirty: if self.get_application().is_dirty:
print("app is dirty") buglog("app is dirty")
def on_monet_file_chooser_response(self, widget, response): def on_monet_file_chooser_response(self, widget, response):
if response == Gtk.ResponseType.ACCEPT: if response == Gtk.ResponseType.ACCEPT:
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:
@ -217,7 +218,7 @@ class GradienceMainWindow(Adw.ApplicationWindow):
renderPM.drawToFile(drawing, self.monet_image_file, fmt='PNG') renderPM.drawToFile(drawing, self.monet_image_file, fmt='PNG')
if self.monet_image_file.endswith(".xml"): if self.monet_image_file.endswith(".xml"):
print("XML WIP") buglog("XML WIP")
try: try:
self.monet_img = Image.open(self.monet_image_file) self.monet_img = Image.open(self.monet_image_file)