Added delete functionality after convert to .jpeg image
svn: r17424
This commit is contained in:
parent
66efd796c5
commit
dc66ad12a0
@ -1,6 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# Gramps - a GTK+/GNOME based genealogy program
|
||||||
#
|
#
|
||||||
@ -50,7 +49,7 @@ import gtk
|
|||||||
# GRAMPS modules
|
# GRAMPS modules
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
from QuestionDialog import WarningDialog, QuestionDialog
|
from QuestionDialog import WarningDialog, QuestionDialog, OptionDialog
|
||||||
|
|
||||||
from gen.ggettext import gettext as _
|
from gen.ggettext import gettext as _
|
||||||
|
|
||||||
@ -562,8 +561,16 @@ class EditExifMetadata(Gramplet):
|
|||||||
Handles the Convert question Dialog...
|
Handles the Convert question Dialog...
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# is ImageMagick installled?
|
# if ImageMagick and delete has been found on this computer?
|
||||||
if _MAGICK_FOUND:
|
if (_MAGICK_FOUND and _DEL_FOUND):
|
||||||
|
OptionDialog(_("Edit Image Exif Metadata"), _("WARNING: You are about to convert this "
|
||||||
|
"image into a .jpg image. Are you sure that you want to do this?"),
|
||||||
|
_("Convert and Delete original"), self.convertdelete,
|
||||||
|
_("Convert"), self.convert2Jpeg)
|
||||||
|
|
||||||
|
# is ImageMagick is installed?
|
||||||
|
elif _MAGICK_FOUND:
|
||||||
|
|
||||||
QuestionDialog(_("Edit Image Exif Metadata"), _("Convert this image to a .jpeg image?"),
|
QuestionDialog(_("Edit Image Exif Metadata"), _("Convert this image to a .jpeg image?"),
|
||||||
_("Convert"), self.convert2Jpeg)
|
_("Convert"), self.convert2Jpeg)
|
||||||
|
|
||||||
@ -859,14 +866,28 @@ class EditExifMetadata(Gramplet):
|
|||||||
else:
|
else:
|
||||||
self.exif_widgets["DateTime"].set_text("")
|
self.exif_widgets["DateTime"].set_text("")
|
||||||
|
|
||||||
|
def convertdelete(self):
|
||||||
|
"""
|
||||||
|
will convert2Jpeg and delete original non-jpeg image.
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.convert2Jpeg()
|
||||||
|
|
||||||
|
if system_platform == "linux2":
|
||||||
|
delete = subprocess.check_call( [_DEL_FOUND, "-rf", self.image_path] )
|
||||||
|
else:
|
||||||
|
delete = subprocess.check_call( [_DEL_FOUND, "-y", self.image_path] )
|
||||||
|
delete_result = str(delete)
|
||||||
|
|
||||||
|
if delete_result:
|
||||||
|
self.exif_widgets["Message:Area"].set_text(_("Image has been converted to a .jpg image,\n"
|
||||||
|
"and original image has been deleted!"))
|
||||||
|
|
||||||
def convert2Jpeg(self):
|
def convert2Jpeg(self):
|
||||||
"""
|
"""
|
||||||
Will attempt to convert an image to jpeg if it is not?
|
Will attempt to convert an image to jpeg if it is not?
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# if ImageMagick's convert is installed...
|
|
||||||
if _MAGICK_FOUND:
|
|
||||||
|
|
||||||
filepath, basename = os.path.split(self.image_path)
|
filepath, basename = os.path.split(self.image_path)
|
||||||
basename, oldext = os.path.splitext(self.image_path)
|
basename, oldext = os.path.splitext(self.image_path)
|
||||||
newextension = ".jpeg"
|
newextension = ".jpeg"
|
||||||
|
Loading…
Reference in New Issue
Block a user