Add Mime package

svn: r6047
This commit is contained in:
Alex Roitman 2006-03-03 00:23:04 +00:00
parent 4a04791292
commit a3de395e16
26 changed files with 73 additions and 70 deletions

View File

@ -10,6 +10,9 @@
* src/plugins/NavWebPage.py: update to new install paths * src/plugins/NavWebPage.py: update to new install paths
2006-03-02 Alex Roitman <shura@gramps-project.org> 2006-03-02 Alex Roitman <shura@gramps-project.org>
* src/Mime/__init__.py: Add new package.
* src/GrampsMime.py, src/GnomeMime.py, src/PythonMimie.py: Remove
(placed under Mime now).
* src/Config/__init__.py: Add new package. * src/Config/__init__.py: Add new package.
* src/GrampsGconfKeys.py, src/GrampsIniKeys.py, src/GrampsKeys.py: * src/GrampsGconfKeys.py, src/GrampsIniKeys.py, src/GrampsKeys.py:
Remove (placed under Config now). Remove (placed under Config now).

View File

@ -58,7 +58,7 @@ import const
import Utils import Utils
import RelImage import RelImage
import RelLib import RelLib
import GrampsMime import Mime
import GrampsDisplay import GrampsDisplay
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -132,7 +132,7 @@ class AddMediaObject:
ErrorDialog(msgstr % filename, msgstr2) ErrorDialog(msgstr % filename, msgstr2)
return return
mtype = GrampsMime.get_type(filename) mtype = Mime.get_type(filename)
if description == "": if description == "":
description = os.path.basename(filename) description = os.path.basename(filename)
@ -165,11 +165,11 @@ class AddMediaObject:
filename = Utils.find_file( filename) filename = Utils.find_file( filename)
if filename: if filename:
mtype = GrampsMime.get_type(filename) mtype = Mime.get_type(filename)
if mtype and mtype.startswith("image"): if mtype and mtype.startswith("image"):
image = RelImage.scale_image(filename,const.thumbScale) image = RelImage.scale_image(filename,const.thumbScale)
else: else:
image = GrampsMime.find_mime_type_pixbuf(mtype) image = Mime.find_mime_type_pixbuf(mtype)
self.image.set_from_pixbuf(image) self.image.set_from_pixbuf(image)
def run(self): def run(self):

View File

@ -42,7 +42,7 @@ from gettext import gettext as _
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import GrampsDb import GrampsDb
import GrampsMime import Mime
import QuestionDialog import QuestionDialog
import Config import Config
import RecentFiles import RecentFiles
@ -127,7 +127,7 @@ class ArgHandler:
o,v = options[opt_ix] o,v = options[opt_ix]
if o in ( '-O', '--open'): if o in ( '-O', '--open'):
fname = v fname = v
ftype = GrampsMime.get_type( ftype = Mime.get_type(
os.path.abspath(os.path.expanduser(fname))) os.path.abspath(os.path.expanduser(fname)))
if opt_ix<len(options)-1 \ if opt_ix<len(options)-1 \
and options[opt_ix+1][0] in ( '-f', '--format'): and options[opt_ix+1][0] in ( '-f', '--format'):
@ -149,7 +149,7 @@ class ArgHandler:
self.open = (fname,format) self.open = (fname,format)
elif o in ( '-i', '--import'): elif o in ( '-i', '--import'):
fname = v fname = v
ftype = GrampsMime.get_type( ftype = Mime.get_type(
os.path.abspath(os.path.expanduser(fname))) os.path.abspath(os.path.expanduser(fname)))
if opt_ix<len(options)-1 \ if opt_ix<len(options)-1 \
and options[opt_ix+1][0] in ( '-f', '--format'): and options[opt_ix+1][0] in ( '-f', '--format'):
@ -227,7 +227,7 @@ class ArgHandler:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def auto_save_load(self,filename): def auto_save_load(self,filename):
filename = os.path.normpath(os.path.abspath(filename)) filename = os.path.normpath(os.path.abspath(filename))
filetype = GrampsMime.get_type(filename) filetype = Mime.get_type(filename)
if filetype in (const.app_gramps, if filetype in (const.app_gramps,
const.app_gramps_xml, const.app_gramps_xml,
const.app_gedcom): const.app_gedcom):
@ -253,7 +253,7 @@ class ArgHandler:
# the rest of given arguments. # the rest of given arguments.
success = False success = False
filename = os.path.abspath(os.path.expanduser(self.open_gui)) filename = os.path.abspath(os.path.expanduser(self.open_gui))
filetype = GrampsMime.get_type(filename) filetype = Mime.get_type(filename)
if filetype in (const.app_gramps,const.app_gedcom, if filetype in (const.app_gramps,const.app_gedcom,
const.app_gramps_xml): const.app_gramps_xml):
# Say the type outloud # Say the type outloud

