diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/config/variety.conf variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/config/variety.conf --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/config/variety.conf 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/config/variety.conf 2019-07-19 02:46:55.000000000 +0000 @@ -50,7 +50,7 @@ clipboard_hosts = "wallhaven.cc,wallpapers.net,flickr.com,imgur.com,deviantart.com,interfacelift.com,vladstudio.com,imageshack.us,deviantart.net,imageshack.com" # Icon settings -# icon = +# icon = icon = Light # Prefer only images with this color: Binary files /tmp/tmpzeGprh/pWEQnVacyI/variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num1.png and /tmp/tmpzeGprh/X1V_AxgfIt/variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num1.png differ diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num1.svg variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num1.svg --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num1.svg 1970-01-01 00:00:00.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num1.svg 2019-07-19 02:46:55.000000000 +0000 @@ -0,0 +1,87 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + 1 + + Binary files /tmp/tmpzeGprh/pWEQnVacyI/variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num2.png and /tmp/tmpzeGprh/X1V_AxgfIt/variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num2.png differ diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num2.svg variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num2.svg --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num2.svg 1970-01-01 00:00:00.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num2.svg 2019-07-19 02:46:55.000000000 +0000 @@ -0,0 +1,89 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + 2 + + Binary files /tmp/tmpzeGprh/pWEQnVacyI/variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num3.png and /tmp/tmpzeGprh/X1V_AxgfIt/variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num3.png differ diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num3.svg variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num3.svg --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num3.svg 1970-01-01 00:00:00.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num3.svg 2019-07-19 02:46:55.000000000 +0000 @@ -0,0 +1,87 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + 3 + + Binary files /tmp/tmpzeGprh/pWEQnVacyI/variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num4.png and /tmp/tmpzeGprh/X1V_AxgfIt/variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num4.png differ diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num4.svg variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num4.svg --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/media/variety-indicator-num4.svg 1970-01-01 00:00:00.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/media/variety-indicator-num4.svg 2019-07-19 02:46:55.000000000 +0000 @@ -0,0 +1,89 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + 4 + + diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/APODDownloader.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/APODDownloader.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/APODDownloader.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/APODDownloader.py 2019-07-19 02:46:55.000000000 +0000 @@ -17,9 +17,8 @@ import logging import random -from variety import _ from variety.plugins.downloaders.SimpleDownloader import SimpleDownloader -from variety.Util import Util +from variety.Util import Util, _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/BingDownloader.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/BingDownloader.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/BingDownloader.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/BingDownloader.py 2019-07-19 02:46:55.000000000 +0000 @@ -18,9 +18,8 @@ from datetime import datetime from urllib.parse import parse_qs, urlparse -from variety import _ from variety.plugins.downloaders.SimpleDownloader import SimpleDownloader -from variety.Util import Util +from variety.Util import Util, _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/ChromeOSWallpapersDownloader.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/ChromeOSWallpapersDownloader.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/ChromeOSWallpapersDownloader.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/ChromeOSWallpapersDownloader.py 2019-07-19 02:46:55.000000000 +0000 @@ -16,9 +16,8 @@ import logging import random -from variety import _ from variety.plugins.downloaders.SimpleDownloader import SimpleDownloader -from variety.Util import Util +from variety.Util import Util, _ MANIFEST_URL = "https://storage.googleapis.com/chromeos-wallpaper-public/manifest_en.json" diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/DesktopprDownloader.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/DesktopprDownloader.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/DesktopprDownloader.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/DesktopprDownloader.py 2019-07-19 02:46:55.000000000 +0000 @@ -16,10 +16,9 @@ import logging -from variety import _ from variety.plugins.downloaders.DefaultDownloader import QueueItem from variety.plugins.downloaders.SimpleDownloader import SimpleDownloader -from variety.Util import Util +from variety.Util import Util, _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/EarthDownloader.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/EarthDownloader.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/EarthDownloader.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/EarthDownloader.py 2019-07-19 02:46:55.000000000 +0000 @@ -18,8 +18,8 @@ import os import shutil -from variety import _ from variety.plugins.downloaders.SimpleDownloader import SimpleDownloader +from variety.Util import _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/EarthviewDownloader.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/EarthviewDownloader.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/EarthviewDownloader.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/EarthviewDownloader.py 2019-07-19 02:46:55.000000000 +0000 @@ -16,10 +16,9 @@ import logging import random -from variety import _ from variety.plugins.downloaders.ImageSource import Throttling from variety.plugins.downloaders.SimpleDownloader import SimpleDownloader -from variety.Util import Util +from variety.Util import Util, _ # Credits: Using the data prepared by limhenry @ https://github.com/limhenry/earthview DATA_URL = "https://raw.githubusercontent.com/limhenry/earthview/3cd868a932cd652c4373c0f6ea8618a96b08be4e/wallpaper%20changer/data.json" diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/UnsplashDownloader.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/UnsplashDownloader.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/downloaders/UnsplashDownloader.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/downloaders/UnsplashDownloader.py 2019-07-19 02:46:55.000000000 +0000 @@ -17,10 +17,9 @@ import random import time -from variety import _ from variety.plugins.downloaders.ImageSource import Throttling from variety.plugins.downloaders.SimpleDownloader import SimpleDownloader -from variety.Util import Util +from variety.Util import Util, _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/quotes/GoodreadsSource.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/quotes/GoodreadsSource.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/quotes/GoodreadsSource.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/quotes/GoodreadsSource.py 2019-07-19 02:46:55.000000000 +0000 @@ -19,9 +19,8 @@ import re from httplib2 import iri2uri -from variety import _ from variety.plugins.IQuoteSource import IQuoteSource -from variety.Util import Util +from variety.Util import Util, _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/quotes/LocalFilesSource.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/quotes/LocalFilesSource.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/quotes/LocalFilesSource.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/quotes/LocalFilesSource.py 2019-07-19 02:46:55.000000000 +0000 @@ -17,8 +17,9 @@ import os import re -from variety import _ from variety.plugins.IQuoteSource import IQuoteSource +from variety.profile import get_profile_path +from variety.Util import _ logger = logging.getLogger("variety") @@ -34,10 +35,10 @@ "name": "Local text files", "description": _( "Displays quotes, defined in local text files.\n" - "Put your own txt files in: ~/.config/variety/pluginconfig/quotes/.\n" + "Put your own txt files in: {}pluginconfig/quotes/.\n" "The file format is:\n\nquote -- author\n.\nsecond quote -- another author\n.\netc...\n\n" "Example: http://rvelthuis.de/zips/quotes.txt" - ), + ).format(get_profile_path(expanded=False)), "author": "Peter Levi", "version": "0.1", } diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/quotes/QuotationsPageSource.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/quotes/QuotationsPageSource.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/plugins/quotes/QuotationsPageSource.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/plugins/quotes/QuotationsPageSource.py 2019-07-19 02:46:55.000000000 +0000 @@ -20,9 +20,8 @@ import bs4 from httplib2 import iri2uri -from variety import _ from variety.plugins.IQuoteSource import IQuoteSource -from variety.Util import Util +from variety.Util import Util, _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/ui/PreferencesVarietyDialog.ui variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/ui/PreferencesVarietyDialog.ui --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/ui/PreferencesVarietyDialog.ui 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/ui/PreferencesVarietyDialog.ui 2019-07-19 02:46:55.000000000 +0000 @@ -3378,6 +3378,10 @@ Light Dark + Number 1 + Number 2 + Number 3 + Number 4 Use current wallpaper Custom image... None diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/variety-autostart.desktop.template variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/variety-autostart.desktop.template --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/variety-autostart.desktop.template 1970-01-01 00:00:00.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/variety-autostart.desktop.template 2019-07-19 02:46:55.000000000 +0000 @@ -0,0 +1,14 @@ +[Desktop Entry] +Name=Variety +Comment=Variety Wallpaper Changer +Categories=GNOME;GTK;Utility; +Exec={VARIETY_PATH} --profile {PROFILE_PATH} %U +MimeType=text/uri-list;x-scheme-handler/variety;x-scheme-handler/vrty; +Icon=variety +Terminal=false +Type=Application +StartupNotify=false +Actions=Next;Previous;PauseResume;History;Preferences; +Keywords=Wallpaper;Changer;Change;Download;Downloader;Variety; +X-GNOME-Autostart-Delay=20 +StartupWMClass={WM_CLASS} diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/variety-profile.desktop.template variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/variety-profile.desktop.template --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/data/variety-profile.desktop.template 1970-01-01 00:00:00.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/data/variety-profile.desktop.template 2019-07-19 02:46:55.000000000 +0000 @@ -0,0 +1,38 @@ +[Desktop Entry] +Name=Variety (Profile: {PROFILE_NAME}) +Comment=Variety Wallpaper Changer, running with profile {PROFILE_NAME} +Categories=GNOME;GTK;Utility; +Exec={VARIETY_PATH} --profile {PROFILE_PATH} %U +MimeType=text/uri-list;x-scheme-handler/variety;x-scheme-handler/vrty; +Icon=variety +Terminal=false +Type=Application +StartupNotify=false +Actions=Next;Previous;PauseResume;History;Preferences; +Keywords=Wallpaper;Changer;Change;Download;Downloader;Variety; +StartupWMClass={WM_CLASS} + +[Desktop Action Next] +Exec={VARIETY_PATH} --profile {PROFILE_PATH} --next +Name=Next +OnlyShowIn=Unity; + +[Desktop Action Previous] +Exec={VARIETY_PATH} --profile {PROFILE_PATH} --previous +Name=Previous +OnlyShowIn=Unity; + +[Desktop Action PauseResume] +Exec={VARIETY_PATH} --profile {PROFILE_PATH} --toggle-pause +Name=Pause / Resume +OnlyShowIn=Unity; + +[Desktop Action History] +Exec={VARIETY_PATH} --profile {PROFILE_PATH} --history +Name=History +OnlyShowIn=Unity; + +[Desktop Action Preferences] +Exec={VARIETY_PATH} --profile {PROFILE_PATH} --preferences +Name=Preferences +OnlyShowIn=Unity; diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/debian/changelog variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/debian/changelog --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/debian/changelog 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/debian/changelog 2019-07-19 02:46:55.000000000 +0000 @@ -1,8 +1,8 @@ -variety (0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1) cosmic; urgency=low +variety (0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1) cosmic; urgency=low * Auto build. - -- Launchpad Package Builder Mon, 15 Jul 2019 16:31:33 +0000 + -- Launchpad Package Builder Fri, 19 Jul 2019 02:46:55 +0000 variety (0.7.2) bionic; urgency=medium diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/debian/git-build-recipe.manifest variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/debian/git-build-recipe.manifest --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/debian/git-build-recipe.manifest 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/debian/git-build-recipe.manifest 2019-07-19 02:46:55.000000000 +0000 @@ -1,2 +1,2 @@ -# git-build-recipe format 0.4 deb-version 0.7.2~git201907142200.514faa6~ppa828 -lp:variety git-commit:514faa6d8e9c37e26755d2ed2bc513f45dc3df62 +# git-build-recipe format 0.4 deb-version 0.7.2~git201907182128.70c6108~ppa836 +lp:variety git-commit:70c6108e9fee4f7550f5059949f1b88811209587 diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/AddFlickrDialog.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/AddFlickrDialog.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/AddFlickrDialog.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/AddFlickrDialog.py 2019-07-19 02:46:55.000000000 +0000 @@ -20,10 +20,9 @@ from gi.repository import Gdk, Gtk # pylint: disable=E0611 -from variety import _ from variety.FlickrDownloader import FlickrDownloader from variety.Options import Options -from variety.Util import Util, on_gtk +from variety.Util import Util, _, on_gtk from variety_lib.helpers import get_builder logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/AddMediaRssDialog.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/AddMediaRssDialog.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/AddMediaRssDialog.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/AddMediaRssDialog.py 2019-07-19 02:46:55.000000000 +0000 @@ -16,10 +16,10 @@ from gi.repository import Gtk # pylint: disable=E0611 -from variety import _ from variety.AbstractAddByQueryDialog import AbstractAddByQueryDialog from variety.MediaRssDownloader import MediaRssDownloader from variety.Options import Options +from variety.Util import _ from variety_lib.helpers import get_builder diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/AddRedditDialog.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/AddRedditDialog.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/AddRedditDialog.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/AddRedditDialog.py 2019-07-19 02:46:55.000000000 +0000 @@ -16,10 +16,10 @@ from gi.repository import Gtk # pylint: disable=E0611 -from variety import _ from variety.AbstractAddByQueryDialog import AbstractAddByQueryDialog from variety.Options import Options from variety.RedditDownloader import RedditDownloader +from variety.Util import _ from variety_lib.helpers import get_builder diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/AddWallhavenDialog.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/AddWallhavenDialog.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/AddWallhavenDialog.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/AddWallhavenDialog.py 2019-07-19 02:46:55.000000000 +0000 @@ -16,9 +16,9 @@ from gi.repository import Gtk # pylint: disable=E0611 -from variety import _ from variety.AbstractAddByQueryDialog import AbstractAddByQueryDialog from variety.Options import Options +from variety.Util import _ from variety.WallhavenDownloader import WallhavenDownloader from variety_lib.helpers import get_builder diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/FolderChooser.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/FolderChooser.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/FolderChooser.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/FolderChooser.py 2019-07-19 02:46:55.000000000 +0000 @@ -19,8 +19,7 @@ from gi.repository import Gtk -from variety import _ -from variety.Util import Util +from variety.Util import Util, _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/ImageFetcher.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/ImageFetcher.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/ImageFetcher.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/ImageFetcher.py 2019-07-19 02:46:55.000000000 +0000 @@ -20,8 +20,7 @@ from PIL import Image from requests.exceptions import HTTPError -from variety import _ -from variety.Util import Util +from variety.Util import Util, _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/indicator.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/indicator.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/indicator.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/indicator.py 2019-07-19 02:46:55.000000000 +0000 @@ -21,12 +21,12 @@ from gi.repository import Gtk # pylint: disable=E0611 -from variety import _ -from variety.Util import Util +from variety.Util import Util, _ from variety_lib import varietyconfig THEME_ICON_NAME = "variety-indicator" THEME_ICON_NAME_DARK = "variety-indicator-dark" +THEME_ICON_NAME_NUM = "variety-indicator-num{}" try: import gi @@ -387,6 +387,14 @@ return else: icon_path = varietyconfig.get_data_file("media", "variety-indicator-dark.png") + elif icon in ["1", "2", "3", "4"]: + if Gtk.IconTheme.get_default().has_icon(THEME_ICON_NAME_NUM.format(icon)): + set_from_theme_icon(THEME_ICON_NAME_NUM.format(icon)) + return + else: + icon_path = varietyconfig.get_data_file( + "media", "variety-indicator-num{}.png".format(icon) + ) elif icon and os.access(icon, os.R_OK) and Util.is_image(icon): icon_path = icon else: diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/__init__.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/__init__.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/__init__.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/__init__.py 2019-07-19 02:46:55.000000000 +0000 @@ -15,42 +15,24 @@ # with this program. If not, see . ### END LICENSE +import dbus, dbus.service, dbus.glib import gettext import logging - -gettext.textdomain("variety") import os +import signal import sys +import gi -def _(text): - """Returns the translated form of text.""" - return gettext.gettext(text) +gi.require_version("Gtk", "3.0") +from gi.repository import Gtk, GObject # pylint: disable=E0611 +from variety import VarietyWindow, ThumbsManager, ThumbsWindow +from variety.profile import set_profile_path, get_profile_path, is_default_profile, get_profile_id +from variety.Util import Util, _, ModuleProfiler, safe_print -def safe_print(text, ascii_text=None, file=sys.stdout): - """ - Python's print throws UnicodeEncodeError if the terminal encoding is borked. This version tries print, then logging, then printing the ascii text when one is present. - If does not throw exceptions even if it fails. - :param text: Text to print, str or unicode, possibly with non-ascii symbols in it - :param ascii_text: optional. Original untranslated ascii version of the text when present. - """ - try: - print(text, file=file) - except: # UnicodeEncodeError can happen here if the terminal is strangely configured, but we are playing safe and catching everything - try: - logging.getLogger("variety").error( - "Error printing non-ascii text, terminal encoding is %s" % sys.stdout.encoding - ) - if ascii_text: - try: - print(ascii_text) - return - except: - pass - logging.getLogger("variety").warning(text) - except: - pass + +gettext.textdomain("variety") class SafeLogger(logging.Logger): @@ -88,33 +70,32 @@ # reload(sys) # sys.setdefaultencoding('UTF8') -import signal -import dbus, dbus.service, dbus.glib -import logging - -import gi -gi.require_version("Gtk", "3.0") - -from gi.repository import Gtk, Gdk, GObject # pylint: disable=E0611 +def _get_dbus_key(): + """ + DBus key for Variety. + Variety uses a different key per profile, so several instances can run simultaneously if + running with different profiles. + Command any instance from the terminal by passing explicitly the same --profile options as it + was started with. + :return: the dbus key + """ + if is_default_profile(): + return "com.peterlevi.Variety" + else: + return "com.peterlevi.Variety_{}".format(get_profile_id()) -from variety import VarietyWindow -from variety import ThumbsManager -from variety import ThumbsWindow -from variety.Util import Util, ModuleProfiler -from variety_lib.helpers import set_up_logging -DBUS_KEY = "com.peterlevi.Variety" DBUS_PATH = "/com/peterlevi/Variety" class VarietyService(dbus.service.Object): def __init__(self, variety_window): self.variety_window = variety_window - bus_name = dbus.service.BusName(DBUS_KEY, bus=dbus.SessionBus()) + bus_name = dbus.service.BusName(_get_dbus_key(), bus=dbus.SessionBus()) dbus.service.Object.__init__(self, bus_name, DBUS_PATH) - @dbus.service.method(dbus_interface=DBUS_KEY, in_signature="as", out_signature="s") + @dbus.service.method(dbus_interface=_get_dbus_key(), in_signature="as", out_signature="s") def process_command(self, arguments): result = self.variety_window.process_command(arguments, initial_run=False) return "" if result is None else result @@ -125,15 +106,15 @@ terminate = False -def sigint_handler(*args): +def _sigint_handler(*args): global terminate terminate = True -def check_quit(): +def _check_quit(): global terminate if not terminate: - GObject.timeout_add(1000, check_quit) + GObject.timeout_add(1000, _check_quit) return logging.getLogger("variety").info("Terminating signal received, quitting...") @@ -149,30 +130,74 @@ Util.start_force_exit_thread(10) +def _set_up_logging(verbose): + # add a handler to prevent basicConfig + root = logging.getLogger() + null_handler = logging.NullHandler() + root.addHandler(null_handler) + + formatter = logging.Formatter("%(levelname)s: %(asctime)s: %(funcName)s() '%(message)s'") + + logger = logging.getLogger("variety") + logger_sh = logging.StreamHandler() + logger_sh.setFormatter(formatter) + logger.addHandler(logger_sh) + + try: + logger_file = logging.FileHandler(os.path.join(get_profile_path(), "variety.log"), "w") + logger_file.setFormatter(formatter) + logger.addHandler(logger_file) + except Exception: + logger.exception("Could not create file logger") + + lib_logger = logging.getLogger("variety_lib") + lib_logger_sh = logging.StreamHandler() + lib_logger_sh.setFormatter(formatter) + lib_logger.addHandler(lib_logger_sh) + + logger.setLevel(logging.INFO) + # Set the logging level to show debug messages. + if verbose >= 2: + logger.setLevel(logging.DEBUG) + elif not verbose: + # If we're not in verbose mode, only log these messages to file. This prevents + # flooding syslog and/or ~/.xsession-errors depending on how variety was started: + # (https://bugs.launchpad.net/variety/+bug/1685003) + # XXX: We should /really/ make the internal debug logging use logging.debug, + # this is really just a bandaid patch. + logger_sh.setLevel(logging.WARNING) + + if verbose >= 3: + lib_logger.setLevel(logging.DEBUG) + + def main(): # Ctrl-C - signal.signal(signal.SIGINT, sigint_handler) - signal.signal(signal.SIGTERM, sigint_handler) - signal.signal(signal.SIGQUIT, sigint_handler) - - Util.makedirs(os.path.expanduser("~/.config/variety/")) + signal.signal(signal.SIGINT, _sigint_handler) + signal.signal(signal.SIGTERM, _sigint_handler) + signal.signal(signal.SIGQUIT, _sigint_handler) arguments = sys.argv[1:] # validate arguments - options, args = VarietyWindow.VarietyWindow.parse_options(arguments) + from variety import VarietyOptionParser + + options, args = VarietyOptionParser.parse_options(arguments) + set_profile_path(options.profile) + Util.makedirs(get_profile_path()) + # ensure singleton per profile bus = dbus.SessionBus() - # ensure singleton - if bus.request_name(DBUS_KEY) != dbus.bus.REQUEST_NAME_REPLY_PRIMARY_OWNER: - if not arguments: + dbus_key = _get_dbus_key() + if bus.request_name(dbus_key) != dbus.bus.REQUEST_NAME_REPLY_PRIMARY_OWNER: + if not arguments or (options.profile and len(arguments) <= 2): arguments = ["--preferences"] safe_print( _("Variety is already running. Sending the command to the running instance."), "Variety is already running. Sending the command to the running instance.", file=sys.stderr, ) - method = bus.get_object(DBUS_KEY, DBUS_PATH).get_dbus_method("process_command") + method = bus.get_object(dbus_key, DBUS_PATH).get_dbus_method("process_command") result = method(arguments) if result: safe_print(result) @@ -181,7 +206,8 @@ # set up logging # set_up_logging must be called after the DBus checks, only by one running instance, # or the log file can be corrupted - set_up_logging(options.verbose) + _set_up_logging(options.verbose) + logging.getLogger("variety").info(lambda: "Using profile folder {}".format(get_profile_path())) if options.verbose >= 3: profiler = ModuleProfiler() @@ -212,5 +238,5 @@ bus.call_on_disconnection(window.on_quit) window.start(arguments) - GObject.timeout_add(2000, check_quit) + GObject.timeout_add(2000, _check_quit) Gtk.main() diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/Options.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/Options.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/Options.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/Options.py 2019-07-19 02:46:55.000000000 +0000 @@ -18,6 +18,7 @@ import os from configobj import ConfigObj, DuplicateError +from variety.profile import get_profile_path from variety.Util import Util from variety_lib import varietyconfig @@ -68,7 +69,7 @@ LIGHT = 1 def __init__(self): - self.configfile = os.path.expanduser("~/.config/variety/variety.conf") + self.configfile = os.path.join(get_profile_path(), "variety.conf") def read(self): self.set_defaults() @@ -165,7 +166,7 @@ try: icon = config["icon"] - if icon in ["Light", "Dark", "Current", "None"] or ( + if icon in ["Light", "Dark", "Current", "1", "2", "3", "4", "None"] or ( os.access(icon, os.R_OK) and Util.is_image(icon) ): self.icon = icon @@ -581,18 +582,18 @@ self.download_enabled = True self.download_interval = 600 - self.download_folder = os.path.expanduser("~/.config/variety/Downloaded") + self.download_folder = os.path.join(get_profile_path(), "Downloaded") self.quota_enabled = True self.quota_size = 500 - self.favorites_folder = os.path.expanduser("~/.config/variety/Favorites") + self.favorites_folder = os.path.join(get_profile_path(), "Favorites") self.favorites_operations = [ ["Downloaded", "Copy"], ["Fetched", "Move"], ["Others", "Copy"], ] - self.fetched_folder = os.path.expanduser("~/.config/variety/Fetched") + self.fetched_folder = os.path.join(get_profile_path(), "Fetched") self.clipboard_enabled = False self.clipboard_use_whitelist = True self.clipboard_hosts = "wallhaven.cc,ns223506.ovh.net,wallpapers.net,flickr.com,imgur.com,deviantart.com,interfacelift.com,vladstudio.com".split( @@ -642,7 +643,7 @@ self.quotes_hpos = 100 self.quotes_vpos = 40 self.quotes_max_length = 250 - self.quotes_favorites_file = os.path.expanduser("~/.config/variety/favorite_quotes.txt") + self.quotes_favorites_file = os.path.join(get_profile_path(), "favorite_quotes.txt") self.slideshow_sources_enabled = True self.slideshow_favorites_enabled = True diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/PreferencesVarietyDialog.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/PreferencesVarietyDialog.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/PreferencesVarietyDialog.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/PreferencesVarietyDialog.py 2019-07-19 02:46:55.000000000 +0000 @@ -25,7 +25,7 @@ from gi.repository import Gdk, GdkPixbuf, GObject, Gtk # pylint: disable=E0611 -from variety import Texts, _ +from variety import Texts from variety.AddFlickrDialog import AddFlickrDialog from variety.AddMediaRssDialog import AddMediaRssDialog from variety.AddRedditDialog import AddRedditDialog @@ -34,7 +34,14 @@ from variety.FolderChooser import FolderChooser from variety.Options import Options from variety.plugins.IQuoteSource import IQuoteSource -from variety.Util import Util, on_gtk +from variety.profile import ( + get_autostart_file_path, + get_profile_path, + get_profile_short_name, + get_profile_wm_class, + is_default_profile, +) +from variety.Util import Util, _, on_gtk from variety_lib import varietyconfig from variety_lib.PreferencesDialog import PreferencesDialog from variety_lib.varietyconfig import get_data_file @@ -77,6 +84,12 @@ if not Util.check_variety_slideshow_present(): self.ui.notebook.remove_page(2) + profile_suffix = ( + "" if is_default_profile() else " (Profile: {})".format(get_profile_short_name()) + ) + self.set_title(_("Variety Preferences") + _(profile_suffix)) + self.set_wmclass(get_profile_wm_class(), get_profile_wm_class()) + self.reload() def fill_smart_profile_url(self, msg): @@ -117,9 +130,7 @@ self.options = Options() self.options.read() - self.ui.autostart.set_active( - os.path.isfile(os.path.expanduser("~/.config/autostart/variety.desktop")) - ) + self.ui.autostart.set_active(os.path.isfile(get_autostart_file_path())) self.ui.change_enabled.set_active(self.options.change_enabled) self.set_change_interval(self.options.change_interval) @@ -145,12 +156,20 @@ self.ui.icon.set_active(0) elif self.options.icon == "Dark": self.ui.icon.set_active(1) - elif self.options.icon == "Current": + elif self.options.icon == "1": self.ui.icon.set_active(2) - elif self.options.icon == "None": + elif self.options.icon == "2": + self.ui.icon.set_active(3) + elif self.options.icon == "3": self.ui.icon.set_active(4) + elif self.options.icon == "4": + self.ui.icon.set_active(5) + elif self.options.icon == "Current": + self.ui.icon.set_active(6) + elif self.options.icon == "None": + self.ui.icon.set_active(7) else: - self.ui.icon.set_active(3) + self.ui.icon.set_active(8) self.ui.icon_chooser.set_filename(self.options.icon) if self.options.favorites_operations == [["/", "Copy"]]: @@ -309,7 +328,14 @@ self.ui.quotes_sources_grid.attach(cb, i % 4, i // 4, 1, 1) self.quotes_sources_checkboxes.append(cb) - self.ui.tips_buffer.set_text("\n\n".join(Texts.TIPS)) + self.ui.tips_buffer.set_text( + "\n\n".join( + [ + tip.replace("{PROFILE_PATH}", get_profile_path(expanded=False)) + for tip in Texts.TIPS + ] + ) + ) try: with open(get_data_file("ui/changes.txt")) as f: @@ -930,10 +956,18 @@ elif self.ui.icon.get_active() == 1: self.options.icon = "Dark" elif self.ui.icon.get_active() == 2: - self.options.icon = "Current" + self.options.icon = "1" + elif self.ui.icon.get_active() == 3: + self.options.icon = "2" elif self.ui.icon.get_active() == 4: + self.options.icon = "3" + elif self.ui.icon.get_active() == 5: + self.options.icon = "4" + elif self.ui.icon.get_active() == 6: + self.options.icon = "Current" + elif self.ui.icon.get_active() == 7: self.options.icon = "None" - elif self.ui.icon.get_active() == 3: + elif self.ui.icon.get_active() == 8: file = self.ui.icon_chooser.get_filename() if file and os.access(file, os.R_OK): self.options.icon = file @@ -1076,7 +1110,7 @@ dialog.destroy() def update_autostart(self): - file = os.path.expanduser("~/.config/autostart/variety.desktop") + file = get_autostart_file_path() if not self.ui.autostart.get_active(): if os.path.exists(file): diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/profile.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/profile.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/profile.py 1970-01-01 00:00:00.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/profile.py 2019-07-19 02:46:55.000000000 +0000 @@ -0,0 +1,63 @@ +import os + +from variety.Util import Util + +DEFAULT_PROFILE_PATH = "~/.config/variety/" + +__profile_path = DEFAULT_PROFILE_PATH + + +def set_profile_path(profile_path): + if not profile_path: + profile_path = DEFAULT_PROFILE_PATH + + # if just a name is passed instead of a full path, put it under ~/.config/variety-profiles + if not "/" in profile_path: + profile_path = "~/.config/variety-profiles/{}".format(profile_path) + + # make sure profile path has a trailing slash + if not profile_path.endswith("/"): + profile_path += "/" + + global __profile_path + __profile_path = profile_path + + +def get_profile_path(expanded=True): + global __profile_path + return os.path.expanduser(__profile_path) if expanded else __profile_path + + +def get_profile_short_name(): + return os.path.basename(get_profile_path()[:-1]) + + +def get_profile_wm_class(): + return "Variety" + ("" if is_default_profile() else " (Profile: {})".format(get_profile_path())) + + +def is_default_profile(): + """ + Are we using the default profile or a custom profile? + """ + return os.path.normpath(get_profile_path()) == os.path.normpath( + os.path.expanduser(DEFAULT_PROFILE_PATH) + ) + + +def get_profile_id(): + """ + Returns a dbus-and-filename-friendly identificator of the profile path + """ + return Util.md5(os.path.normpath(get_profile_path()))[:10] + + +def get_desktop_file_name(): + if is_default_profile(): + return "variety.desktop" + else: + return "variety-{}-{}.desktop".format(get_profile_short_name(), get_profile_id()) + + +def get_autostart_file_path(): + return os.path.join(os.path.expanduser("~/.config/autostart"), get_desktop_file_name()) diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/QuotesEngine.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/QuotesEngine.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/QuotesEngine.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/QuotesEngine.py 2019-07-19 02:46:55.000000000 +0000 @@ -19,8 +19,8 @@ import threading import time -from variety import _ from variety.plugins.IQuoteSource import IQuoteSource +from variety.Util import _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/RedditDownloader.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/RedditDownloader.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/RedditDownloader.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/RedditDownloader.py 2019-07-19 02:46:55.000000000 +0000 @@ -19,10 +19,9 @@ import re import urllib.parse -from variety import _ from variety.plugins.downloaders.DefaultDownloader import DefaultDownloader from variety.plugins.downloaders.ImageSource import ImageSource -from variety.Util import Util +from variety.Util import Util, _ logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/Texts.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/Texts.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/Texts.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/Texts.py 2019-07-19 02:46:55.000000000 +0000 @@ -14,7 +14,8 @@ # with this program. If not, see . ### END LICENSE -from variety import _ +from variety.profile import get_profile_path +from variety.Util import _ FILTERS = { "Keep original": _("Keep original"), @@ -50,12 +51,14 @@ ), } +profile_path = get_profile_path(expanded=False) + TIPS = [ _( "You can change the wallpaper back and forth by scrolling the mouse wheel on top of the indicator icon." ), _( - "If you want to run custom commands every time the wallpaper changes or if you use an alternative desktop environment, please edit the scripts in ~/.config/variety/scripts. There are examples there for various desktop environments." + "If you want to run custom commands every time the wallpaper changes or if you use an alternative desktop environment, please edit the scripts in {PROFILE_PATH}scripts. There are examples there for various desktop environments." ), _( 'Variety can be controlled from the command line and you can use this to define keyboard shortcuts for the operations you use most often. Run "variety --help" to see all available commands.' @@ -67,18 +70,18 @@ "Applying a heavy blurring filter is a great way to get abstract-looking and unobtrusive, yet colorful wallpapers, similar in spirit to the default one in Ubuntu." ), _( - "Adding your own custom filters is quite easy: open ~/.config/variety/variety.conf in an editor and use the existing filters as an example. Every filter is just a line of options to be passed to ImageMagick's convert command." + "Adding your own custom filters is quite easy: open {PROFILE_PATH}variety.conf in an editor and use the existing filters as an example. Every filter is just a line of options to be passed to ImageMagick's convert command." ), _( 'When you select an image source, its images are displayed in a window at the bottom of the screen. Click an image there to set is as wallpaper. Right-click to close the window, to modify its appearance or to perform file operations. You can select multiple image sources to create a "merged" thumbnail view of all of them. Please mind that thumbnail view is limited to several hundred randomly selected images.' ), _( - "To enable desktop notifications when the wallpaper changes, uncomment the two lines at the bottom of ~/.config/variety/scripts/set_wallpaper." + "To enable desktop notifications when the wallpaper changes, uncomment the two lines at the bottom of {PROFILE_PATH}scripts/set_wallpaper." ), _( 'Variety\'s indicator icon is themeable - if you you choose the "Light" option for the icon, Variety will first check if the current GTK theme has an icon named "variety-indicator" and will use it instead of the bundled light icon.' ), _( - "When you choose to save quotes to Favorites, these are by default saved to ~/.config/variety/favorite_quotes.txt. This file is compatible with Variety's local files quote source. If you want to use it - copy it to ~/.config/variety/pluginconfig/quotes/ and enable the Local Files quote source. This file is also compatible with the Unix fortune utility." + "When you choose to save quotes to Favorites, these are by default saved to {PROFILE_PATH}favorite_quotes.txt. This file is compatible with Variety's local files quote source. If you want to use it - copy it to ~/.config/variety/pluginconfig/quotes/ and enable the Local Files quote source. This file is also compatible with the Unix fortune utility." ), ] diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/ThumbsManager.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/ThumbsManager.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/ThumbsManager.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/ThumbsManager.py 2019-07-19 02:46:55.000000000 +0000 @@ -22,9 +22,8 @@ from gi.repository import Gdk, GdkPixbuf, GObject, Gtk from configobj import ConfigObj -from variety import _ from variety.ThumbsWindow import ThumbsWindow -from variety.Util import Util +from variety.Util import Util, _ from variety_lib import varietyconfig logger = logging.getLogger("variety") diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/ThumbsWindow.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/ThumbsWindow.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/ThumbsWindow.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/ThumbsWindow.py 2019-07-19 02:46:55.000000000 +0000 @@ -21,6 +21,7 @@ from gi.repository import Gdk, GdkPixbuf, GObject, Gtk +from variety.profile import get_profile_wm_class from variety.Util import Util, on_gtk logger = logging.getLogger("variety") @@ -38,6 +39,8 @@ logger.debug(lambda: "Creating thumb window %s, %d" % (str(self), time.time())) super(ThumbsWindow, self).__init__() + self.set_wmclass(get_profile_wm_class(), get_profile_wm_class()) + self.running = True self.set_decorated(False) diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/Util.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/Util.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/Util.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/Util.py 2019-07-19 02:46:55.000000000 +0000 @@ -16,6 +16,7 @@ import codecs import datetime import functools +import gettext import hashlib import json import logging @@ -29,17 +30,18 @@ import threading import time import urllib.parse -from functools import wraps import bs4 import requests from PIL import Image + from variety_lib import get_version # fmt: off import gi # isort:skip gi.require_version("GExiv2", "0.10") gi.require_version("PangoCairo", "1.0") +gi.require_version('Gdk', '3.0') from gi.repository import Gdk, GdkPixbuf, GExiv2, Gio, GLib, Pango # isort:skip # fmt: on @@ -50,6 +52,11 @@ logger = logging.getLogger("variety") +def _(text): + """Returns the translated form of text.""" + return gettext.gettext(text) + + def debounce(seconds): """ Decorator that will postpone a functions execution until after wait seconds have elapsed since the last time it was invoked. """ @@ -93,7 +100,7 @@ self.timer = None def __call__(self, fn): - @wraps(fn) + @functools.wraps(fn) def wrapper(*args, **kwargs): try: self.timer.cancel() @@ -125,7 +132,7 @@ def decorate(f): _cache = {} - @wraps(f) + @functools.wraps(f) def decorated(*args): cached = _cache.get(args) if not cached or cached["timestamp"] < datetime.datetime.now() - datetime.timedelta( @@ -869,6 +876,21 @@ except Exception: logger.exception(lambda: "Could not delete {}, ignoring".format(filepath)) + @staticmethod + def copy_with_replace(from_path, to_path, search_replace_map): + with open(from_path, "r") as file: + data = file.read() + for search, replace in search_replace_map.items(): + data = data.replace(search, replace) + with open(to_path + ".partial", "w") as file: + file.write(data) + file.flush() + os.rename(to_path + ".partial", to_path) + + @staticmethod + def get_exec_path(): + return os.path.abspath(sys.argv[0]) + def on_gtk(f): @functools.wraps(f) @@ -876,3 +898,28 @@ Util.add_mainloop_task(f, *args) return wrapped + + +def safe_print(text, ascii_text=None, file=sys.stdout): + """ + Python's print throws UnicodeEncodeError if the terminal encoding is borked. This version tries print, then logging, then printing the ascii text when one is present. + If does not throw exceptions even if it fails. + :param text: Text to print, str or unicode, possibly with non-ascii symbols in it + :param ascii_text: optional. Original untranslated ascii version of the text when present. + """ + try: + print(text, file=file) + except: # UnicodeEncodeError can happen here if the terminal is strangely configured, but we are playing safe and catching everything + try: + logging.getLogger("variety").error( + "Error printing non-ascii text, terminal encoding is %s" % sys.stdout.encoding + ) + if ascii_text: + try: + print(ascii_text) + return + except: + pass + logging.getLogger("variety").warning(text) + except: + pass diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/VarietyOptionParser.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/VarietyOptionParser.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/VarietyOptionParser.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/VarietyOptionParser.py 2019-07-19 02:46:55.000000000 +0000 @@ -16,7 +16,8 @@ import optparse -from variety import safe_print +from variety.Util import _, safe_print +from variety_lib import varietyconfig class VarietyOptionParser(optparse.OptionParser): @@ -42,3 +43,230 @@ optparse.OptionParser.error(self, msg) else: raise ValueError(msg) + + +def parse_options(arguments, report_errors=True): + """Support for command line options""" + usage = _( + """%prog [options] [files or urls] + +Passing local files will add them to Variety's queue. +Passing remote URLs will make Variety fetch them to Fetched folder and place them in the queue. + +To set a specific wallpaper: %prog --set /some/local/image.jpg +""" + ) + + parser = VarietyOptionParser( + usage=usage, version="%%prog %s" % varietyconfig.get_version(), report_errors=report_errors + ) + + parser.add_option( + "--profile", + action="store", + dest="profile", + help=_( + "Profile name or full path to the configuration folder Variety should use. " + "If not specified, this is ~/.config/variety/. " + "If just a name is used instead of a full path, the profile folder will be " + "~/.config/variety-profiles/. " + "Use only when initially starting Variety - changing the profile path requires " + "restart. Several instances of Variety can be started when using different profiles, " + "each with its own separate configuration. This can be used for example to control " + "several different screens or workspaces under desktop environments like XFCE which " + "allow this. To pass commands to a running instance, pass the same --profile " + "argument as the one it was started with in subsequent commands." + ), + default=None, + ) + + parser.add_option( + "-v", + "--verbose", + action="count", + dest="verbose", + default=0, + help=_( + "Show logging messages (-vv to -vvvvv will profile various parts of Variety with increasing detail" + ), + ) + + parser.add_option( + "-q", "--quit", action="store_true", dest="quit", help=_("Make the running instance quit") + ) + + parser.add_option( + "--get", + "--get-wallpaper", + "--current", + "--show-current", + action="store_true", + dest="show_current", + help=_( + "Print the current wallpaper location. Used only when the application is already running." + ), + ) + + parser.add_option( + "--set", + "--set-wallpaper", + action="store", + dest="set_wallpaper", + help=_("Set the given file as wallpaper, absolute path required"), + ) + + parser.add_option( + "-n", "--next", action="store_true", dest="next", help=_("Show Next wallpaper") + ) + + parser.add_option( + "-p", "--previous", action="store_true", dest="previous", help=_("Show Previous wallpaper") + ) + + parser.add_option( + "--fast-forward", + action="store_true", + dest="fast_forward", + help=_("Show Next wallpaper, skipping the forward history"), + ) + + parser.add_option( + "-t", + "--trash", + action="store_true", + dest="trash", + help=_( + "Move current wallpaper to Trash. Used only when the application is already running." + ), + ) + + parser.add_option( + "-f", + "--favorite", + action="store_true", + dest="favorite", + help=_( + "Copy current wallpaper to Favorites. Used only when the application is already running." + ), + ) + + parser.add_option( + "--move-to-favorites", + action="store_true", + dest="movefavorite", + help=_( + "Move current wallpaper to Favorites. Used only when the application is already running." + ), + ) + + parser.add_option( + "--pause", action="store_true", dest="pause", help=_("Pause on current image") + ) + + parser.add_option( + "--resume", action="store_true", dest="resume", help=_("Resume regular image changes") + ) + + parser.add_option( + "--toggle-pause", + action="store_true", + dest="toggle_pause", + help=_("Toggle Pause/Resume state"), + ) + + parser.add_option( + "--quotes-next", action="store_true", dest="quotes_next", help=_("Show Next quote") + ) + + parser.add_option( + "--quotes-previous", + action="store_true", + dest="quotes_previous", + help=_("Show Previous quote"), + ) + + parser.add_option( + "--quotes-fast-forward", + action="store_true", + dest="quotes_fast_forward", + help=_("Show Next quote, skipping the forward history"), + ) + + parser.add_option( + "--quotes-toggle-pause", + action="store_true", + dest="quotes_toggle_pause", + help=_("Toggle Quotes Pause/Resume state"), + ) + + parser.add_option( + "--quotes-save-favorite", + action="store_true", + dest="quotes_save_favorite", + help=_("Save the current quote to Favorites"), + ) + + parser.add_option( + "--history", action="store_true", dest="history", help=_("Toggle History display") + ) + + parser.add_option( + "--downloads", + action="store_true", + dest="downloads", + help=_("Toggle Recent Downloads display"), + ) + + parser.add_option( + "--preferences", + "--show-preferences", + action="store_true", + dest="preferences", + help=_("Show Preferences dialog"), + ) + + parser.add_option( + "--selector", + "--show-selector", + action="store_true", + dest="selector", + help=_( + "Show manual wallpaper selector - the thumbnail bar filled with images from the active image sources" + ), + ) + + parser.add_option( + "--set-option", + action="append", + dest="set_options", + nargs=2, + help=_( + "Sets and applies an option. " + "The option names are the same that are used in Variety's config file " + "~/.config/variety/variety.conf. " + "Multiple options can be set in a single command. " + "Example: 'variety --set-option icon Dark --set-option clock_enabled True'. " + "USE WITH CAUTION: You are changing the settings file directly in an unguarded way." + ), + ) + + options, args = parser.parse_args(arguments) + + if report_errors: + if (options.next or options.fast_forward) and options.previous: + parser.error(_("options --next/--fast-forward and --previous are mutually exclusive")) + + if options.trash and options.favorite: + parser.error(_("options --trash and --favorite are mutually exclusive")) + + if options.pause and options.resume: + parser.error(_("options --pause and --resume are mutually exclusive")) + + if (options.quotes_next or options.quotes_fast_forward) and options.quotes_previous: + parser.error( + _( + "options --quotes-next/--quotes-fast-forward and --quotes-previous are mutually exclusive" + ) + ) + + return options, args diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/VarietyWindow.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/VarietyWindow.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/VarietyWindow.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/VarietyWindow.py 2019-07-19 02:46:55.000000000 +0000 @@ -30,7 +30,7 @@ from PIL import Image as PILImage from jumble.Jumble import Jumble -from variety import _, indicator +from variety import indicator from variety.AboutVarietyDialog import AboutVarietyDialog from variety.DominantColors import DominantColors from variety.FlickrDownloader import FlickrDownloader @@ -41,12 +41,21 @@ from variety.plugins.downloaders.SimpleDownloader import SimpleDownloader from variety.plugins.IVarietyPlugin import IVarietyPlugin from variety.PreferencesVarietyDialog import PreferencesVarietyDialog +from variety.profile import ( + DEFAULT_PROFILE_PATH, + get_autostart_file_path, + get_desktop_file_name, + get_profile_path, + get_profile_short_name, + get_profile_wm_class, + is_default_profile, +) from variety.QuotesEngine import QuotesEngine from variety.QuoteWriter import QuoteWriter from variety.RedditDownloader import RedditDownloader from variety.ThumbsManager import ThumbsManager -from variety.Util import Util, debounce, on_gtk, throttle -from variety.VarietyOptionParser import VarietyOptionParser +from variety.Util import Util, _, debounce, on_gtk, throttle +from variety.VarietyOptionParser import parse_options from variety.WallhavenDownloader import WallhavenDownloader from variety.WelcomeDialog import WelcomeDialog from variety_lib import varietyconfig @@ -256,12 +265,13 @@ self.preferences_dialog.present() def prepare_config_folder(self): - self.config_folder = os.path.expanduser("~/.config/variety") + self.config_folder = get_profile_path() Util.makedirs(self.config_folder) - shutil.copy( + Util.copy_with_replace( varietyconfig.get_data_file("config", "variety.conf"), os.path.join(self.config_folder, "variety_latest_default.conf"), + {DEFAULT_PROFILE_PATH: get_profile_path(expanded=False)}, ) if not os.path.exists(os.path.join(self.config_folder, "variety.conf")): @@ -269,7 +279,11 @@ lambda: "Missing config file, copying it from " + varietyconfig.get_data_file("config", "variety.conf") ) - shutil.copy(varietyconfig.get_data_file("config", "variety.conf"), self.config_folder) + Util.copy_with_replace( + varietyconfig.get_data_file("config", "variety.conf"), + os.path.join(self.config_folder, "variety.conf"), + {DEFAULT_PROFILE_PATH: get_profile_path(expanded=False)}, + ) if not os.path.exists(os.path.join(self.config_folder, "ui.conf")): logger.info( @@ -289,8 +303,10 @@ lambda: "Missing set_wallpaper file, copying it from " + varietyconfig.get_data_file("scripts", "set_wallpaper") ) - shutil.copy( - varietyconfig.get_data_file("scripts", "set_wallpaper"), self.scripts_folder + Util.copy_with_replace( + varietyconfig.get_data_file("scripts", "set_wallpaper"), + os.path.join(self.scripts_folder, "set_wallpaper"), + {DEFAULT_PROFILE_PATH.replace("~", "$HOME"): get_profile_path(expanded=True)}, ) if not os.path.exists(os.path.join(self.scripts_folder, "get_wallpaper")): @@ -298,8 +314,10 @@ lambda: "Missing get_wallpaper file, copying it from " + varietyconfig.get_data_file("scripts", "get_wallpaper") ) - shutil.copy( - varietyconfig.get_data_file("scripts", "get_wallpaper"), self.scripts_folder + Util.copy_with_replace( + varietyconfig.get_data_file("scripts", "get_wallpaper"), + os.path.join(self.scripts_folder, "get_wallpaper"), + {DEFAULT_PROFILE_PATH.replace("~", "$HOME"): get_profile_path(expanded=True)}, ) # make all scripts executable: @@ -310,6 +328,8 @@ self.wallpaper_folder = os.path.join(self.config_folder, "wallpaper") Util.makedirs(self.wallpaper_folder) + self.create_desktop_entry() + def register_clipboard(self): def clipboard_changed(clipboard, event): try: @@ -1118,15 +1138,17 @@ if self.download_folder_size <= 0 or random.randint(0, 20) == 0: self.download_folder_size = self.get_folder_size(self.real_download_folder) logger.info( - lambda: "Refreshed download folder size: %d mb", - self.download_folder_size / (1024.0 * 1024.0), + lambda: "Refreshed download folder size: {} mb".format( + self.download_folder_size / (1024.0 * 1024.0) + ) ) mb_quota = self.options.quota_size * 1024 * 1024 if self.download_folder_size > 0.95 * mb_quota: logger.info( - lambda: "Purging oldest files from download folder %s, current size: %d mb" - % (self.real_download_folder, int(self.download_folder_size / (1024.0 * 1024.0))) + lambda: "Purging oldest files from download folder {}, current size: {} mb".format( + self.real_download_folder, int(self.download_folder_size / (1024.0 * 1024.0)) + ) ) files = [] for dirpath, dirnames, filenames in os.walk(self.real_download_folder): @@ -1140,15 +1162,16 @@ file = files[i][0] if file != self.current: try: - logger.debug(lambda: "Deleting old file in downloaded: " + file) + logger.debug(lambda: "Deleting old file in downloaded: {}".format(file)) self.remove_from_queues(file) Util.safe_unlink(file) self.download_folder_size -= files[i][1] Util.safe_unlink(file + ".metadata.json") except Exception: logger.exception( - lambda: "Could not delete some file while purging download folder: " - + file + lambda: "Could not delete some file while purging download folder: {}".format( + file + ) ) i += 1 self.prepare_event.set() @@ -2136,7 +2159,7 @@ upgrade_script("get_wallpaper", VarietyWindow.OUTDATED_GET_WP_SCRIPTS) # Upgrade the autostart entry, if there is one - if os.path.exists(os.path.expanduser("~/.config/autostart/variety.desktop")): + if os.path.exists(get_autostart_file_path()): logger.info(lambda: "Updating Variety autostart desktop entry") self.create_autostart_entry() @@ -2170,7 +2193,7 @@ dialog.run() dialog.destroy() self.dialogs.remove(dialog) - subprocess.call(["gedit", "~/.config/variety/variety.conf"]) + subprocess.call(["gedit", os.path.join(self.config_folder, "variety.conf")]) self.reload_config() def on_pause_resume(self, widget=None, change_enabled=None): @@ -2199,230 +2222,12 @@ self.update_indicator(auto_changed=False) self.clear_prepared_queue() - @staticmethod - def parse_options(arguments, report_errors=True): - """Support for command line options""" - usage = _( - """%prog [options] [files or urls] - -Passing local files will add them to Variety's queue. -Passing remote URLs will make Variety fetch them to Fetched folder and place them in the queue. - -To set a specific wallpaper: %prog --set /some/local/image.jpg -""" - ) - parser = VarietyOptionParser( - usage=usage, - version="%%prog %s" % varietyconfig.get_version(), - report_errors=report_errors, - ) - - parser.add_option( - "-v", - "--verbose", - action="count", - dest="verbose", - default=0, - help=_( - "Show logging messages (-vv to -vvvvv will profile various parts of Variety with increasing detail" - ), - ) - - parser.add_option( - "-q", - "--quit", - action="store_true", - dest="quit", - help=_("Make the running instance quit"), - ) - - parser.add_option( - "--get", - "--get-wallpaper", - "--current", - "--show-current", - action="store_true", - dest="show_current", - help=_( - "Print the current wallpaper location. Used only when the application is already running." - ), - ) - - parser.add_option( - "--set", - "--set-wallpaper", - action="store", - dest="set_wallpaper", - help=_("Set the given file as wallpaper, absolute path required"), - ) - - parser.add_option( - "-n", "--next", action="store_true", dest="next", help=_("Show Next wallpaper") - ) - - parser.add_option( - "-p", - "--previous", - action="store_true", - dest="previous", - help=_("Show Previous wallpaper"), - ) - - parser.add_option( - "--fast-forward", - action="store_true", - dest="fast_forward", - help=_("Show Next wallpaper, skipping the forward history"), - ) - - parser.add_option( - "-t", - "--trash", - action="store_true", - dest="trash", - help=_( - "Move current wallpaper to Trash. Used only when the application is already running." - ), - ) - - parser.add_option( - "-f", - "--favorite", - action="store_true", - dest="favorite", - help=_( - "Copy current wallpaper to Favorites. Used only when the application is already running." - ), - ) - - parser.add_option( - "--move-to-favorites", - action="store_true", - dest="movefavorite", - help=_( - "Move current wallpaper to Favorites. Used only when the application is already running." - ), - ) - - parser.add_option( - "--pause", action="store_true", dest="pause", help=_("Pause on current image") - ) - - parser.add_option( - "--resume", action="store_true", dest="resume", help=_("Resume regular image changes") - ) - - parser.add_option( - "--toggle-pause", - action="store_true", - dest="toggle_pause", - help=_("Toggle Pause/Resume state"), - ) - - parser.add_option( - "--quotes-next", action="store_true", dest="quotes_next", help=_("Show Next quote") - ) - - parser.add_option( - "--quotes-previous", - action="store_true", - dest="quotes_previous", - help=_("Show Previous quote"), - ) - - parser.add_option( - "--quotes-fast-forward", - action="store_true", - dest="quotes_fast_forward", - help=_("Show Next quote, skipping the forward history"), - ) - - parser.add_option( - "--quotes-toggle-pause", - action="store_true", - dest="quotes_toggle_pause", - help=_("Toggle Quotes Pause/Resume state"), - ) - - parser.add_option( - "--quotes-save-favorite", - action="store_true", - dest="quotes_save_favorite", - help=_("Save the current quote to Favorites"), - ) - - parser.add_option( - "--history", action="store_true", dest="history", help=_("Toggle History display") - ) - - parser.add_option( - "--downloads", - action="store_true", - dest="downloads", - help=_("Toggle Recent Downloads display"), - ) - - parser.add_option( - "--preferences", - "--show-preferences", - action="store_true", - dest="preferences", - help=_("Show Preferences dialog"), - ) - - parser.add_option( - "--selector", - "--show-selector", - action="store_true", - dest="selector", - help=_( - "Show manual wallpaper selector - the thumbnail bar filled with images from the active image sources" - ), - ) - - parser.add_option( - "--set-option", - action="append", - dest="set_options", - nargs=2, - help=_( - "Sets and applies an option. " - "The option names are the same that are used in Variety's config file ~/.config/variety/variety.conf. " - "Multiple options can be set in a single command. " - "Example: 'variety --set-option icon Dark --set-option clock_enabled True'. " - "USE WITH CAUTION: You are changing the settings file directly in an unguarded way." - ), - ) - - options, args = parser.parse_args(arguments) - - if report_errors: - if (options.next or options.fast_forward) and options.previous: - parser.error( - _("options --next/--fast-forward and --previous are mutually exclusive") - ) - - if options.trash and options.favorite: - parser.error(_("options --trash and --favorite are mutually exclusive")) - - if options.pause and options.resume: - parser.error(_("options --pause and --resume are mutually exclusive")) - - if (options.quotes_next or options.quotes_fast_forward) and options.quotes_previous: - parser.error( - _( - "options --quotes-next/--quotes-fast-forward and --quotes-previous are mutually exclusive" - ) - ) - - return options, args - def process_command(self, arguments, initial_run): try: arguments = [str(arg) for arg in arguments] logger.info(lambda: "Received command: " + str(arguments)) - options, args = self.parse_options(arguments, report_errors=False) + options, args = parse_options(arguments, report_errors=False) if options.quit: self.on_quit() @@ -2983,27 +2788,70 @@ self.no_effects_on = self.current if no_effects else None self.refresh_wallpaper() + def create_desktop_entry(self): + """ + Creates a profile-specific desktop entry in ~/.local/share/applications + This ensures Variety's icon context menu is for the correct profile, and also that + application's windows will be correctly grouped by profile. + """ + if is_default_profile(): + return + + try: + desktop_file_folder = os.path.expanduser("~/.local/share/applications") + profile_name = get_profile_short_name() + desktop_file_path = os.path.join(desktop_file_folder, get_desktop_file_name()) + + should_notify = not os.path.exists(desktop_file_path) + + Util.makedirs(desktop_file_folder) + Util.copy_with_replace( + varietyconfig.get_data_file("variety-profile.desktop.template"), + desktop_file_path, + { + "{PROFILE_PATH}": get_profile_path(expanded=True), + "{PROFILE_NAME}": (profile_name), + "{VARIETY_PATH}": Util.get_exec_path(), + "{WM_CLASS}": get_profile_wm_class(), + }, + ) + + if should_notify: + self.show_notification( + _("Variety: New desktop entry"), + _( + "We created a new desktop entry in ~/.local/share/applications " + 'to run Variety with profile "{}". Find it in the application launcher.' + ).format(profile_name), + ) + except Exception: + logger.exception(lambda: "Could not create desktop entry for a run with --profile") + def create_autostart_entry(self): try: - logger.info(lambda: "Creating autostart entry") + autostart_file_path = get_autostart_file_path() + Util.makedirs(os.path.dirname(autostart_file_path)) + should_notify = not os.path.exists(autostart_file_path) + + Util.copy_with_replace( + varietyconfig.get_data_file("variety-autostart.desktop.template"), + autostart_file_path, + { + "{PROFILE_PATH}": get_profile_path(expanded=True), + "{VARIETY_PATH}": Util.get_exec_path(), + "{WM_CLASS}": get_profile_wm_class(), + }, + ) - content = ( - "[Desktop Entry]\n" - "Name=Variety\n" - "Comment=Variety Wallpaper Changer\n" - "Icon=variety\n" - "Exec=variety\n" - "Terminal=false\n" - "Type=Application\n" - "X-GNOME-Autostart-Delay=20\n" - ) - - Util.makedirs(os.path.expanduser("~/.config/autostart/")) - - path = os.path.expanduser("~/.config/autostart/variety.desktop") - with open(path, "w") as f: - f.write(content) - except: + if should_notify: + self.show_notification( + _("Variety: Created autostart desktop entry"), + _( + "We created a new desktop entry in ~/.config/autostart. " + "Variety should start automatically on next restart." + ), + ) + except Exception: logger.exception(lambda: "Error while creating autostart desktop entry") self.show_notification( _("Could not create autostart entry"), diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/WallhavenDownloader.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/WallhavenDownloader.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/WallhavenDownloader.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/WallhavenDownloader.py 2019-07-19 02:46:55.000000000 +0000 @@ -17,10 +17,9 @@ import random import urllib.parse -from variety import _ from variety.plugins.downloaders.DefaultDownloader import DefaultDownloader from variety.plugins.downloaders.ImageSource import ImageSource, Throttling -from variety.Util import Util +from variety.Util import Util, _ SEARCH_URL = ( "https://wallhaven.cc/search?q=%s&categories=111&purity=100&sorting=favorites&order=desc" diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/WelcomeDialog.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/WelcomeDialog.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety/WelcomeDialog.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety/WelcomeDialog.py 2019-07-19 02:46:55.000000000 +0000 @@ -16,7 +16,6 @@ from gi.repository import Gtk # pylint: disable=E0611 -from variety import _ from variety_lib.helpers import get_builder diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety.desktop.in variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety.desktop.in --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety.desktop.in 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety.desktop.in 2019-07-19 02:46:55.000000000 +0000 @@ -10,6 +10,7 @@ StartupNotify=false Actions=Next;Previous;PauseResume;History;Preferences; Keywords=Wallpaper;Changer;Change;Download;Downloader;Variety; +StartupWMClass=Variety [Desktop Action Next] Exec=variety --next diff -Nru variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety_lib/helpers.py variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety_lib/helpers.py --- variety-0.7.2~git201907142200.514faa6~ppa828~ubuntu18.10.1/variety_lib/helpers.py 2019-07-15 16:31:33.000000000 +0000 +++ variety-0.7.2~git201907182128.70c6108~ppa836~ubuntu18.10.1/variety_lib/helpers.py 2019-07-19 02:46:55.000000000 +0000 @@ -49,54 +49,6 @@ return "file:///" + media_filename -class NullHandler(logging.Handler): - def emit(self, record): - pass - - -def set_up_logging(verbose): - # add a handler to prevent basicConfig - root = logging.getLogger() - null_handler = NullHandler() - root.addHandler(null_handler) - - formatter = logging.Formatter("%(levelname)s: %(asctime)s: %(funcName)s() '%(message)s'") - - logger = logging.getLogger("variety") - logger_sh = logging.StreamHandler() - logger_sh.setFormatter(formatter) - logger.addHandler(logger_sh) - - try: - logger_file = logging.FileHandler( - os.path.join(os.path.expanduser("~/.config/variety/"), "variety.log"), "w" - ) - logger_file.setFormatter(formatter) - logger.addHandler(logger_file) - except Exception: - logger.exception("Could not create file logger") - - lib_logger = logging.getLogger("variety_lib") - lib_logger_sh = logging.StreamHandler() - lib_logger_sh.setFormatter(formatter) - lib_logger.addHandler(lib_logger_sh) - - logger.setLevel(logging.INFO) - # Set the logging level to show debug messages. - if verbose >= 2: - logger.setLevel(logging.DEBUG) - elif not verbose: - # If we're not in verbose mode, only log these messages to file. This prevents - # flooding syslog and/or ~/.xsession-errors depending on how variety was started: - # (https://bugs.launchpad.net/variety/+bug/1685003) - # XXX: We should /really/ make the internal debug logging use logging.debug, - # this is really just a bandaid patch. - logger_sh.setLevel(logging.WARNING) - - if verbose >= 3: - lib_logger.setLevel(logging.DEBUG) - - def get_help_uri(page=None): # help_uri from source tree - default language here = os.path.dirname(__file__)