GEPS008: Create new module for file utilities
svn: r19906
This commit is contained in:
@@ -59,7 +59,7 @@ import gtk
|
||||
#-------------------------------------------------------------------------
|
||||
from gui.views.navigationview import NavigationView
|
||||
from gui.views.bookmarks import PersonBookmarks
|
||||
import Utils
|
||||
from gen.utils.file import get_empty_tempdir
|
||||
from gen.constfunc import lin, mac, win
|
||||
from gen.config import config
|
||||
from const import TEMP_DIR
|
||||
@@ -92,8 +92,8 @@ def get_identity():
|
||||
# I think we should set the two following variable in const.py
|
||||
# They are used only with gtkmozembed.
|
||||
MOZEMBED_PATH = TEMP_DIR
|
||||
MOZEMBED_SUBPATH = Utils.get_empty_tempdir('mozembed_gramps')
|
||||
GEOVIEW_SUBPATH = Utils.get_empty_tempdir('geoview')
|
||||
MOZEMBED_SUBPATH = get_empty_tempdir('mozembed_gramps')
|
||||
GEOVIEW_SUBPATH = get_empty_tempdir('geoview')
|
||||
NOWEB = 0
|
||||
WEBKIT = 1
|
||||
MOZILLA = 2
|
||||
|
||||
@@ -56,6 +56,7 @@ import const
|
||||
from gen.constfunc import win
|
||||
from gen.config import config
|
||||
import Utils
|
||||
from gen.utils.file import media_path, relative_path, media_path_full
|
||||
from gen.utils.referent import get_media_referents
|
||||
from gui.views.bookmarks import MediaBookmarks
|
||||
import gen.mime
|
||||
@@ -190,9 +191,9 @@ class MediaView(ListView):
|
||||
if not gen.mime.is_valid_type(mime):
|
||||
return
|
||||
photo = gen.lib.MediaObject()
|
||||
base_dir = unicode(Utils.media_path(self.dbstate.db))
|
||||
base_dir = unicode(media_path(self.dbstate.db))
|
||||
if os.path.exists(base_dir):
|
||||
name = Utils.relative_path(name, base_dir)
|
||||
name = relative_path(name, base_dir)
|
||||
photo.set_path(name)
|
||||
photo.set_mime_type(mime)
|
||||
basename = os.path.basename(name)
|
||||
@@ -249,7 +250,7 @@ class MediaView(ListView):
|
||||
"""
|
||||
for handle in self.selected_handles():
|
||||
ref_obj = self.dbstate.db.get_object_from_handle(handle)
|
||||
mpath = Utils.media_path_full(self.dbstate.db, ref_obj.get_path())
|
||||
mpath = media_path_full(self.dbstate.db, ref_obj.get_path())
|
||||
open_file_with_default_application(mpath)
|
||||
|
||||
def open_containing_folder(self, obj):
|
||||
@@ -258,7 +259,7 @@ class MediaView(ListView):
|
||||
"""
|
||||
for handle in self.selected_handles():
|
||||
ref_obj = self.dbstate.db.get_object_from_handle(handle)
|
||||
mpath = Utils.media_path_full(self.dbstate.db, ref_obj.get_path())
|
||||
mpath = media_path_full(self.dbstate.db, ref_obj.get_path())
|
||||
if mpath:
|
||||
mfolder, mfile = os.path.split(mpath)
|
||||
open_file_with_default_application(mfolder)
|
||||
|
||||
@@ -52,8 +52,8 @@ from gui.views.navigationview import NavigationView
|
||||
from gui.editors import FilterEditor
|
||||
from gen.display.name import displayer as name_displayer
|
||||
from gen.utils.alive import probably_alive
|
||||
from Utils import (media_path_full, find_children, find_parents,
|
||||
find_witnessed_people)
|
||||
from gen.utils.file import media_path_full
|
||||
from Utils import find_children, find_parents, find_witnessed_people
|
||||
from libformatting import FormattingHelper
|
||||
from gui.thumbnails import get_thumbnail_path
|
||||
from gen.errors import WindowActiveError
|
||||
|
||||
@@ -52,7 +52,7 @@ from gui.views.navigationview import NavigationView
|
||||
from gui.editors import EditPerson, EditFamily
|
||||
from gui.editors import FilterEditor
|
||||
from gen.display.name import displayer as name_displayer
|
||||
from Utils import media_path_full
|
||||
from gen.utils.file import media_path_full
|
||||
from gen.utils.alive import probably_alive
|
||||
from gui.utils import open_file_with_default_application
|
||||
import gen.datehandler
|
||||
|
||||
Reference in New Issue
Block a user