GEPS008: Moved ThumbNails module
svn: r19775
This commit is contained in:
parent
a41b175b09
commit
308f2616ba
@ -10,7 +10,6 @@ src/ImgManip.py
|
||||
src/RecentFiles.py
|
||||
src/Sort.py
|
||||
src/soundex.py
|
||||
src/ThumbNails.py
|
||||
src/TreeTips.py
|
||||
|
||||
# cli
|
||||
@ -233,6 +232,7 @@ src/gui/listmodel.py
|
||||
src/gui/managedwindow.py
|
||||
src/gui/navigator.py
|
||||
src/gui/pluginmanager.py
|
||||
src/gui/thumbnails.py
|
||||
src/gui/user.py
|
||||
|
||||
# gui/editors - the GUI editors package
|
||||
|
@ -34,7 +34,6 @@ gdir_PYTHON = \
|
||||
Sort.py\
|
||||
soundex.py\
|
||||
Spell.py\
|
||||
ThumbNails.py\
|
||||
ToolTips.py\
|
||||
TransUtils.py\
|
||||
TreeTips.py\
|
||||
|
@ -40,6 +40,7 @@ pkgpython_PYTHON = \
|
||||
managedwindow.py \
|
||||
navigator.py \
|
||||
pluginmanager.py \
|
||||
thumbnails.py \
|
||||
tipofday.py \
|
||||
undohistory.py \
|
||||
user.py \
|
||||
|
@ -54,7 +54,7 @@ import const
|
||||
import config
|
||||
import Utils
|
||||
import gen.mime
|
||||
import ThumbNails
|
||||
from gui.thumbnails import find_mime_type_pixbuf
|
||||
from gui.display import display_help
|
||||
from gui.managedwindow import ManagedWindow
|
||||
from gui.dialog import ErrorDialog, WarningDialog
|
||||
@ -201,7 +201,7 @@ class AddMediaObject(ManagedWindow):
|
||||
if mtype and mtype.startswith("image"):
|
||||
image = scale_image(filename, const.THUMBSCALE)
|
||||
else:
|
||||
image = ThumbNails.find_mime_type_pixbuf(mtype)
|
||||
image = find_mime_type_pixbuf(mtype)
|
||||
self.image.set_from_pixbuf(image)
|
||||
|
||||
def _cleanup_on_exit(self):
|
||||
|
@ -53,7 +53,7 @@ from gui.selectors import SelectorFactory
|
||||
import gen.lib
|
||||
from gen.db import DbTxn
|
||||
import Utils
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_image
|
||||
import Errors
|
||||
import gen.mime
|
||||
from gui.ddtargets import DdTargets
|
||||
@ -250,7 +250,7 @@ class GalleryTab(ButtonTab, DbGUIElement):
|
||||
RunDatabaseRepair(
|
||||
_('Non existing media found in the Gallery'))
|
||||
else :
|
||||
pixbuf = ThumbNails.get_thumbnail_image(
|
||||
pixbuf = get_thumbnail_image(
|
||||
Utils.media_path_full(self.dbstate.db,
|
||||
obj.get_path()),
|
||||
obj.get_mime_type(),
|
||||
|
@ -46,7 +46,7 @@ from gui.utils import open_file_with_default_application
|
||||
import gen.lib
|
||||
from gen.db import DbTxn
|
||||
import gen.mime
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_image, find_mime_type_pixbuf
|
||||
import Utils
|
||||
from editprimary import EditPrimary
|
||||
from gui.widgets import (MonitoredDate, MonitoredEntry, PrivacyButton,
|
||||
@ -173,12 +173,12 @@ class EditMedia(EditPrimary):
|
||||
def draw_preview(self):
|
||||
mtype = self.obj.get_mime_type()
|
||||
if mtype:
|
||||
pb = ThumbNails.get_thumbnail_image(
|
||||
pb = get_thumbnail_image(
|
||||
Utils.media_path_full(self.db, self.obj.get_path()),
|
||||
mtype)
|
||||
self.pixmap.set_from_pixbuf(pb)
|
||||
else:
|
||||
pb = ThumbNails.find_mime_type_pixbuf('text/plain')
|
||||
pb = find_mime_type_pixbuf('text/plain')
|
||||
self.pixmap.set_from_pixbuf(pb)
|
||||
|
||||
def setup_filepath(self):
|
||||
|
@ -46,7 +46,7 @@ import gtk
|
||||
from gui.utils import open_file_with_default_application
|
||||
import const
|
||||
import gen.mime
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_image, find_mime_type_pixbuf
|
||||
import Utils
|
||||
from gen.lib import NoteType
|
||||
from gen.db import DbTxn
|
||||
@ -140,13 +140,13 @@ class EditMediaRef(EditReference):
|
||||
mtype = self.source.get_mime_type()
|
||||
if mtype:
|
||||
fullpath = Utils.media_path_full(self.db, self.source.get_path())
|
||||
pb = ThumbNails.get_thumbnail_image(fullpath, mtype)
|
||||
pb = get_thumbnail_image(fullpath, mtype)
|
||||
self.pixmap.set_from_pixbuf(pb)
|
||||
subpix = ThumbNails.get_thumbnail_image(fullpath, mtype,
|
||||
subpix = get_thumbnail_image(fullpath, mtype,
|
||||
self.rectangle)
|
||||
self.subpixmap.set_from_pixbuf(subpix)
|
||||
else:
|
||||
pb = ThumbNails.find_mime_type_pixbuf('text/plain')
|
||||
pb = find_mime_type_pixbuf('text/plain')
|
||||
self.pixmap.set_from_pixbuf(pb)
|
||||
self.subpixmap.set_from_pixbuf(pb)
|
||||
|
||||
|
@ -50,7 +50,7 @@ import pango
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Utils
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_image
|
||||
import gui.utils
|
||||
from gen.utils import get_birth_or_fallback
|
||||
import gen.lib
|
||||
@ -939,7 +939,7 @@ class EditPerson(EditPrimary):
|
||||
"""
|
||||
Load the person's main photo using the Thumbnailer.
|
||||
"""
|
||||
pixbuf = ThumbNails.get_thumbnail_image(
|
||||
pixbuf = get_thumbnail_image(
|
||||
Utils.media_path_full(self.dbstate.db,
|
||||
obj.get_path()),
|
||||
obj.get_mime_type(),
|
||||
|
@ -46,7 +46,7 @@ import gtk
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
from Utils import media_path_full
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_image
|
||||
from gui.views.treemodels import MediaModel
|
||||
from baseselector import BaseSelector
|
||||
|
||||
@ -97,7 +97,6 @@ class SelectObject(BaseSelector):
|
||||
return
|
||||
handle = id_list[0]
|
||||
obj = self.get_from_handle_func()(handle)
|
||||
pix = ThumbNails.get_thumbnail_image(media_path_full(self.db,
|
||||
obj.get_path()))
|
||||
pix = get_thumbnail_image(media_path_full(self.db, obj.get_path()))
|
||||
self.preview.set_from_pixbuf(pix)
|
||||
gc.collect()
|
||||
|
@ -31,7 +31,7 @@ import gtk
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_image, SIZE_NORMAL, SIZE_LARGE
|
||||
from gui.utils import open_file_with_default_application
|
||||
from gen.ggettext import gettext as _
|
||||
|
||||
@ -53,9 +53,9 @@ class Photo(gtk.EventBox):
|
||||
tip = _('Double-click on the picture to view it in the default image '
|
||||
'viewer application.')
|
||||
self.set_tooltip_text(tip)
|
||||
self.__size = ThumbNails.SIZE_LARGE
|
||||
self.__size = SIZE_LARGE
|
||||
if use_small_size:
|
||||
self.__size = ThumbNails.SIZE_NORMAL
|
||||
self.__size = SIZE_NORMAL
|
||||
|
||||
def set_image(self, full_path, mime_type=None, rectangle=None):
|
||||
"""
|
||||
@ -63,10 +63,8 @@ class Photo(gtk.EventBox):
|
||||
"""
|
||||
self.full_path = full_path
|
||||
if full_path:
|
||||
pixbuf = ThumbNails.get_thumbnail_image(full_path,
|
||||
mime_type,
|
||||
rectangle,
|
||||
self.__size)
|
||||
pixbuf = get_thumbnail_image(full_path, mime_type, rectangle,
|
||||
self.__size)
|
||||
self.photo.set_from_pixbuf(pixbuf)
|
||||
self.photo.show()
|
||||
else:
|
||||
|
@ -52,7 +52,7 @@ log = logging.getLogger(".FamilyLines")
|
||||
#------------------------------------------------------------------------
|
||||
import gen.lib
|
||||
import Utils
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_path
|
||||
from gen.datehandler import displayer as _dd
|
||||
from gen.plug.report import Report
|
||||
from gen.plug.report import utils as ReportUtils
|
||||
@ -796,7 +796,7 @@ class FamilyLinesReport(Report):
|
||||
media = self._db.get_object_from_handle(mediaHandle)
|
||||
mediaMimeType = media.get_mime_type()
|
||||
if mediaMimeType[0:5] == "image":
|
||||
imagePath = ThumbNails.get_thumbnail_path(
|
||||
imagePath = get_thumbnail_path(
|
||||
Utils.media_path_full(self._db,
|
||||
media.get_path()),
|
||||
rectangle=mediaList[0].get_rectangle())
|
||||
|
@ -56,7 +56,7 @@ from gen.display.name import displayer as name_displayer
|
||||
import gen.datehandler
|
||||
import gen.lib
|
||||
import Utils
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_path
|
||||
from gen.utils import get_birth_or_fallback, get_death_or_fallback
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -354,7 +354,7 @@ class RelGraphReport(Report):
|
||||
media = self.database.get_object_from_handle(mediaHandle)
|
||||
mediaMimeType = media.get_mime_type()
|
||||
if mediaMimeType[0:5] == "image":
|
||||
imagePath = ThumbNails.get_thumbnail_path(
|
||||
imagePath = get_thumbnail_path(
|
||||
Utils.media_path_full(self.database,
|
||||
media.get_path()),
|
||||
rectangle=mediaList[0].get_rectangle())
|
||||
|
@ -52,7 +52,6 @@ import gtk
|
||||
from gui.utils import open_file_with_default_application
|
||||
from gui.views.listview import ListView
|
||||
from gui.views.treemodels import MediaModel
|
||||
import ThumbNails
|
||||
import const
|
||||
import constfunc
|
||||
import config
|
||||
|
@ -54,7 +54,7 @@ from gen.display.name import displayer as name_displayer
|
||||
from Utils import (media_path_full, probably_alive, find_children,
|
||||
find_parents, find_witnessed_people)
|
||||
from libformatting import FormattingHelper
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_path
|
||||
import Errors
|
||||
from gui.editors import EditPerson, EditFamily
|
||||
from gui.ddtargets import DdTargets
|
||||
@ -152,7 +152,7 @@ class _PersonWidgetBase(gtk.DrawingArea):
|
||||
if obj:
|
||||
mtype = obj.get_mime_type()
|
||||
if mtype and mtype[0:5] == "image":
|
||||
image_path = ThumbNails.get_thumbnail_path(
|
||||
image_path = get_thumbnail_path(
|
||||
media_path_full(
|
||||
dbstate.db,
|
||||
obj.get_path()),
|
||||
|
@ -55,7 +55,7 @@ from gen.display.name import displayer as name_displayer
|
||||
from Utils import media_path_full, probably_alive
|
||||
from gui.utils import open_file_with_default_application
|
||||
import gen.datehandler
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_image
|
||||
import config
|
||||
from gui import widgets
|
||||
from gui.selectors import SelectorFactory
|
||||
@ -668,7 +668,7 @@ class RelationshipView(NavigationView):
|
||||
if image_list:
|
||||
mobj = self.dbstate.db.get_object_from_handle(image_list[0].ref)
|
||||
if mobj and mobj.get_mime_type()[0:5] == "image":
|
||||
pixbuf = ThumbNails.get_thumbnail_image(
|
||||
pixbuf = get_thumbnail_image(
|
||||
media_path_full(self.dbstate.db,
|
||||
mobj.get_path()),
|
||||
rectangle=image_list[0].get_rectangle())
|
||||
|
@ -90,7 +90,7 @@ from gen.plug.report import MenuReportOptions
|
||||
|
||||
import Utils
|
||||
import constfunc
|
||||
import ThumbNails
|
||||
from gui.thumbnails import get_thumbnail_path, run_thumbnailer
|
||||
import ImgManip
|
||||
import gen.mime
|
||||
from gen.display.name import displayer as _nd
|
||||
@ -496,7 +496,7 @@ def copy_thumbnail(report, handle, photo, region=None):
|
||||
)
|
||||
|
||||
if photo.get_mime_type():
|
||||
from_path = ThumbNails.get_thumbnail_path(Utils.media_path_full(
|
||||
from_path = get_thumbnail_path(Utils.media_path_full(
|
||||
report.database,
|
||||
photo.get_path()),
|
||||
photo.get_mime_type(),
|
||||
@ -4005,9 +4005,9 @@ class MediaPage(BasePage):
|
||||
else:
|
||||
dirname = tempfile.mkdtemp()
|
||||
thmb_path = os.path.join(dirname, "document.png")
|
||||
if ThumbNails.run_thumbnailer(mime_type,
|
||||
Utils.media_path_full(self.dbase_, media.get_path()),
|
||||
thmb_path, 320):
|
||||
if run_thumbnailer(mime_type,
|
||||
Utils.media_path_full(self.dbase_, media.get_path()),
|
||||
thmb_path, 320):
|
||||
try:
|
||||
path = self.report.build_path("preview", media.get_handle())
|
||||
npath = os.path.join(path, media.get_handle()) + ".png"
|
||||
|
Loading…
Reference in New Issue
Block a user