2008-02-15 Benny Malengier <benny.malengier@gramps-project.org>

* src/DataViews/RelationView.py
	* src/DataViews/PedigreeView.py
	* src/ReportBase/_ReportUtils.py
	* src/Editors/_EditPerson.py
	* src/Editors/_EditMediaRef.py
	* src/DisplayTabs/_GalleryTab.py: also correct wrong popup menu
	* src/plugins/Summary.py
	* src/plugins/WriteCD.py
	* src/plugins/IndivComplete.py
	* src/plugins/NarrativeWeb.py
	* src/plugins/WritePkg.py
	* src/plugins/GVFamilyLines.py
	* src/plugins/DefaultGramplets.py
	* src/plugins/SimpleBookTitle.py
	* src/plugins/Check.py
	* src/plugins/GVRelGraph.py
	* src/plugins/FamilyLines.py
	* src/Selectors/_SelectObject.py
	* src/GrampsDbUtils/_WriteGedcom.py
	#1787, #1208: use relative path correctly



svn: r10048
This commit is contained in:
Benny Malengier 2008-02-18 14:06:41 +00:00
parent 17ce1638d2
commit 55ba9c4d37
20 changed files with 114 additions and 44 deletions

View File

@ -1,3 +1,25 @@
2008-02-15 Benny Malengier <benny.malengier@gramps-project.org>
* src/DataViews/RelationView.py
* src/DataViews/PedigreeView.py
* src/ReportBase/_ReportUtils.py
* src/Editors/_EditPerson.py
* src/Editors/_EditMediaRef.py
* src/DisplayTabs/_GalleryTab.py: also correct wrong popup menu
* src/plugins/Summary.py
* src/plugins/WriteCD.py
* src/plugins/IndivComplete.py
* src/plugins/NarrativeWeb.py
* src/plugins/WritePkg.py
* src/plugins/GVFamilyLines.py
* src/plugins/DefaultGramplets.py
* src/plugins/SimpleBookTitle.py
* src/plugins/Check.py
* src/plugins/GVRelGraph.py
* src/plugins/FamilyLines.py
* src/Selectors/_SelectObject.py
* src/GrampsDbUtils/_WriteGedcom.py
#1787, #1208: use relative path correctly
2008-02-18 Raphael Ackermann <raphael.ackermann@gmail.com> 2008-02-18 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/GrampsDbUtils/_GedcomParse.py: remove encode_filename() as filename * src/GrampsDbUtils/_GedcomParse.py: remove encode_filename() as filename
is already unicode encoded. is already unicode encoded.

View File

@ -857,7 +857,10 @@ class PedigreeView(PageView.PersonNavView):
if obj: if obj:
mtype = obj.get_mime_type() mtype = obj.get_mime_type()
if mtype and mtype[0:5] == "image": if mtype and mtype[0:5] == "image":
image = ThumbNails.get_thumbnail_path(obj.get_path(), image = ThumbNails.get_thumbnail_path(
Utils.media_path_full(
self.dbstate.db,
obj.get_path()),
rectangle=ph.get_rectangle()) rectangle=ph.get_rectangle())
if cairo_available: if cairo_available:
pw = PersonBoxWidget_cairo( self.format_helper, lst[i][0], lst[i][3], positions[i][0][3], image); pw = PersonBoxWidget_cairo( self.format_helper, lst[i][0], lst[i][3], positions[i][0][3], image);

View File

@ -46,6 +46,7 @@ import gtk
import gen.lib import gen.lib
import PageView import PageView
from BasicUtils import name_displayer from BasicUtils import name_displayer
from Utils import media_path_full
import DateHandler import DateHandler
import ThumbNails import ThumbNails
import Config import Config
@ -577,7 +578,9 @@ class RelationshipView(PageView.PersonNavView):
if image_list: if image_list:
mobj = self.dbstate.db.get_object_from_handle(image_list[0].ref) mobj = self.dbstate.db.get_object_from_handle(image_list[0].ref)
if mobj and mobj.get_mime_type()[0:5] == "image": if mobj and mobj.get_mime_type()[0:5] == "image":
pixbuf = ThumbNails.get_thumbnail_image(mobj.get_path(), pixbuf = ThumbNails.get_thumbnail_image(
media_path_full(self.dbstate.db,
mobj.get_path()),
rectangle=image_list[0].get_rectangle()) rectangle=image_list[0].get_rectangle())
image = gtk.Image() image = gtk.Image()
image.set_from_pixbuf(pixbuf) image.set_from_pixbuf(pixbuf)