View File

@ -43,7 +43,7 @@ import gtk
import GrampsDb import GrampsDb
import Config import Config
import NameDisplay import NameDisplay
import GrampsMime import Mime
import const import const
import Errors import Errors
@ -395,7 +395,7 @@ class RecentDocsMenu:
for item in rfiles: for item in rfiles:
try: try:
filename = os.path.basename(item.get_path()).replace('_','__') filename = os.path.basename(item.get_path()).replace('_','__')
filetype = GrampsMime.get_type(item.get_path()) filetype = Mime.get_type(item.get_path())
action_id = "RecentMenu%d" % count action_id = "RecentMenu%d" % count
f.write('<menuitem action="%s"/>' % action_id) f.write('<menuitem action="%s"/>' % action_id)
actions.append((action_id,None,filename,None,None, actions.append((action_id,None,filename,None,None,

View File

@ -45,7 +45,7 @@ import gtk.glade
import const import const
import Utils import Utils
import RelLib import RelLib
import GrampsMime import Mime
import ImgManip import ImgManip
import EditPrimary import EditPrimary
@ -104,11 +104,11 @@ class EditMedia(EditPrimary.EditPrimary):
if mtype: if mtype:
pb = ImgManip.get_thumbnail_image(self.obj.get_path(),mtype) pb = ImgManip.get_thumbnail_image(self.obj.get_path(),mtype)
pixmap.set_from_pixbuf(pb) pixmap.set_from_pixbuf(pb)
descr = GrampsMime.get_description(mtype) descr = Mime.get_description(mtype)
if descr: if descr:
self.glade.get_widget("type").set_text(descr) self.glade.get_widget("type").set_text(descr)
else: else:
pb = GrampsMime.find_mime_type_pixbuf('text/plain') pb = Mime.find_mime_type_pixbuf('text/plain')
pixmap.set_from_pixbuf(pb) pixmap.set_from_pixbuf(pb)
self.glade.get_widget("type").set_text(_('Note')) self.glade.get_widget("type").set_text(_('Note'))
@ -196,7 +196,7 @@ class EditMedia(EditPrimary.EditPrimary):
path = self.glade.get_widget('path').get_text() path = self.glade.get_widget('path').get_text()
if path != self.obj.get_path(): if path != self.obj.get_path():
mime = GrampsMime.get_type(path) mime = Mime.get_type(path)
self.obj.set_mime_type(mime) self.obj.set_mime_type(mime)
self.obj.set_path(path) self.obj.set_path(path)

View File

@ -44,7 +44,7 @@ import gtk.glade
import const import const
import Utils import Utils
import RelLib import RelLib
import GrampsMime import Mime
import ImgManip import ImgManip
import DisplayState import DisplayState
import GrampsDisplay import GrampsDisplay
@ -115,7 +115,7 @@ class EditMediaRef(DisplayState.ManagedWindow):
self.media.get_path, self.media.get_path,
self.db.readonly) self.db.readonly)
mt = GrampsMime.get_description(mtype) mt = Mime.get_description(mtype)
if mt: if mt:
self.change_dialog.get_widget("type").set_text(mt) self.change_dialog.get_widget("type").set_text(mt)
else: else:

View File

@ -47,7 +47,7 @@ import gtk.gdk
import const import const
import Utils import Utils
import Config import Config
import GrampsMime import Mime
import RelLib import RelLib
import DateHandler import DateHandler
import NameDisplay import NameDisplay
@ -297,7 +297,7 @@ class EditPerson(EditPrimary.EditPrimary):
menu.set_title(_("Media Object")) menu.set_title(_("Media Object"))
obj = self.db.get_object_from_handle(photo.get_reference_handle()) obj = self.db.get_object_from_handle(photo.get_reference_handle())
mtype = obj.get_mime_type() mtype = obj.get_mime_type()
progname = GrampsMime.get_application(mtype) progname = Mime.get_application(mtype)
if progname and len(progname) > 1: if progname and len(progname) > 1:
Utils.add_menuitem(menu,_("Open in %s") % progname[1], Utils.add_menuitem(menu,_("Open in %s") % progname[1],

View File

@ -63,7 +63,7 @@ import NameDisplay
import DisplayTrace import DisplayTrace
from ansel_utf8 import ansel_to_utf8 from ansel_utf8 import ansel_to_utf8
import Utils import Utils
import GrampsMime import Mime
from bsddb import db from bsddb import db
from _GedcomInfo import * from _GedcomInfo import *
from _GedTokens import * from _GedTokens import *
@ -1283,7 +1283,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(GrampsMime.get_type(os.path.abspath(path))) photo.set_mime_type(Mime.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.handle self.media_map[path] = photo.handle
else: else:
@ -1324,7 +1324,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(GrampsMime.get_type(os.path.abspath(path))) photo.set_mime_type(Mime.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.handle self.media_map[path] = photo.handle
else: else:

View File

@ -45,7 +45,7 @@ import gtk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
from QuestionDialog import ErrorDialog, WarningDialog, MissingMediaDialog from QuestionDialog import ErrorDialog, WarningDialog, MissingMediaDialog
import GrampsMime import Mime
import RelLib import RelLib
import const import const
import Utils import Utils
@ -1088,7 +1088,7 @@ class GrampsParser:
a.set_type(key) a.set_type(key)
a.set_value(attrs[key]) a.set_value(attrs[key])
self.photo.add_attribute(a) self.photo.add_attribute(a)
self.photo.set_mime_type(GrampsMime.get_type(self.photo.get_path())) self.photo.set_mime_type(Mime.get_type(self.photo.get_path()))
self.db.add_object(self.photo) self.db.add_object(self.photo)
if self.family: if self.family:
self.family.add_media_reference(self.pref) self.family.add_media_reference(self.pref)

View File

@ -25,7 +25,7 @@ import md5
import gtk import gtk
import gobject import gobject
import GrampsMime import Mime
import Config import Config
import Utils import Utils
@ -153,7 +153,7 @@ def get_thumbnail_image(path,mtype=None):
return gtk.gdk.pixbuf_new_from_file(filename) return gtk.gdk.pixbuf_new_from_file(filename)
except (gobject.GError, OSError): except (gobject.GError, OSError):
if mtype: if mtype:
return GrampsMime.find_mime_type_pixbuf(mtype) return Mime.find_mime_type_pixbuf(mtype)
else: else:
return gtk.gdk.pixbuf_new_from_file(os.path.join( return gtk.gdk.pixbuf_new_from_file(os.path.join(
const.data_dir,"document.png")) const.data_dir,"document.png"))
@ -169,7 +169,7 @@ def get_thumb_from_obj(obj):
if mtype[0:5] == "image": if mtype[0:5] == "image":
image = get_thumbnail_image(obj.get_path()) image = get_thumbnail_image(obj.get_path())
else: else:
image = GrampsMime.find_mime_type_pixbuf(mtype) image = Mime.find_mime_type_pixbuf(mtype)
if not image: if not image:
image = gtk.gdk.pixbuf_new_from_file(const.icon) image = gtk.gdk.pixbuf_new_from_file(const.icon)
return image return image

View File

@ -58,7 +58,7 @@ import const
import Utils import Utils
import ListModel import ListModel
import ImgManip import ImgManip
import GrampsMime import Mime
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -101,7 +101,7 @@ class SelectObject:
for key in self.db.get_media_object_handles(): for key in self.db.get_media_object_handles():
obj = self.db.get_object_from_handle(key) obj = self.db.get_object_from_handle(key)
title = obj.get_description() title = obj.get_description()
the_type = GramspMime.get_description(obj.get_mime_type()) the_type = Mime.get_description(obj.get_mime_type())
path = obj.get_path() path = obj.get_path()
self.object_model.add([title,obj.get_gramps_id(),the_type,path],key) self.object_model.add([title,obj.get_gramps_id(),the_type,path],key)
@ -120,7 +120,7 @@ class SelectObject:
if the_type and the_type[0:5] == "image": if the_type and the_type[0:5] == "image":
image = ImgManip.get_thumbnail_image(path,the_type) image = ImgManip.get_thumbnail_image(path,the_type)
else: else:
image = GrampsMime.find_mime_type_pixbuf(the_type) image = Mime.find_mime_type_pixbuf(the_type)
self.preview.set_from_pixbuf(image) self.preview.set_from_pixbuf(image)
self.object_handle.set_text(obj.get_gramps_id()) self.object_handle.set_text(obj.get_gramps_id())

View File

@ -45,7 +45,7 @@ import gtk.gdk
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import GrampsMime import Mime
import NameDisplay import NameDisplay
import RelLib import RelLib
import Errors import Errors
@ -503,7 +503,7 @@ def add_menuitem(menu,msg,obj,func):
def view_photo(photo): def view_photo(photo):
mime_type = photo.get_mime_type() mime_type = photo.get_mime_type()
try: try:
data = GrampsMime.get_application(mime_type) data = Mime.get_application(mime_type)
prog = data[0] prog = data[0]
except: except:
return return

View File

@ -62,7 +62,7 @@ import RecentFiles
import NameDisplay import NameDisplay
import Tool import Tool
import Report import Report
import GrampsMime import Mime
import Config import Config
import GrampsWidgets import GrampsWidgets
@ -570,7 +570,7 @@ class ViewManager:
return False return False
filetype = type_selector.get_value() filetype = type_selector.get_value()
if filetype == 'auto': if filetype == 'auto':
filetype = GrampsMime.get_type(filename) filetype = Mime.get_type(filename)
(the_path,the_file) = os.path.split(filename) (the_path,the_file) = os.path.split(filename)
choose.destroy() choose.destroy()
if filetype in [const.app_gramps,const.app_gramps_xml, if filetype in [const.app_gramps,const.app_gramps_xml,
@ -916,7 +916,7 @@ class ViewManager:
filetype = type_selector.get_value() filetype = type_selector.get_value()
if filetype == 'auto': if filetype == 'auto':
try: try:
filetype = GrampsMime.get_type(filename) filetype = Mime.get_type(filename)
except RuntimeError,msg: except RuntimeError,msg:
QuestionDialog.ErrorDialog( QuestionDialog.ErrorDialog(
_("Could not open file: %s") % filename, _("Could not open file: %s") % filename,

View File

@ -36,7 +36,7 @@ import BaseDoc
import Errors import Errors
import PluginMgr import PluginMgr
import ImgManip import ImgManip
import GrampsMime import Mime
import Utils import Utils
from gettext import gettext as _ from gettext import gettext as _
@ -179,7 +179,7 @@ class AbiWordDoc(BaseDoc.BaseDoc):
if self.print_req: if self.print_req:
apptype = 'application/x-abiword' apptype = 'application/x-abiword'
try: try:
app = GrampsMime.get_application(apptype)[0] app = Mime.get_application(apptype)[0]
os.environ["FILE"] = self.filename os.environ["FILE"] = self.filename
os.system ('%s "$FILE" &' % app) os.system ('%s "$FILE" &' % app)
except: except:
@ -326,8 +326,8 @@ class AbiWordDoc(BaseDoc.BaseDoc):
#-------------------------------------------------------------------------- #--------------------------------------------------------------------------
try: try:
prog = GrampsMime.get_application("application/x-abiword") prog = Mime.get_application("application/x-abiword")
mtype = GrampsMime.get_description('application/x-abiword') mtype = Mime.get_description('application/x-abiword')
if Utils.search_for(prog[0]): if Utils.search_for(prog[0]):
print_label=_("Open in %s") % prog[1] print_label=_("Open in %s") % prog[1]

View File

@ -36,7 +36,7 @@ from gettext import gettext as _
import BaseDoc import BaseDoc
import PluginMgr import PluginMgr
import Errors import Errors
import GrampsMime import Mime
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -153,7 +153,7 @@ class AsciiDoc(BaseDoc.BaseDoc):
if self.print_req: if self.print_req:
apptype = 'text/plain' apptype = 'text/plain'
prog = GrampsMime.get_application(apptype) prog = Mime.get_application(apptype)
os.environ["FILE"] = self.filename os.environ["FILE"] = self.filename
os.system ('%s "$FILE" &' % prog[0]) os.system ('%s "$FILE" &' % prog[0])
@ -383,8 +383,8 @@ print_label = None
try: try:
import Utils import Utils
mprog = GrampsMime.get_application("text/plain") mprog = Mime.get_application("text/plain")
mtype = GrampsMime.get_description('text/plain') mtype = Mime.get_description('text/plain')
if Utils.search_for(mprog[0]): if Utils.search_for(mprog[0]):
print_label=_("Open in %s") % mprog[1] print_label=_("Open in %s") % mprog[1]

View File

@ -42,7 +42,7 @@ import const
import Errors import Errors
import BaseDoc import BaseDoc
import QuestionDialog import QuestionDialog
import GrampsMime import Mime
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -356,7 +356,7 @@ class HtmlDoc(BaseDoc.BaseDoc):
if self.print_req: if self.print_req:
apptype = 'text/html' apptype = 'text/html'
app = GrampsMime.get_application(apptype) app = Mime.get_application(apptype)
os.environ["FILE"] = self.filename os.environ["FILE"] = self.filename
os.system ('%s "$FILE" &' % app[0]) os.system ('%s "$FILE" &' % app[0])
@ -499,8 +499,8 @@ class HtmlDoc(BaseDoc.BaseDoc):
try: try:
import Utils import Utils
prog = GrampsMime.get_application("text/html") prog = Mime.get_application("text/html")
mtype = GrampsMime.get_description("text/html") mtype = Mime.get_description("text/html")
if Utils.search_for(prog[0]): if Utils.search_for(prog[0]):
print_label=_("Open in %s") % prog[1] print_label=_("Open in %s") % prog[1]

View File

@ -31,7 +31,7 @@ import Errors
from TarFile import TarFile from TarFile import TarFile
import PluginMgr import PluginMgr
import ImgManip import ImgManip
import GrampsMime import Mime
from gettext import gettext as _ from gettext import gettext as _
@ -263,7 +263,7 @@ class KwordDoc(BaseDoc.BaseDoc):
if self.print_req: if self.print_req:
apptype = 'application/x-kword' apptype = 'application/x-kword'
app = GrampsMime.get_application(apptype) app = Mime.get_application(apptype)
os.environ["FILE"] = self.filename os.environ["FILE"] = self.filename
os.system ('%s "$FILE" &' % app[0]) os.system ('%s "$FILE" &' % app[0])
@ -488,8 +488,8 @@ class KwordDoc(BaseDoc.BaseDoc):
try: try:
import Utils import Utils
prog = GrampsMime.get_application("application/x-kword") prog = Mime.get_application("application/x-kword")
mtype = GrampsMime.get_description("application/x-kword") mtype = Mime.get_description("application/x-kword")
if prog and Utils.search_for(prog[0]): if prog and Utils.search_for(prog[0]):
print_label=_("Open in %s") % prog[1] print_label=_("Open in %s") % prog[1]

View File

@ -44,7 +44,7 @@ import const
import PluginMgr import PluginMgr
import ImgManip import ImgManip
import FontScale import FontScale
import GrampsMime import Mime
from ReportUtils import pt2cm from ReportUtils import pt2cm
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -417,7 +417,7 @@ class ODFDoc(BaseDoc.BaseDoc):
self._write_mimetype_file() self._write_mimetype_file()
self._write_zip() self._write_zip()
if self.print_req: if self.print_req:
app = GrampsMime.get_application(_apptype) app = Mime.get_application(_apptype)
os.environ["FILE"] = self.filename os.environ["FILE"] = self.filename
os.system ('%s "$FILE" &' % app[0]) os.system ('%s "$FILE" &' % app[0])
@ -1132,8 +1132,8 @@ print_label = None
try: try:
import Utils import Utils
mprog = GrampsMime.get_application(_apptype) mprog = Mime.get_application(_apptype)
mtype = GrampsMime.get_description(_apptype) mtype = Mime.get_description(_apptype)
if Utils.search_for(mprog[0]): if Utils.search_for(mprog[0]):
print_label = _("Open in %(program_name)s") % { 'program_name': print_label = _("Open in %(program_name)s") % { 'program_name':

View File

@ -43,7 +43,7 @@ import const
import PluginMgr import PluginMgr
import ImgManip import ImgManip
import FontScale import FontScale
import GrampsMime import Mime
import Utils import Utils
from ReportUtils import pt2cm from ReportUtils import pt2cm
@ -381,7 +381,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
self._write_meta_file() self._write_meta_file()
self._write_zip() self._write_zip()
if self.print_req: if self.print_req:
app = GrampsMime.get_application(_apptype) app = Mime.get_application(_apptype)
os.environ["FILE"] = self.filename os.environ["FILE"] = self.filename
os.system ('%s "$FILE" &' % app[0]) os.system ('%s "$FILE" &' % app[0])
@ -995,8 +995,8 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
print_label = None print_label = None
try: try:
mprog = GrampsMime.get_application(_apptype) mprog = Mime.get_application(_apptype)
mtype = GrampsMime.get_description(_apptype) mtype = Mime.get_description(_apptype)
if Utils.search_for(mprog[0]): if Utils.search_for(mprog[0]):
print_label = _("Open in OpenOffice.org") print_label = _("Open in OpenOffice.org")

View File

@ -36,7 +36,7 @@ import BaseDoc
import PluginMgr import PluginMgr
import Errors import Errors
import ImgManip import ImgManip
import GrampsMime import Mime
_H = 'Helvetica' _H = 'Helvetica'
_HB = 'Helvetica-Bold' _HB = 'Helvetica-Bold'
@ -189,7 +189,7 @@ class PdfDoc(BaseDoc.BaseDoc):
if self.print_req: if self.print_req:
apptype = 'application/pdf' apptype = 'application/pdf'
app = GrampsMime.get_application(apptype) app = Mime.get_application(apptype)
os.environ["FILE"] = self.filename os.environ["FILE"] = self.filename
os.system ('%s "$FILE" &' % app[0]) os.system ('%s "$FILE" &' % app[0])
@ -631,8 +631,8 @@ print_label = None
try: try:
import Utils import Utils
mprog = GrampsMime.get_application("application/pdf") mprog = Mime.get_application("application/pdf")
mtype = GrampsMime.get_description("application/pdf") mtype = Mime.get_description("application/pdf")
if Utils.search_for(mprog[0]): if Utils.search_for(mprog[0]):
print_label=_("Open in %s") % mprog[1] print_label=_("Open in %s") % mprog[1]

View File

@ -37,7 +37,7 @@ import BaseDoc
import PluginMgr import PluginMgr
import ImgManip import ImgManip
import Errors import Errors
import GrampsMime import Mime
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
@ -127,7 +127,7 @@ class RTFDoc(BaseDoc.BaseDoc):
if self.print_req: if self.print_req:
apptype = 'application/rtf' apptype = 'application/rtf'
try: try:
app = GrampsMime.get_application(apptype)[0] app = Mime.get_application(apptype)[0]
os.environ["FILE"] = self.filename os.environ["FILE"] = self.filename
os.system ('%s "$FILE" &' % app) os.system ('%s "$FILE" &' % app)
except: except:
@ -420,8 +420,8 @@ class RTFDoc(BaseDoc.BaseDoc):
try: try:
import Utils import Utils
mprog = GrampsMime.get_application("application/rtf") mprog = Mime.get_application("application/rtf")
mtype = GrampsMime.get_description("application/rtf") mtype = Mime.get_description("application/rtf")
if Utils.search_for(mprog[0]): if Utils.search_for(mprog[0]):
print_label=_("Open in %s") % mprog[1] print_label=_("Open in %s") % mprog[1]

View File

@ -57,7 +57,7 @@ import Errors
import PluginMgr import PluginMgr
import TipOfDay import TipOfDay
from GrampsMime import mime_type_is_defined from Mime import mime_type_is_defined
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
iconpaths = [".",const.image_dir] iconpaths = [".",const.image_dir]

View File

@ -52,7 +52,7 @@ except:
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import WriteXML import WriteXML
import Utils import Utils
import GrampsMime import Mime
import const import const
import QuestionDialog import QuestionDialog
import ImgManip import ImgManip
@ -226,7 +226,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 = GrampsMime.get_type(newfile) ntype = Mime.get_type(newfile)
if ntype and ntype.startswith("image"): if ntype and ntype.startswith("image"):
self.make_thumbnail(base,obase,newfile) self.make_thumbnail(base,obase,newfile)