GEPS008: Create new module for file utilities
svn: r19906
This commit is contained in:
@@ -64,7 +64,7 @@ from gui.dialog import QuestionDialog, OptionDialog
|
||||
from gen.lib import Date
|
||||
|
||||
import gen.mime
|
||||
import Utils
|
||||
from gen.utils.file import search_for, media_path_full
|
||||
from gen.utils.place import conv_lat_lon
|
||||
|
||||
from gen.db import DbTxn
|
||||
@@ -82,9 +82,9 @@ else:
|
||||
# validate the exiv2 is installed and its executable
|
||||
system_platform = os.sys.platform
|
||||
if system_platform == "win32":
|
||||
EXIV2_FOUND = "exiv2.exe" if Utils.search_for("exiv2.exe") else False
|
||||
EXIV2_FOUND = "exiv2.exe" if search_for("exiv2.exe") else False
|
||||
else:
|
||||
EXIV2_FOUND = "exiv2" if Utils.search_for("exiv2") else False
|
||||
EXIV2_FOUND = "exiv2" if search_for("exiv2") else False
|
||||
if not EXIV2_FOUND:
|
||||
msg = 'You must have exiv2 and its development file installed.'
|
||||
raise SystemExit(msg)
|
||||
@@ -406,7 +406,7 @@ class EditExifMetadata(Gramplet):
|
||||
return
|
||||
|
||||
# get file path and attempt to find it?
|
||||
self.image_path =Utils.media_path_full(db, self.orig_image.get_path() )
|
||||
self.image_path = media_path_full(db, self.orig_image.get_path() )
|
||||
if not os.path.isfile(self.image_path):
|
||||
self.set_has_data(False)
|
||||
return
|
||||
@@ -583,7 +583,7 @@ class EditExifMetadata(Gramplet):
|
||||
if media is None:
|
||||
return False
|
||||
|
||||
full_path = Utils.media_path_full(self.dbstate.db, media.get_path())
|
||||
full_path = media_path_full(self.dbstate.db, media.get_path())
|
||||
return self.view.get_has_data(full_path)
|
||||
|
||||
def __create_button(self, pos, text, callback =[], icon =False, sensitive =False):
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
from gen.plug import Gramplet
|
||||
from gui.widgets import Photo
|
||||
import Utils
|
||||
from gen.utils.file import media_path_full
|
||||
import gtk
|
||||
|
||||
class Gallery(Gramplet):
|
||||
@@ -59,7 +59,7 @@ class Gallery(Gramplet):
|
||||
for media_ref in media_list:
|
||||
media_handle = media_ref.get_reference_handle()
|
||||
media = self.dbstate.db.get_object_from_handle(media_handle)
|
||||
full_path = Utils.media_path_full(self.dbstate.db, media.get_path())
|
||||
full_path = media_path_full(self.dbstate.db, media.get_path())
|
||||
mime_type = media.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
photo = Photo(self.uistate.screen_height() < 1000)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
from gen.plug import Gramplet
|
||||
from gui.widgets import Photo
|
||||
import Utils
|
||||
from gen.utils.file import media_path_full
|
||||
import gtk
|
||||
|
||||
class MediaPreview(Gramplet):
|
||||
@@ -68,7 +68,7 @@ class MediaPreview(Gramplet):
|
||||
"""
|
||||
Load the primary image if it exists.
|
||||
"""
|
||||
self.full_path = Utils.media_path_full(self.dbstate.db,
|
||||
self.full_path = media_path_full(self.dbstate.db,
|
||||
media.get_path())
|
||||
mime_type = media.get_mime_type()
|
||||
self.photo.set_image(self.full_path, mime_type)
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
from libmetadata import MetadataView
|
||||
from gen.plug import Gramplet
|
||||
import Utils
|
||||
from gen.utils.file import media_path_full
|
||||
|
||||
class MetadataViewer(Gramplet):
|
||||
"""
|
||||
@@ -49,7 +49,7 @@ class MetadataViewer(Gramplet):
|
||||
media = self.dbstate.db.get_object_from_handle(active_handle)
|
||||
|
||||
if media:
|
||||
full_path = Utils.media_path_full(self.dbstate.db, media.get_path())
|
||||
full_path = media_path_full(self.dbstate.db, media.get_path())
|
||||
has_data = self.view.display_exif_tags(full_path)
|
||||
self.set_has_data(has_data)
|
||||
else:
|
||||
@@ -67,5 +67,5 @@ class MetadataViewer(Gramplet):
|
||||
if media is None:
|
||||
return False
|
||||
|
||||
full_path = Utils.media_path_full(self.dbstate.db, media.get_path())
|
||||
full_path = media_path_full(self.dbstate.db, media.get_path())
|
||||
return self.view.get_has_data(full_path)
|
||||
|
||||
@@ -25,7 +25,7 @@ from gui.widgets import Photo
|
||||
from gen.display.name import displayer as name_displayer
|
||||
from gen.ggettext import gettext as _
|
||||
import gen.datehandler
|
||||
import Utils
|
||||
from gen.utils.file import media_path_full
|
||||
import gtk
|
||||
import pango
|
||||
|
||||
@@ -223,7 +223,7 @@ class PersonDetails(Gramplet):
|
||||
media_ref = media_list[0]
|
||||
object_handle = media_ref.get_reference_handle()
|
||||
obj = self.dbstate.db.get_object_from_handle(object_handle)
|
||||
full_path = Utils.media_path_full(self.dbstate.db, obj.get_path())
|
||||
full_path = media_path_full(self.dbstate.db, obj.get_path())
|
||||
mime_type = obj.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
self.photo.set_image(full_path, mime_type,
|
||||
|
||||
@@ -23,7 +23,7 @@ from gen.plug import Gramplet
|
||||
from gui.widgets import Photo
|
||||
from gen.ggettext import gettext as _
|
||||
from gen.utils.place import conv_lat_lon
|
||||
import Utils
|
||||
from gen.utils.file import media_path_full
|
||||
import gtk
|
||||
import pango
|
||||
|
||||
@@ -153,7 +153,7 @@ class PlaceDetails(Gramplet):
|
||||
media_ref = media_list[0]
|
||||
object_handle = media_ref.get_reference_handle()
|
||||
obj = self.dbstate.db.get_object_from_handle(object_handle)
|
||||
full_path = Utils.media_path_full(self.dbstate.db, obj.get_path())
|
||||
full_path = media_path_full(self.dbstate.db, obj.get_path())
|
||||
mime_type = obj.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
self.photo.set_image(full_path, mime_type,
|
||||
|
||||
@@ -32,7 +32,7 @@ import posixpath
|
||||
#------------------------------------------------------------------------
|
||||
from gen.plug import Gramplet
|
||||
from gen.ggettext import sgettext as _
|
||||
from Utils import media_path_full
|
||||
from gen.utils.file import media_path_full
|
||||
import gen.datehandler
|
||||
import gen
|
||||
|
||||
|
||||
Reference in New Issue
Block a user