View File

@ -90,18 +90,19 @@ class GalleryTab(ButtonTab):
def double_click(self, obj, event): def double_click(self, obj, event):
""" """
Handle the double click on list. Handle the button press event: double click or right click on iconlist.
If the double click occurs, the Edit button handler is called. If the double click occurs, the Edit button handler is called.
""" """
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.edit_button_clicked(obj) self.edit_button_clicked(obj)
return True
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
reflist = self.iconlist.get_selected_items() reflist = self.iconlist.get_selected_items()
if len(reflist) == 1: if len(reflist) == 1:
ref = self.media_list[reflist[0][0]] ref = self.media_list[reflist[0][0]]
self.right_click(ref, event) self.right_click(ref, event)
return True
return
def right_click(self, obj, event): def right_click(self, obj, event):
itemlist = [ itemlist = [
@ -120,7 +121,8 @@ class GalleryTab(ButtonTab):
if app: if app:
item = gtk.MenuItem(_('Open with %s') % app[1]) item = gtk.MenuItem(_('Open with %s') % app[1])
item.connect('activate', make_launcher(app[0], item.connect('activate', make_launcher(app[0],
ref_obj.get_path())) Utils.media_path_full(self.dbstate.db,
ref_obj.get_path())))
item.show() item.show()
menu.append(item) menu.append(item)
item = gtk.SeparatorMenuItem() item = gtk.SeparatorMenuItem()
@ -228,7 +230,9 @@ class GalleryTab(ButtonTab):
RunDatabaseRepair( RunDatabaseRepair(
_('Non existing media found in the Gallery')) _('Non existing media found in the Gallery'))
else : else :
pixbuf = ThumbNails.get_thumbnail_image(obj.get_path(), pixbuf = ThumbNails.get_thumbnail_image(
Utils.media_path_full(self.dbstate.db,
obj.get_path()),
obj.get_mime_type(), obj.get_mime_type(),
ref.get_rectangle()) ref.get_rectangle())
self.iconmodel.append(row=[pixbuf, obj.get_description(), ref]) self.iconmodel.append(row=[pixbuf, obj.get_description(), ref])

View File

@ -43,6 +43,7 @@ import const
import Config import Config
import Mime import Mime
import ThumbNails import ThumbNails
from Utils import media_path_full
from gen.lib import NoteType from gen.lib import NoteType
from DisplayTabs import \ from DisplayTabs import \
@ -98,11 +99,12 @@ class EditMediaRef(EditReference):
the path. the path.
""" """
self.mtype = self.source.get_mime_type() self.mtype = self.source.get_mime_type()
self.pix = ThumbNails.get_thumbnail_image(self.source.get_path(), fullpath = media_path_full(self.db, self.source.get_path())
self.pix = ThumbNails.get_thumbnail_image(fullpath,
self.mtype) self.mtype)
self.pixmap.set_from_pixbuf(self.pix) self.pixmap.set_from_pixbuf(self.pix)
self.subpix = ThumbNails.get_thumbnail_image(self.source.get_path(), self.subpix = ThumbNails.get_thumbnail_image(fullpath,
self.mtype, self.mtype,
self.rectangle) self.rectangle)
self.subpixmap.set_from_pixbuf(self.subpix) self.subpixmap.set_from_pixbuf(self.subpix)
@ -336,7 +338,8 @@ class EditMediaRef(EditReference):
self.subpixmap.hide() self.subpixmap.hide()
else: else:
try: try:
pixbuf = gtk.gdk.pixbuf_new_from_file(path) fullpath = media_path_full(self.db, path)
pixbuf = gtk.gdk.pixbuf_new_from_file(fullpath)
width = pixbuf.get_width() width = pixbuf.get_width()
height = pixbuf.get_height() height = pixbuf.get_height()
upper_x = min(self.rectangle[0], self.rectangle[2])/100. upper_x = min(self.rectangle[0], self.rectangle[2])/100.
@ -390,8 +393,8 @@ class EditMediaRef(EditReference):
mime_type = self.source.get_mime_type() mime_type = self.source.get_mime_type()
app = Mime.get_application(mime_type) app = Mime.get_application(mime_type)
if app: if app:
import Utils from Utils import launch
Utils.launch(app[0],self.source.get_path()) launch(app[0], media_path_full(self.db, self.source.get_path()))
def _connect_signals(self): def _connect_signals(self):
self.define_cancel_button(self.top.get_widget('button84')) self.define_cancel_button(self.top.get_widget('button84'))

View File

@ -424,7 +424,8 @@ class EditPerson(EditPrimary):
been modified. been modified.
""" """
self.load_photo(obj.get_path(), ref.get_rectangle()) self.load_photo(Utils.media_path_full(self.dbstate.db, obj.get_path()),
ref.get_rectangle())
def _image_button_press(self, obj, event): def _image_button_press(self, obj, event):
""" """
@ -754,12 +755,13 @@ class EditPerson(EditPrimary):
photo = media_list[0] photo = media_list[0]
object_handle = photo.get_reference_handle() object_handle = photo.get_reference_handle()
obj = self.db.get_object_from_handle(object_handle) obj = self.db.get_object_from_handle(object_handle)
full_path = Utils.media_path_full(self.dbstate.db, obj.get_path())
#reload if different media, or different rectangle #reload if different media, or different rectangle
if self.load_obj != obj.get_path() or \ if self.load_obj != full_path or \
self.load_rect != photo.get_rectangle(): self.load_rect != photo.get_rectangle():
mime_type = obj.get_mime_type() mime_type = obj.get_mime_type()
if mime_type and mime_type.startswith("image"): if mime_type and mime_type.startswith("image"):
self.load_photo(obj.get_path(), photo.get_rectangle()) self.load_photo(full_path, photo.get_rectangle())
else: else:
self.load_photo(None) self.load_photo(None)
else: else:

View File

@ -41,6 +41,7 @@ import _GedcomInfo as GedcomInfo
import Errors import Errors
import ExportOptions import ExportOptions
import BasicUtils import BasicUtils
from Utils import media_path_full
import gen.proxy import gen.proxy
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
@ -1345,7 +1346,7 @@ class GedcomWriter(BasicUtils.UpdateCallback):
if photo_obj: if photo_obj:
mime = photo_obj.get_mime_type() mime = photo_obj.get_mime_type()
form = MIME2GED.get(mime, mime) form = MIME2GED.get(mime, mime)
path = photo_obj.get_path() path = media_path_full(self.dbase, photo_obj.get_path())
if not os.path.isfile(path): if not os.path.isfile(path):
return return
self.__writeln(level, 'OBJE') self.__writeln(level, 'OBJE')

View File

@ -43,6 +43,7 @@ from gettext import gettext as _
import DateHandler import DateHandler
import gen.lib import gen.lib
from BasicUtils import name_displayer as _nd from BasicUtils import name_displayer as _nd
from Utils import media_path_full
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
import BaseDoc import BaseDoc
@ -1566,7 +1567,7 @@ def insert_image(database, doc, photo, w_cm=4.0, h_cm=4.0):
media_object = database.get_object_from_handle(object_handle) media_object = database.get_object_from_handle(object_handle)
mime_type = media_object.get_mime_type() mime_type = media_object.get_mime_type()
if mime_type and mime_type.startswith("image"): if mime_type and mime_type.startswith("image"):
filename = media_object.get_path() filename = media_path_full(database, media_object.get_path())
if os.path.exists(filename): if os.path.exists(filename):
doc.add_media_object(filename, "right", w_cm, h_cm) doc.add_media_object(filename, "right", w_cm, h_cm)
else: else:

View File

@ -44,6 +44,7 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
from Utils import media_path_full
import ThumbNails import ThumbNails
from DisplayModels import MediaModel from DisplayModels import MediaModel
from _BaseSelector import BaseSelector from _BaseSelector import BaseSelector
@ -90,7 +91,8 @@ class SelectObject(BaseSelector):
return return
handle = id_list[0] handle = id_list[0]
obj = self.get_from_handle_func()(handle) obj = self.get_from_handle_func()(handle)
pix = ThumbNails.get_thumbnail_image(obj.get_path()) pix = ThumbNails.get_thumbnail_image(media_path_full(self.db,
obj.get_path()))
self.preview.set_from_pixbuf(pix) self.preview.set_from_pixbuf(pix)
gc.collect() gc.collect()

View File

@ -540,7 +540,7 @@ class CheckIntegrity:
for ObjectId in self.db.get_media_object_handles(): for ObjectId in self.db.get_media_object_handles():
obj = self.db.get_object_from_handle(ObjectId) obj = self.db.get_object_from_handle(ObjectId)
photo_name = obj.get_path() photo_name = Utils.media_path_full(self.db, obj.get_path())
if photo_name is not None and photo_name != "" and not Utils.find_file(photo_name): if photo_name is not None and photo_name != "" and not Utils.find_file(photo_name):
if cl: if cl:
print "Warning: media file %s was not found." \ print "Warning: media file %s was not found." \

View File

@ -25,6 +25,7 @@ import urllib
import gen.lib import gen.lib
from DataViews import register, Gramplet from DataViews import register, Gramplet
from BasicUtils import name_displayer from BasicUtils import name_displayer
from Utils import media_path_full
from QuickReports import run_quick_report_by_name from QuickReports import run_quick_report_by_name
import DateHandler import DateHandler
from gettext import gettext as _ from gettext import gettext as _
@ -474,8 +475,9 @@ class StatsGramplet(Gramplet):
pobjects = len(database.get_media_object_handles()) pobjects = len(database.get_media_object_handles())
for photo_id in database.get_media_object_handles(): for photo_id in database.get_media_object_handles():
photo = database.get_object_from_handle(photo_id) photo = database.get_object_from_handle(photo_id)
fullname = media_path_full(database, photo.get_path())
try: try:
bytes = bytes + posixpath.getsize(photo.get_path()) bytes = bytes + posixpath.getsize(fullname)
except: except:
notfound.append(photo.get_path()) notfound.append(photo.get_path())

View File

@ -582,7 +582,9 @@ class FamilyLinesReport(Report):
media = self.db.get_object_from_handle(mediaHandle) media = self.db.get_object_from_handle(mediaHandle)
mediaMimeType = media.get_mime_type() mediaMimeType = media.get_mime_type()
if mediaMimeType[0:5] == "image": if mediaMimeType[0:5] == "image":
imagePath = ThumbNails.get_thumbnail_path(media.get_path()) imagePath = ThumbNails.get_thumbnail_path(
Utils.media_path_full(self.db,
media.get_path()))
# put the label together and ouput this person # put the label together and ouput this person
label = u"" label = u""

View File

@ -720,7 +720,10 @@ class FamilyLinesReport(Report):
media = self.db.get_object_from_handle(mediaHandle) media = self.db.get_object_from_handle(mediaHandle)
mediaMimeType = media.get_mime_type() mediaMimeType = media.get_mime_type()
if mediaMimeType[0:5] == "image": if mediaMimeType[0:5] == "image":
imagePath = ThumbNails.get_thumbnail_path(media.get_path()) imagePath = ThumbNails.get_thumbnail_path(
Utils.media_path_full(self.db,
media.get_path())
)
# put the label together and ouput this person # put the label together and ouput this person
label = u"" label = u""

View File

@ -302,7 +302,9 @@ class RelGraphReport(Report):
media = self.database.get_object_from_handle(mediaHandle) media = self.database.get_object_from_handle(mediaHandle)
mediaMimeType = media.get_mime_type() mediaMimeType = media.get_mime_type()
if mediaMimeType[0:5] == "image": if mediaMimeType[0:5] == "image":
imagePath = ThumbNails.get_thumbnail_path(media.get_path()) imagePath = ThumbNails.get_thumbnail_path(
Utils.media_path_full(self.database,
media.get_path()))
#test if thumbnail actually exists in thumbs (import of data means media files might not be present #test if thumbnail actually exists in thumbs (import of data means media files might not be present
imagePath = Utils.find_file(imagePath) imagePath = Utils.find_file(imagePath)

View File

@ -43,6 +43,7 @@ from ReportBase import Report, ReportUtils, MenuReportOptions, \
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
from ReportBase import Bibliography, Endnotes from ReportBase import Bibliography, Endnotes
from BasicUtils import name_displayer as _nd from BasicUtils import name_displayer as _nd
from Utils import media_path_full
from QuestionDialog import WarningDialog from QuestionDialog import WarningDialog
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -410,7 +411,7 @@ class IndivCompleteReport(Report):
object = self.database.get_object_from_handle(object_handle) object = self.database.get_object_from_handle(object_handle)
mime_type = object.get_mime_type() mime_type = object.get_mime_type()
if mime_type and mime_type.startswith("image"): if mime_type and mime_type.startswith("image"):
filename = object.get_path() filename = media_path_full(self.database, object.get_path())
if os.path.exists(filename): if os.path.exists(filename):
self.doc.start_paragraph("IDS-Normal") self.doc.start_paragraph("IDS-Normal")
self.doc.add_media_object(filename, "center", 4.0, 4.0) self.doc.add_media_object(filename, "center", 4.0, 4.0)

View File

@ -1132,7 +1132,8 @@ class MediaPage(BasePage):
# image; most web browsers will dynamically resize an image # image; most web browsers will dynamically resize an image
# and provide zoom-in/zoom-out functionality when the image # and provide zoom-in/zoom-out functionality when the image
# is displayed directly # is displayed directly
(width, height) = ImgManip.image_size(photo.get_path()) (width, height) = ImgManip.image_size(
Utils.media_path_full(self.db, photo.get_path()))
scale = 1.0 scale = 1.0
if width > _MAX_IMG_WIDTH or height > _MAX_IMG_HEIGHT: if width > _MAX_IMG_WIDTH or height > _MAX_IMG_HEIGHT:
# image is too large -- scale it down and link to the full image # image is too large -- scale it down and link to the full image
@ -1155,7 +1156,10 @@ class MediaPage(BasePage):
dirname = tempfile.mkdtemp() dirname = tempfile.mkdtemp()
thmb_path = os.path.join(dirname,"temp.png") thmb_path = os.path.join(dirname,"temp.png")
if ThumbNails.run_thumbnailer(mime_type, photo.get_path(), thmb_path, 320): if ThumbNails.run_thumbnailer(mime_type,
Utils.media_path_full(self.db,
photo.get_path()),
thmb_path, 320):
try: try:
path = "%s/%s.png" % (self.build_path(photo.handle,"preview"),photo.handle) path = "%s/%s.png" % (self.build_path(photo.handle,"preview"),photo.handle)
self.store_file(archive, self.html_dir, thmb_path, path) self.store_file(archive, self.html_dir, thmb_path, path)
@ -1236,14 +1240,15 @@ class MediaPage(BasePage):
to_dir = self.build_path(handle,'images') to_dir = self.build_path(handle,'images')
newpath = to_dir + "/" + handle + ext newpath = to_dir + "/" + handle + ext
fullpath = Utils.media_path_full(self.db, photo.get_path())
try: try:
if self.archive: if self.archive:
self.archive.add(photo.get_path(),str(newpath)) self.archive.add(fullpath,str(newpath))
else: else:
to_dir = os.path.join(self.html_dir,to_dir) to_dir = os.path.join(self.html_dir,to_dir)
if not os.path.isdir(to_dir): if not os.path.isdir(to_dir):
os.makedirs(to_dir) os.makedirs(to_dir)
shutil.copyfile(photo.get_path(), shutil.copyfile(fullpath,
os.path.join(self.html_dir,newpath)) os.path.join(self.html_dir,newpath))
return newpath return newpath
except (IOError,OSError),msg: except (IOError,OSError),msg:
@ -1256,7 +1261,10 @@ class MediaPage(BasePage):
to_dir = self.build_path(handle,'thumb') to_dir = self.build_path(handle,'thumb')
to_path = os.path.join(to_dir,handle+".png") to_path = os.path.join(to_dir,handle+".png")
if photo.get_mime_type(): if photo.get_mime_type():
from_path = ThumbNails.get_thumbnail_path(photo.get_path(),photo.get_mime_type()) from_path = ThumbNails.get_thumbnail_path(Utils.media_path_full(
self.db,
photo.get_path()),
photo.get_mime_type())
if not os.path.isfile(from_path): if not os.path.isfile(from_path):
from_path = os.path.join(const.IMAGE_DIR,"document.png") from_path = os.path.join(const.IMAGE_DIR,"document.png")
else: else:
@ -1385,7 +1393,9 @@ class IntroductionPage(BasePage):
if mime_type and mime_type.startswith("image"): if mime_type and mime_type.startswith("image"):
try: try:
(newpath, thumb_path) = self.copy_media(obj, False) (newpath, thumb_path) = self.copy_media(obj, False)
self.store_file(archive, self.html_dir, obj.get_path(), self.store_file(archive, self.html_dir,
Utils.media_path_full(db,
obj.get_path()),
newpath) newpath)
of.write('<div class="centered">\n') of.write('<div class="centered">\n')
of.write('<img ') of.write('<img ')
@ -1432,7 +1442,9 @@ class HomePage(BasePage):
if mime_type and mime_type.startswith("image"): if mime_type and mime_type.startswith("image"):
try: try:
(newpath,thumb_path) = self.copy_media(obj,False) (newpath,thumb_path) = self.copy_media(obj,False)
self.store_file(archive, self.html_dir, obj.get_path(), self.store_file(archive, self.html_dir,
Utils.media_path_full(db,
obj.get_path()),
newpath) newpath)
of.write('<div class="centered">\n') of.write('<div class="centered">\n')
of.write('<img ') of.write('<img ')
@ -1642,7 +1654,9 @@ class ContactPage(BasePage):
if mime_type and mime_type.startswith("image"): if mime_type and mime_type.startswith("image"):
try: try:
(newpath, thumb_path) = self.copy_media(obj, False) (newpath, thumb_path) = self.copy_media(obj, False)
self.store_file(archive, self.html_dir, obj.get_path(), self.store_file(archive, self.html_dir,
Utils.media_path_full(db,
obj.get_path()),
newpath) newpath)
of.write('<div class="rightwrap">\n') of.write('<div class="rightwrap">\n')

View File

@ -41,6 +41,7 @@ import gtk
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from PluginUtils import register_report from PluginUtils import register_report
from Utils import media_path_full
from ReportBase import Report, ReportOptions, CATEGORY_TEXT, MODE_BKI from ReportBase import Report, ReportOptions, CATEGORY_TEXT, MODE_BKI
import BaseDoc import BaseDoc
from Selectors import selector_factory from Selectors import selector_factory
@ -95,7 +96,7 @@ class SimpleBookTitle(Report):
if self.object_id: if self.object_id:
the_object = self.database.get_object_from_gramps_id(self.object_id) the_object = self.database.get_object_from_gramps_id(self.object_id)
name = the_object.get_path() name = media_path_full(self.database, the_object.get_path())
if self.image_size: if self.image_size:
image_size = self.image_size image_size = self.image_size
else: else:
@ -253,7 +254,8 @@ class SimpleBookTitleOptions(ReportOptions):
return return
self.options_dict['imgid'] = the_object.get_gramps_id() self.options_dict['imgid'] = the_object.get_gramps_id()
self.obj_title.set_text(the_object.get_description()) self.obj_title.set_text(the_object.get_description())
icon_image = ThumbNails.get_thumbnail_image(the_object.get_path(), icon_image = ThumbNails.get_thumbnail_image(
media_path_full(database, the_object.get_path()),
the_object.get_mime_type()) the_object.get_mime_type())
self.preview.set_from_pixbuf(icon_image) self.preview.set_from_pixbuf(icon_image)
self.remove_obj_button.set_sensitive(True) self.remove_obj_button.set_sensitive(True)

View File

@ -45,6 +45,7 @@ import gtk.glade
#------------------------------------------------------------------------ #------------------------------------------------------------------------
import gen.lib import gen.lib
from PluginUtils import register_report from PluginUtils import register_report
from Utils import media_path_full
from ReportBase import CATEGORY_VIEW, MODE_GUI from ReportBase import CATEGORY_VIEW, MODE_GUI
import DateHandler import DateHandler
import ManagedWindow import ManagedWindow
@ -75,7 +76,8 @@ def build_report(database,person):
for photo_id in database.get_media_object_handles(): for photo_id in database.get_media_object_handles():
photo = database.get_object_from_handle(photo_id) photo = database.get_object_from_handle(photo_id)
try: try:
bytes = bytes + posixpath.getsize(photo.get_path()) bytes = bytes + posixpath.getsize(media_path_full(database,
photo.get_path()))
except: except:
notfound.append(photo.get_path()) notfound.append(photo.get_path())

View File

@ -74,6 +74,7 @@ except:
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from GrampsDbUtils import XmlWriter from GrampsDbUtils import XmlWriter
from Utils import media_path_full
from QuestionDialog import ErrorDialog, MissingMediaDialog from QuestionDialog import ErrorDialog, MissingMediaDialog
from PluginUtils import register_export from PluginUtils import register_export
@ -125,7 +126,7 @@ class PackageWriter:
for obj_id in self.db.get_media_object_handles(): for obj_id in self.db.get_media_object_handles():
obj = self.db.get_object_from_handle(obj_id) obj = self.db.get_object_from_handle(obj_id)
oldfile = obj.get_path() oldfile = media_path_full(self.db, obj.get_path())
root = os.path.basename(oldfile) root = os.path.basename(oldfile)
if os.path.isfile(oldfile): if os.path.isfile(oldfile):
self.copy_file(oldfile, 'burn:///%s/%s' % (base, root)) self.copy_file(oldfile, 'burn:///%s/%s' % (base, root))
@ -246,7 +247,7 @@ class PackageWriter:
for obj_id in self.db.get_media_object_handles(): for obj_id in self.db.get_media_object_handles():
obj = self.db.get_object_from_handle(obj_id) obj = self.db.get_object_from_handle(obj_id)
oldfile = obj.get_path() oldfile = media_path_full(self.db, obj.get_path())
root = os.path.basename(oldfile) root = os.path.basename(oldfile)
if os.path.isfile(oldfile): if os.path.isfile(oldfile):
self.copy_file(oldfile, 'burn:///%s/%s' % (base, root)) self.copy_file(oldfile, 'burn:///%s/%s' % (base, root))

View File

@ -175,7 +175,7 @@ class PackageWriter:
# during the process (i.e. when removing object) # during the process (i.e. when removing object)
for m_id in self.db.get_media_object_handles(): for m_id in self.db.get_media_object_handles():
mobject = self.db.get_object_from_handle(m_id) mobject = self.db.get_object_from_handle(m_id)
filename = str(mobject.get_path()) filename = str(Utils.media_path_full(self.db, mobject.get_path()))
if os.path.isfile(filename): if os.path.isfile(filename):
archive.add(filename) archive.add(filename)
# else: # else: