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