2007-06-01 Alex Roitman <shura@gramps-project.org>

* src/DbLoader.py (_OPEN_FORMATS): Remove grdb from the native
	format list.
	* src/GrampsDbUtils/_GrampsDbWRFactories.py
	(gramps_db_reader_factory):  remove grdb read from the factories,
	it is a plugin now.
	* src/plugins/ReadGrdb.py: Register import; made module a plugin.



svn: r8530
This commit is contained in:
Alex Roitman 2007-06-02 05:51:39 +00:00
parent b022218241
commit a9791011c3
4 changed files with 44 additions and 18 deletions

View File

@ -1,3 +1,11 @@
2007-06-01 Alex Roitman <shura@gramps-project.org>
* src/DbLoader.py (_OPEN_FORMATS): Remove grdb from the native
format list.
* src/GrampsDbUtils/_GrampsDbWRFactories.py
(gramps_db_reader_factory): remove grdb read from the factories,
it is a plugin now.
* src/plugins/ReadGrdb.py: Register import; made module a plugin.
2007-06-01 Brian Matherly <brian@gramps-project.org>
* src/docgen/HtmlDoc.py: fix title error.

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2005-2006 Donald N. Allingham
# Copyright (C) 2005-2007 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: ViewManager.py 6678 2006-05-16 03:35:10Z dallingham $
# $Id$
"""
Handling of loading new/existing databases.
@ -41,7 +41,7 @@ import logging
# Set up logging
#
#-------------------------------------------------------------------------
__LOG = logging.getLogger(".")
_LOG = logging.getLogger(".")
#-------------------------------------------------------------------------
#
@ -75,7 +75,7 @@ _KNOWN_FORMATS = {
const.app_gedcom : _('GEDCOM'),
}
__OPEN_FORMATS = [const.app_gramps, const.app_gramps_xml, const.app_gedcom]
_OPEN_FORMATS = [const.app_gramps_xml, const.app_gedcom]
#-------------------------------------------------------------------------
#
@ -101,7 +101,7 @@ class DbLoader:
add_xml_filter(choose)
add_gedcom_filter(choose)
(box, type_selector) = format_maker(__OPEN_FORMATS)
(box, type_selector) = format_maker(_OPEN_FORMATS)
choose.set_extra_widget(box)
choose.set_current_folder(get_default_dir())
@ -117,7 +117,7 @@ class DbLoader:
filetype = Mime.get_type(filename)
(the_path, the_file) = os.path.split(filename)
choose.destroy()
if filetype in __OPEN_FORMATS:
if filetype in _OPEN_FORMATS:
self.read_file(filename, filetype)
try:
os.chdir(os.path.dirname(filename))
@ -213,7 +213,7 @@ class DbLoader:
add_xml_filter(choose)
add_gedcom_filter(choose)
(box, type_selector) = format_maker(__OPEN_FORMATS)
(box, type_selector) = format_maker(_OPEN_FORMATS)
choose.set_extra_widget(box)
default_dir = get_default_dir()
@ -290,7 +290,7 @@ class DbLoader:
add_xml_filter(choose)
add_gedcom_filter(choose)
format_list = _OPEN_FORMATS
format_list = _OPEN_FORMATS[:]
# Add more data type selections if opening existing db
for data in import_list:
@ -471,7 +471,7 @@ class DbLoader:
_("Could not open file: %s") % filename,
str(msg[1]))
except Exception:
__LOG.error("Failed to open database.", exc_info=True)
_LOG.error("Failed to open database.", exc_info=True)
return True
@ -493,7 +493,7 @@ class DbLoader:
self.uistate.pulse_progressbar)
old_database.close()
except Exception:
__LOG.error("Failed to open database.", exc_info=True)
_LOG.error("Failed to open database.", exc_info=True)
return False
def do_import(self, dialog, importer, filename):
@ -506,7 +506,7 @@ class DbLoader:
dirname = os.path.dirname(filename) + os.path.sep
Config.set(Config.RECENT_IMPORT_DIR, dirname)
except Exception:
__LOG.error("Failed to import database.", exc_info=True)
_LOG.error("Failed to import database.", exc_info=True)
#-------------------------------------------------------------------------
#
@ -549,7 +549,7 @@ def add_gramps_files_filter(chooser):
"""
mime_filter = gtk.FileFilter()
mime_filter.set_name(_('All GRAMPS files'))
for fmt in __OPEN_FORMATS:
for fmt in _OPEN_FORMATS:
mime_filter.add_mime_type(fmt)
chooser.add_filter(mime_filter)

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2004-2005 Donald N. Allingham
# Copyright (C) 2004-2007 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -79,10 +79,7 @@ def gramps_db_reader_factory(db_type):
Raises GrampsDbException if the db_type is not recognised.
"""
if db_type == const.app_gramps:
import _ReadGrdb as ReadGrdb
md = ReadGrdb.importData
elif db_type == const.app_gramps_xml:
if db_type == const.app_gramps_xml:
import _ReadXML as ReadXML
md = ReadXML.importData
elif db_type == const.app_gedcom:

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2005-2006 Donald N. Allingham
# Copyright (C) 2005-2007 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -32,6 +32,13 @@ import os
from gettext import gettext as _
import sets
#-------------------------------------------------------------------------
#
# GTK+ Modules
#
#-------------------------------------------------------------------------
import gtk
#-------------------------------------------------------------------------
#
# Gramps Modules
@ -42,6 +49,7 @@ from QuestionDialog import ErrorDialog
from Errors import HandleError
from BasicUtils import UpdateCallback
from BasicUtils import NameDisplay
from PluginUtils import register_import
#-------------------------------------------------------------------------
#
@ -269,3 +277,16 @@ def make_peron_name_remapper(other_database,formats_map):
remap_name(person,formats_map)
return person
return new_get_person
#------------------------------------------------------------------------
#
# Register with the plugin system
#
#------------------------------------------------------------------------
_mime_type = 'application/x-gramps'
_filter = gtk.FileFilter()
_filter.set_name(_('GRAMPS 2.x database'))
_filter.add_mime_type(_mime_type)
_format_name = _('GRAMPS 2.x database')
register_import(importData,_filter,_mime_type,0,_format_name)