* src/DbPrompter.py: gnome.vfs vs. gnomevfs, tolerence
* src/GrampsMime.py: gnome.vfs vs. gnomevfs tolerence * src/ImageSelect.py: gnome.canvas vs. gnomecanvas tolerence * src/NameDisplay.py: gnome.vfs vs. gnomevfs tolerence * src/PedView.py: gnome.canvas vs. gnomecanvas tolerence * src/Utils.py: remove mime handling, use GrampsMime * src/plugins/WriteCD.py: gnome.vfs vs. gnomevfs tolerence svn: r3971
This commit is contained in:
parent
4cc40c0f34
commit
43bcff24ed
@ -1,3 +1,12 @@
|
||||
2005-01-26 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/DbPrompter.py: gnome.vfs vs. gnomevfs, tolerence
|
||||
* src/GrampsMime.py: gnome.vfs vs. gnomevfs tolerence
|
||||
* src/ImageSelect.py: gnome.canvas vs. gnomecanvas tolerence
|
||||
* src/NameDisplay.py: gnome.vfs vs. gnomevfs tolerence
|
||||
* src/PedView.py: gnome.canvas vs. gnomecanvas tolerence
|
||||
* src/Utils.py: remove mime handling, use GrampsMime
|
||||
* src/plugins/WriteCD.py: gnome.vfs vs. gnomevfs tolerence
|
||||
|
||||
2005-01-25 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/ReportUtils.py: allow start and stop event handle selection
|
||||
for age estimation
|
||||
|
@ -38,6 +38,11 @@ import gtk.glade
|
||||
import gobject
|
||||
import gnome
|
||||
|
||||
try:
|
||||
from gnomevfs import get_mime_type
|
||||
except:
|
||||
from gnome.vfs import get_mime_type
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
@ -174,7 +179,7 @@ class ExistingDbPrompter:
|
||||
response = choose.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
filename = choose.get_filename()
|
||||
filetype = gnome.vfs.get_mime_type(filename)
|
||||
filetype = get_mime_type(filename)
|
||||
(the_path,the_file) = os.path.split(filename)
|
||||
choose.destroy()
|
||||
if open_native(self.parent,filename,filetype):
|
||||
@ -269,7 +274,7 @@ class ImportDbPrompter:
|
||||
response = choose.run()
|
||||
if response == gtk.RESPONSE_OK:
|
||||
filename = choose.get_filename()
|
||||
filetype = gnome.vfs.get_mime_type(filename)
|
||||
filetype = get_mime_type(filename)
|
||||
# FIXME: Uncomment when we have grdb importer
|
||||
#
|
||||
# if filetype == 'application/x-gramps':
|
||||
|
@ -18,14 +18,18 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import gnome.vfs
|
||||
try:
|
||||
from gnomevfs import mime_get_short_list_applications, mime_get_description, get_mime_type
|
||||
except:
|
||||
from gnome.vfs import mime_get_short_list_applications, mime_get_description, get_mime_type
|
||||
|
||||
from gettext import gettext as _
|
||||
|
||||
def get_application(type):
|
||||
"""Returns the application command and application name of the
|
||||
specified mime type"""
|
||||
try:
|
||||
applist = gnome.vfs.mime_get_short_list_applications(type)
|
||||
applist = mime_get_short_list_applications(type)
|
||||
if applist:
|
||||
prog = applist[0]
|
||||
return (prog[2],prog[1])
|
||||
@ -37,13 +41,13 @@ def get_application(type):
|
||||
def get_description(type):
|
||||
"""Returns the description of the specfied mime type"""
|
||||
try:
|
||||
return gnome.vfs.mime_get_description(type)
|
||||
return mime_get_description(type)
|
||||
except:
|
||||
return _("unknown")
|
||||
|
||||
def get_type(file):
|
||||
"""Returns the mime type of the specified file"""
|
||||
try:
|
||||
return gnome.vfs.get_mime_type(file)
|
||||
return get_mime_type(file)
|
||||
except:
|
||||
return _('unknown')
|
||||
|
@ -37,9 +37,13 @@ from gettext import gettext as _
|
||||
import gtk
|
||||
import gnome
|
||||
import gnome.ui
|
||||
import gnome.canvas
|
||||
import gtk.glade
|
||||
|
||||
try:
|
||||
from gnomecanvas import CanvasGroup, CanvasRect, CanvasPixbuf, CanvasText
|
||||
except:
|
||||
from gnome.canvas import CanvasGroup, CanvasRect, CanvasPixbuf, CanvasText
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
@ -386,18 +390,18 @@ class Gallery(ImageSelect):
|
||||
x = image.get_width()
|
||||
y = image.get_height()
|
||||
|
||||
grp = self.root.add(gnome.canvas.CanvasGroup,x=self.cx,y=self.cy)
|
||||
grp = self.root.add(CanvasGroup,x=self.cx,y=self.cy)
|
||||
|
||||
xloc = (_IMAGEX-x)/2
|
||||
yloc = (_IMAGEY-y)/2
|
||||
|
||||
style = self.iconlist.get_style()
|
||||
|
||||
box = grp.add(gnome.canvas.CanvasRect,x1=0,x2=_IMAGEX,y1=_IMAGEY-20,
|
||||
box = grp.add(CanvasRect,x1=0,x2=_IMAGEX,y1=_IMAGEY-20,
|
||||
y2=_IMAGEY, fill_color_gdk=style.bg[gtk.STATE_NORMAL])
|
||||
item = grp.add(gnome.canvas.CanvasPixbuf,
|
||||
item = grp.add(CanvasPixbuf,
|
||||
pixbuf=image,x=xloc, y=yloc)
|
||||
text = grp.add(gnome.canvas.CanvasText, x=_IMAGEX/2,
|
||||
text = grp.add(CanvasText, x=_IMAGEX/2,
|
||||
anchor=gtk.ANCHOR_CENTER,
|
||||
justification=gtk.JUSTIFY_CENTER,
|
||||
y=_IMAGEY-10, text=description)
|
||||
|
@ -74,9 +74,9 @@ class NameDisplay:
|
||||
"""
|
||||
name = person.get_primary_name()
|
||||
if name.display_as == RelLib.Name.FNLN:
|
||||
return self._lnfn(name)
|
||||
else:
|
||||
return self._fnln(name)
|
||||
else:
|
||||
return self._lnfn(name)
|
||||
|
||||
def sorted_name(self,name):
|
||||
"""
|
||||
@ -89,7 +89,7 @@ class NameDisplay:
|
||||
@returns: Returns the L{RelLib.Name} string representation
|
||||
@rtype: str
|
||||
"""
|
||||
if name.sort_as == RelLib.Name.FNLN:
|
||||
if name.get_sort_as() == RelLib.Name.FNLN:
|
||||
return self._fnln(name)
|
||||
else:
|
||||
return self._lnfn(name)
|
||||
|
@ -27,9 +27,13 @@
|
||||
#-------------------------------------------------------------------------
|
||||
import gtk
|
||||
import gtk.gdk
|
||||
import gnome.canvas
|
||||
import pango
|
||||
|
||||
try:
|
||||
from gnomecanvas import CanvasGroup, CanvasRect, CanvasText, CanvasWidget, CanvasLine
|
||||
except:
|
||||
from gnome.canvas import CanvasGroup, CanvasRect, CanvasText, CanvasWidget, CanvasLine
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps Modules
|
||||
|
@ -54,6 +54,7 @@ import DisplayTrace
|
||||
from ansel_utf8 import ansel_to_utf8
|
||||
import latin_utf8
|
||||
import Utils
|
||||
import GrampsMime
|
||||
from GedcomInfo import *
|
||||
from QuestionDialog import ErrorDialog
|
||||
from gettext import gettext as _
|
||||
@ -1150,7 +1151,7 @@ class GedcomParser:
|
||||
photo = RelLib.MediaObject()
|
||||
photo.set_path(path)
|
||||
photo.set_description(title)
|
||||
photo.set_mime_type(Utils.get_mime_type(os.path.abspath(path)))
|
||||
photo.set_mime_type(GrampsMime.get_type(os.path.abspath(path)))
|
||||
self.db.add_object(photo, self.trans)
|
||||
self.media_map[path] = photo.get_handle()
|
||||
else:
|
||||
@ -1192,7 +1193,7 @@ class GedcomParser:
|
||||
photo = RelLib.MediaObject()
|
||||
photo.set_path(path)
|
||||
photo.set_description(title)
|
||||
photo.set_mime_type(Utils.get_mime_type(os.path.abspath(path)))
|
||||
photo.set_mime_type(GrampsMime.get_type(os.path.abspath(path)))
|
||||
self.db.add_object(photo, self.trans)
|
||||
oref = RelLib.MediaRef()
|
||||
oref.set_reference_handle(photo.get_handle())
|
||||
|
13
src/Utils.py
13
src/Utils.py
@ -36,6 +36,11 @@ import locale
|
||||
import gtk
|
||||
import gnome
|
||||
|
||||
try:
|
||||
from gnomevfs import get_mime_type, mime_get_description
|
||||
except:
|
||||
from gnome.vfs import get_mime_type, mime_get_description
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps modules
|
||||
@ -263,15 +268,9 @@ def find_icon(mtype):
|
||||
else:
|
||||
return const.icon
|
||||
|
||||
def get_mime_type(file):
|
||||
try:
|
||||
return gnome.vfs.get_mime_type(file)
|
||||
except:
|
||||
return "unknown"
|
||||
|
||||
def get_mime_description(mime_type):
|
||||
try:
|
||||
value = gnome.vfs.mime_get_description(mime_type)
|
||||
value = mime_get_description(mime_type)
|
||||
if value:
|
||||
return value
|
||||
else:
|
||||
|
@ -38,7 +38,11 @@ from cStringIO import StringIO
|
||||
import gtk
|
||||
import gtk.glade
|
||||
import gnome
|
||||
import gnome.vfs
|
||||
|
||||
try:
|
||||
from gnomevfs import URI, create, OPEN_WRITE, make_directory, FileExistsError
|
||||
except:
|
||||
from gnome.vfs import URI, create, OPEN_WRITE, make_directory, FileExistsError
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -47,6 +51,7 @@ import gnome.vfs
|
||||
#-------------------------------------------------------------------------
|
||||
import WriteXML
|
||||
import Utils
|
||||
import GrampsMime
|
||||
import const
|
||||
import QuestionDialog
|
||||
import ImgManip
|
||||
@ -101,8 +106,8 @@ class PackageWriter:
|
||||
|
||||
def copy_file(self,src,dest):
|
||||
original = open(src,"r")
|
||||
destobj = gnome.vfs.URI(dest)
|
||||
target = gnome.vfs.create(destobj,gnome.vfs.OPEN_WRITE)
|
||||
destobj = URI(dest)
|
||||
target = create(destobj,OPEN_WRITE)
|
||||
done = 0
|
||||
while 1:
|
||||
buf = original.read(2048)
|
||||
@ -117,8 +122,8 @@ class PackageWriter:
|
||||
img = ImgManip.ImgManip(path)
|
||||
data = img.jpg_scale_data(const.thumbScale,const.thumbScale)
|
||||
|
||||
uri = gnome.vfs.URI('burn:///%s/.thumb/%s.jpg' % (dbname,root))
|
||||
th = gnome.vfs.create(uri,gnome.vfs.OPEN_WRITE)
|
||||
uri = URI('burn:///%s/.thumb/%s.jpg' % (dbname,root))
|
||||
th = create(uri,OPEN_WRITE)
|
||||
th.write(data)
|
||||
th.close()
|
||||
|
||||
@ -126,9 +131,9 @@ class PackageWriter:
|
||||
base = os.path.basename(self.name)
|
||||
|
||||
try:
|
||||
uri = gnome.vfs.URI('burn:///%s' % base)
|
||||
gnome.vfs.make_directory(uri,gnome.vfs.OPEN_WRITE)
|
||||
except gnome.vfs.FileExistsError, msg:
|
||||
uri = URI('burn:///%s' % base)
|
||||
make_directory(uri,OPEN_WRITE)
|
||||
except FileExistsError, msg:
|
||||
QuestionDialog.ErrorDialog(_("CD export preparation failed"),
|
||||
"1 %s " % str(msg))
|
||||
return
|
||||
@ -138,9 +143,9 @@ class PackageWriter:
|
||||
return
|
||||
|
||||
try:
|
||||
uri = gnome.vfs.URI('burn:///%s/.thumb' % base)
|
||||
gnome.vfs.make_directory(uri,gnome.vfs.OPEN_WRITE)
|
||||
except gnome.vfs.FileExistsError, msg:
|
||||
uri = URI('burn:///%s/.thumb' % base)
|
||||
make_directory(uri,OPEN_WRITE)
|
||||
except FileExistsError, msg:
|
||||
QuestionDialog.ErrorDialog("CD export preparation failed",
|
||||
"2 %s " % str(msg))
|
||||
return
|
||||
@ -158,7 +163,7 @@ class PackageWriter:
|
||||
"so it was ignored."
|
||||
|
||||
# Write XML now
|
||||
g = gnome.vfs.create('burn:///%s/data.gramps' % base,gnome.vfs.OPEN_WRITE )
|
||||
g = create('burn:///%s/data.gramps' % base,OPEN_WRITE )
|
||||
gfile = WriteXML.XmlWriter(self.db,None,1)
|
||||
gfile.write_handle(g)
|
||||
g.close()
|
||||
@ -174,9 +179,9 @@ class PackageWriter:
|
||||
base = os.path.basename(self.db.get_save_path())
|
||||
|
||||
try:
|
||||
uri = gnome.vfs.URI('burn:///%s' % base)
|
||||
gnome.vfs.make_directory(uri,gnome.vfs.OPEN_WRITE)
|
||||
except gnome.vfs.FileExistsError:
|
||||
uri = URI('burn:///%s' % base)
|
||||
make_directory(uri,OPEN_WRITE)
|
||||
except FileExistsError:
|
||||
QuestionDialog.ErrorDialog(_("CD export preparation failed"),
|
||||
"File already exists")
|
||||
return
|
||||
@ -186,9 +191,9 @@ class PackageWriter:
|
||||
return
|
||||
|
||||
try:
|
||||
uri = gnome.vfs.URI('burn:///%s/.thumb' % base)
|
||||
gnome.vfs.make_directory(uri,gnome.vfs.OPEN_WRITE)
|
||||
except gnome.vfs.FileExistsError, msg:
|
||||
uri = URI('burn:///%s/.thumb' % base)
|
||||
make_directory(uri,OPEN_WRITE)
|
||||
except FileExistsError, msg:
|
||||
QuestionDialog.ErrorDialog("CD export preparation failed",
|
||||
"4 %s " % str(msg))
|
||||
return
|
||||
@ -256,7 +261,7 @@ class PackageWriter:
|
||||
newfile = fs_top.get_filename()
|
||||
if os.path.isfile(newfile):
|
||||
self.copy_file(newfile,'burn:///%s/%s' % (base,obase))
|
||||
ntype = Utils.get_mime_type(newfile)
|
||||
ntype = GrampsMime.get_type(newfile)
|
||||
if ntype[0:5] == "image":
|
||||
self.make_thumbnail(base,obase,newfile)
|
||||
|
||||
@ -300,7 +305,7 @@ class PackageWriter:
|
||||
select_clicked()
|
||||
|
||||
# Write XML now
|
||||
g = gnome.vfs.create('burn:///%s/data.gramps' % base,gnome.vfs.OPEN_WRITE )
|
||||
g = create('burn:///%s/data.gramps' % base,OPEN_WRITE )
|
||||
gfile = WriteXML.XmlWriter(self.db,None,1)
|
||||
gfile.write_handle(g)
|
||||
g.close()
|
||||
|
Loading…
Reference in New Issue
Block a user