From f007edf705e55f72be35b47543cf44a7fc5af1dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Deparis?= Date: Fri, 7 Jan 2022 19:47:59 +0100 Subject: [PATCH 1/7] chore: Bump version --- chwall/__init__.py | 2 +- locale/es/LC_MESSAGES/chwall.po | 4 ++-- locale/fr/LC_MESSAGES/chwall.po | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/chwall/__init__.py b/chwall/__init__.py index 1cc82e6..fc0a843 100644 --- a/chwall/__init__.py +++ b/chwall/__init__.py @@ -1 +1 @@ -__version__ = "0.5.7" +__version__ = "0.5.8" diff --git a/locale/es/LC_MESSAGES/chwall.po b/locale/es/LC_MESSAGES/chwall.po index b4b17fd..98aed1f 100644 --- a/locale/es/LC_MESSAGES/chwall.po +++ b/locale/es/LC_MESSAGES/chwall.po @@ -1,11 +1,11 @@ # Chwall Translation Effort -# Copyright (C) 2021 Chwall volunteers +# Copyright (C) 2022 Chwall volunteers # This file is distributed under the same license as the Chwall package. # FIRST AUTHOR , YEAR. # msgid "" msgstr "" -"Project-Id-Version: Chwall 0.5.7\n" +"Project-Id-Version: Chwall 0.5.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-07-16 14:13+0200\n" "PO-Revision-Date: 2020-05-02 12:28+0000\n" diff --git a/locale/fr/LC_MESSAGES/chwall.po b/locale/fr/LC_MESSAGES/chwall.po index 16507a3..4c3ecbf 100644 --- a/locale/fr/LC_MESSAGES/chwall.po +++ b/locale/fr/LC_MESSAGES/chwall.po @@ -1,11 +1,11 @@ # Chwall Translation Effort -# Copyright (C) 2021 Chwall volunteers +# Copyright (C) 2022 Chwall volunteers # This file is distributed under the same license as the Chwall package. # Automatically generated, 2019. # msgid "" msgstr "" -"Project-Id-Version: Chwall 0.5.7\n" +"Project-Id-Version: Chwall 0.5.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-07-16 14:13+0200\n" "PO-Revision-Date: 2021-07-16 14:08+0200\n" From 737876cb577182abd1b361eb599992ac572bc0e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Deparis?= Date: Fri, 7 Jan 2022 19:48:09 +0100 Subject: [PATCH 2/7] fix: Add a missing ; in a desktop file --- chwall/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chwall/utils.py b/chwall/utils.py index 522d4a9..65793ac 100644 --- a/chwall/utils.py +++ b/chwall/utils.py @@ -287,7 +287,7 @@ def xdg_autostart_file(self, component, app_name, app_desc, write=False): elif component == "icon": file_content += """\ X-GNOME-Autostart-enabled=false -NotShowIn=GNOME +NotShowIn=GNOME; Categories=GTK;TrayIcon;Utility; """ if write is False: From 35ee382df5dc868ced84ce9343f495db44f3ab4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Deparis?= Date: Fri, 7 Jan 2022 19:48:42 +0100 Subject: [PATCH 3/7] feat: Support favorite as a desktop file action --- chwall/gui/app.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/chwall/gui/app.py b/chwall/gui/app.py index e966950..7bdc209 100644 --- a/chwall/gui/app.py +++ b/chwall/gui/app.py @@ -252,6 +252,7 @@ def _build_translations_for_desktop_file(localedir): "comment": [], "next_name": [], "previous_name": [], + "favorite_name": [], "blacklist_name": [] } for lng in sorted(os.listdir(localedir)): @@ -280,6 +281,10 @@ def _build_translations_for_desktop_file(localedir): "Name[{lang}]={key}".format( lang=lng, key=_("Previous wallpaper"))) + lng_attrs["favorite_name"].append( + "Name[{lang}]={key}".format( + lang=lng, + key=_("Save as favorite"))) lng_attrs["blacklist_name"].append( "Name[{lang}]={key}".format( lang=lng, @@ -316,11 +321,12 @@ def generate_desktop_file(localedir="./locale", out="chwall-app.desktop"): Type=Application Categories=GTK;GNOME;Utility; StartupNotify=false -Actions=Next;Previous;Blacklist; +Actions=Next;Previous;Favorite;Blacklist; """.format(app_exec=get_binary_path("app", "xdg")) actions = _build_action_block("next", lng_attrs) \ + _build_action_block("previous", lng_attrs) \ + + _build_action_block("favorite", lng_attrs) \ + _build_action_block("blacklist", lng_attrs) df_content += "\n".join(actions) From 73b53d36093c4dd5636eb6af7f5665dbba22ef44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Deparis?= Date: Fri, 7 Jan 2022 19:49:43 +0100 Subject: [PATCH 4/7] feat: Support Pantheon desktop (Elementary OS) --- chwall/gui/preferences.py | 2 +- chwall/utils.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chwall/gui/preferences.py b/chwall/gui/preferences.py index 22d1f53..206414b 100644 --- a/chwall/gui/preferences.py +++ b/chwall/gui/preferences.py @@ -463,7 +463,7 @@ def make_general_pane(self): adj=Gtk.Adjustment(sleep_time, 5, 120, 1), factor=60) genbox.pack_start(prefbox, False, False, 0) - environments = [("gnome", "Gnome, Budgie, …"), + environments = [("gnome", "Gnome, Pantheon, Budgie, …"), ("mate", "Mate"), ("xfce", "XFCE"), ("nitrogen", _("Use Nitrogen application"))] prefbox = self.make_select_pref( diff --git a/chwall/utils.py b/chwall/utils.py index 65793ac..ec48e9c 100644 --- a/chwall/utils.py +++ b/chwall/utils.py @@ -287,7 +287,7 @@ def xdg_autostart_file(self, component, app_name, app_desc, write=False): elif component == "icon": file_content += """\ X-GNOME-Autostart-enabled=false -NotShowIn=GNOME; +NotShowIn=GNOME;Pantheon; Categories=GTK;TrayIcon;Utility; """ if write is False: From 6dad7c32cee5956e18992a57a83b5944a4a8a261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Deparis?= Date: Fri, 7 Jan 2022 20:16:30 +0100 Subject: [PATCH 5/7] fix: Remove cache cleanup from app startup This could lead to very long startup time when the cache contains a lot of pictures. A possible other implementation would have been to use threading here, but tray icon does not like that, and in any case the daemon itself already take care of calling this function when it stops. --- chwall/gui/shared.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/chwall/gui/shared.py b/chwall/gui/shared.py index 801804b..5f5b140 100644 --- a/chwall/gui/shared.py +++ b/chwall/gui/shared.py @@ -25,8 +25,6 @@ class ChwallGui: def __init__(self): self.app = None self.reload_config() - # Try to keep cache as clean as possible - cleanup_cache() def reload_config(self): self.config = read_config() From 6a94631acbf75af78947f74e17101b36cf23feae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Deparis?= Date: Mon, 10 Jan 2022 08:53:30 +0100 Subject: [PATCH 6/7] feat: Cleanup broken cache entries when daemon starts --- chwall/daemon.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/chwall/daemon.py b/chwall/daemon.py index 022f4ca..43abd44 100644 --- a/chwall/daemon.py +++ b/chwall/daemon.py @@ -208,8 +208,6 @@ def daemon_loop(): pid_file = "{}/chwall_pid".format(BASE_CACHE_PATH) if os.path.isfile(pid_file): os.unlink(pid_file) - # Try to keep cache as clean as possible - cleanup_cache() if error_code == 0: logger.info("Kthxbye!") return error_code @@ -242,6 +240,13 @@ def start_daemon(): f.write(str(os.getpid())) logger.info(_("Starting Chwall Daemon v{version}…") .format(version=__version__)) + # Try to keep cache as clean as possible + deleted = cleanup_cache() + logger.info(gettext.ngettext( + "{number} cache entry has been removed.", + "{number} cache entries have been removed.", + deleted + ).format(number=deleted)) sys.exit(daemon_loop()) From 56d42a89ac84000acd634ecc67df1323b9b33d75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89tienne=20Deparis?= Date: Tue, 11 Jan 2022 08:51:58 +0100 Subject: [PATCH 7/7] fix: Make muzei and natgeo fetchers to work in january --- chwall/fetcher/muzei.py | 2 +- chwall/fetcher/natgeo.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/chwall/fetcher/muzei.py b/chwall/fetcher/muzei.py index fea7479..d2ffbf5 100644 --- a/chwall/fetcher/muzei.py +++ b/chwall/fetcher/muzei.py @@ -7,7 +7,7 @@ def fetch_pictures(config): today = datetime.date.today() year = today.year month = today.month - 1 - if month == -1: + if month == 0: month = 12 year -= 1 # We get the last month meta file to have enough wallpaper to show (~30). diff --git a/chwall/fetcher/natgeo.py b/chwall/fetcher/natgeo.py index dc56d43..7f371d8 100644 --- a/chwall/fetcher/natgeo.py +++ b/chwall/fetcher/natgeo.py @@ -12,6 +12,7 @@ def fetch_pictures(config): month_idx = t.month - 2 if month_idx == -1: month_idx = 11 + year -= 1 month = month_label[month_idx] final_uri = "https://www.nationalgeographic.co.uk/page-data/" \ f"photo-of-the-day/{year}/{month}/page-data.json"