diff --git a/gramps/gui/thumbnails.py b/gramps/gen/utils/thumbnails.py similarity index 99% rename from gramps/gui/thumbnails.py rename to gramps/gen/utils/thumbnails.py index 7cb93abed..fbef7fa85 100644 --- a/gramps/gui/thumbnails.py +++ b/gramps/gen/utils/thumbnails.py @@ -36,10 +36,15 @@ from hashlib import md5 # GTK/Gnome modules # #------------------------------------------------------------------------- -from gi.repository import Gtk from gi.repository import GObject from gi.repository import GdkPixbuf +try: + from gi.repository import Gtk + _icon_theme = Gtk.IconTheme.get_default() +except: + _icon_theme = None + #------------------------------------------------------------------------- # # gramps modules @@ -220,7 +225,6 @@ def __create_thumbnail_image(src_file, mtype=None, rectangle=None, # find_mime_type_pixbuf # #------------------------------------------------------------------------- -_icon_theme = Gtk.IconTheme.get_default() def find_mime_type_pixbuf(mime_type): try: diff --git a/gramps/gui/editors/addmedia.py b/gramps/gui/editors/addmedia.py index 40cdc449d..432484628 100644 --- a/gramps/gui/editors/addmedia.py +++ b/gramps/gui/editors/addmedia.py @@ -55,7 +55,7 @@ from gramps.gen.config import config from gramps.gen.utils.file import (media_path_full, media_path, relative_path, find_file) from gramps.gen.mime import get_type -from ..thumbnails import find_mime_type_pixbuf +from gramps.gen.utils.thumbnails import find_mime_type_pixbuf from ..display import display_help from ..managedwindow import ManagedWindow from ..dialog import ErrorDialog, WarningDialog diff --git a/gramps/gui/editors/displaytabs/gallerytab.py b/gramps/gui/editors/displaytabs/gallerytab.py index 65f3db8bc..bd9186f31 100644 --- a/gramps/gui/editors/displaytabs/gallerytab.py +++ b/gramps/gui/editors/displaytabs/gallerytab.py @@ -54,7 +54,7 @@ from gramps.gen.lib import MediaObject, MediaRef from gramps.gen.db import DbTxn from gramps.gen.utils.file import (media_path_full, media_path, relative_path, create_checksum) -from ...thumbnails import get_thumbnail_image +from gramps.gen.utils.thumbnails import get_thumbnail_image from gramps.gen.errors import WindowActiveError from gramps.gen.mime import get_type, is_valid_type from ...ddtargets import DdTargets diff --git a/gramps/gui/editors/editmedia.py b/gramps/gui/editors/editmedia.py index 1c8bd1a8f..45851e3c1 100644 --- a/gramps/gui/editors/editmedia.py +++ b/gramps/gui/editors/editmedia.py @@ -47,7 +47,7 @@ from ..utils import open_file_with_default_application from gramps.gen.lib import MediaObject, NoteType from gramps.gen.db import DbTxn from gramps.gen.mime import get_description, get_type -from ..thumbnails import get_thumbnail_image, find_mime_type_pixbuf +from gramps.gen.utils.thumbnails import get_thumbnail_image, find_mime_type_pixbuf from gramps.gen.utils.file import (media_path_full, find_file, create_checksum) from .editprimary import EditPrimary from ..widgets import (MonitoredDate, MonitoredEntry, PrivacyButton, diff --git a/gramps/gui/editors/editmediaref.py b/gramps/gui/editors/editmediaref.py index 79bd692a6..7d9145499 100644 --- a/gramps/gui/editors/editmediaref.py +++ b/gramps/gui/editors/editmediaref.py @@ -49,7 +49,7 @@ from gramps.gen.constfunc import conv_to_unicode from ..utils import open_file_with_default_application from gramps.gen.const import THUMBSCALE from gramps.gen.mime import get_description, get_type -from ..thumbnails import get_thumbnail_image, find_mime_type_pixbuf +from gramps.gen.utils.thumbnails import get_thumbnail_image, find_mime_type_pixbuf from gramps.gen.utils.file import (media_path_full, find_file, create_checksum) from gramps.gen.lib import NoteType from gramps.gen.db import DbTxn diff --git a/gramps/gui/editors/editperson.py b/gramps/gui/editors/editperson.py index 393e48636..9548b2f31 100644 --- a/gramps/gui/editors/editperson.py +++ b/gramps/gui/editors/editperson.py @@ -51,7 +51,7 @@ from gi.repository import Pango # #------------------------------------------------------------------------- from gramps.gen.utils.file import media_path_full -from ..thumbnails import get_thumbnail_image +from gramps.gen.utils.thumbnails import get_thumbnail_image from ..utils import is_right_click, open_file_with_default_application from gramps.gen.utils.db import get_birth_or_fallback from gramps.gen.lib import NoteType, Person, Surname diff --git a/gramps/gui/selectors/selectobject.py b/gramps/gui/selectors/selectobject.py index c50f15564..b66b9b97e 100644 --- a/gramps/gui/selectors/selectobject.py +++ b/gramps/gui/selectors/selectobject.py @@ -45,7 +45,7 @@ from gi.repository import Gtk #------------------------------------------------------------------------- from gramps.gen.const import THUMBSCALE from gramps.gen.utils.file import media_path_full -from ..thumbnails import get_thumbnail_image +from gramps.gen.utils.thumbnails import get_thumbnail_image from ..views.treemodels import MediaModel from .baseselector import BaseSelector diff --git a/gramps/gui/widgets/photo.py b/gramps/gui/widgets/photo.py index 4ce0d829c..80d0cc631 100644 --- a/gramps/gui/widgets/photo.py +++ b/gramps/gui/widgets/photo.py @@ -31,7 +31,7 @@ from gi.repository import Gtk # Gramps modules # #------------------------------------------------------------------------- -from ..thumbnails import get_thumbnail_image, SIZE_NORMAL, SIZE_LARGE +from gramps.gen.utils.thumbnails import get_thumbnail_image, SIZE_NORMAL, SIZE_LARGE from ..utils import is_right_click, open_file_with_default_application from ..widgets.menuitem import add_menuitem from gramps.gen.const import GRAMPS_LOCALE as glocale diff --git a/gramps/plugins/graph/gvfamilylines.py b/gramps/plugins/graph/gvfamilylines.py index e667ee272..c5a5d50c6 100644 --- a/gramps/plugins/graph/gvfamilylines.py +++ b/gramps/plugins/graph/gvfamilylines.py @@ -51,7 +51,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.translation.gettext from gramps.gen.lib import EventRoleType, EventType, Person, PlaceType from gramps.gen.utils.file import media_path_full -from gramps.gui.thumbnails import get_thumbnail_path +from gramps.gen.utils.thumbnails import get_thumbnail_path from gramps.gen.plug.report import Report from gramps.gen.plug.report import utils as ReportUtils from gramps.gen.plug.report import MenuReportOptions diff --git a/gramps/plugins/graph/gvrelgraph.py b/gramps/plugins/graph/gvrelgraph.py index f3db713f9..c9d7dc7c7 100644 --- a/gramps/plugins/graph/gvrelgraph.py +++ b/gramps/plugins/graph/gvrelgraph.py @@ -56,7 +56,7 @@ from gramps.gen.plug.report import MenuReportOptions from gramps.gen.plug.report import stdoptions from gramps.gen.lib import ChildRefType, EventRoleType, EventType from gramps.gen.utils.file import media_path_full, find_file -from gramps.gui.thumbnails import get_thumbnail_path +from gramps.gen.utils.thumbnails import get_thumbnail_path from gramps.gen.relationship import get_relationship_calculator from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback from gramps.gen.display.place import displayer as place_displayer diff --git a/gramps/plugins/view/pedigreeview.py b/gramps/plugins/view/pedigreeview.py index a643988a2..da339f192 100644 --- a/gramps/plugins/view/pedigreeview.py +++ b/gramps/plugins/view/pedigreeview.py @@ -57,7 +57,7 @@ from gramps.gen.utils.alive import probably_alive from gramps.gen.utils.file import media_path_full from gramps.gen.utils.db import find_children, find_parents, find_witnessed_people from gramps.gen.utils.libformatting import FormattingHelper -from gramps.gui.thumbnails import get_thumbnail_path +from gramps.gen.utils.thumbnails import get_thumbnail_path from gramps.gen.errors import WindowActiveError from gramps.gui.editors import EditPerson, EditFamily from gramps.gui.ddtargets import DdTargets diff --git a/gramps/plugins/view/relview.py b/gramps/plugins/view/relview.py index 28bec2c1c..a0605bbba 100644 --- a/gramps/plugins/view/relview.py +++ b/gramps/plugins/view/relview.py @@ -69,7 +69,7 @@ from gramps.gen.utils.file import media_path_full from gramps.gen.utils.alive import probably_alive from gramps.gui.utils import open_file_with_default_application from gramps.gen.datehandler import displayer, get_date -from gramps.gui.thumbnails import get_thumbnail_image +from gramps.gen.utils.thumbnails import get_thumbnail_image from gramps.gen.config import config from gramps.gui import widgets from gramps.gui.widgets.reorderfam import Reorder diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py index f887ae111..5be5f3461 100644 --- a/gramps/plugins/webreport/narrativeweb.py +++ b/gramps/plugins/webreport/narrativeweb.py @@ -121,7 +121,7 @@ from gramps.gen.utils.alive import probably_alive from gramps.gen.utils.db import get_source_and_citation_referents from gramps.gen.constfunc import win, conv_to_unicode, get_curr_dir from gramps.gen.config import config -from gramps.gui.thumbnails import get_thumbnail_path, run_thumbnailer +from gramps.gen.utils.thumbnails import get_thumbnail_path, run_thumbnailer from gramps.gen.utils.image import image_size, resize_to_jpeg_buffer from gramps.gen.mime import get_description from gramps.gen.display.name import displayer as _nd