* src/ArgHandler (handle_args): Natively open XML and GEDCOM

when given a single filename argument.
* src/gramps_main.py (read_gedcom,read_xml): Remove ununsed functions.


svn: r4029
This commit is contained in:
Alex Roitman 2005-02-14 03:09:22 +00:00
parent 595404bcc3
commit 1843c8bc19
3 changed files with 15 additions and 32 deletions

View File

@ -2,6 +2,10 @@
* src/ReadGrdb.py: Check for overlapping handles prior to
modifying data.
* src/ArgHandler (handle_args): Natively open XML and GEDCOM
when given a single filename argument.
* src/gramps_main.py (read_gedcom,read_xml): Remove ununsed functions.
2005-02-12 Don Allingham <dallingham@users.sourceforge.net>
* src/plugins/NavWebPage.py: More enhancements
* src/Sort.py: sort places by title

View File

@ -254,15 +254,22 @@ class ArgHandler:
success = False
filename = os.path.abspath(os.path.expanduser(self.open_gui))
filetype = GrampsMime.get_type(filename)
if filetype == const.app_gramps:
print "Type: GRAMPS database"
if filetype in (const.app_gramps,const.app_gedcom,
const.app_gramps_xml):
# Say the type outloud
if filetype == const.app_gramps:
print "Type: GRAMPS database"
elif filetype == const.app_gedcom:
print "Type: GEDCOM file"
elif filetype == const.app_gramps_xml:
print "Type: GRAMPS XML database"
if self.auto_save_load(filename):
print "Opened successfully!"
success = True
else:
print "Cannot open %s. Exiting..."
elif filetype in (const.app_gedcom,"x-directory/normal",
const.app_gramps_package):
elif filetype in (const.app_gramps_package,):
QuestionDialog.OkDialog( _("Opening non-native format"),
_("New GRAMPS database has to be set up when opening non-native formats. The following dialog will let you select the new database."),
self.parent.topWindow)
@ -273,12 +280,6 @@ class ArgHandler:
_('GRAMPS cannot open non-native data without setting up new GRAMPS database.'))
print "Cannot continue without native database. Exiting..."
os._exit(1)
elif filetype == const.app_gedcom:
print "Type: GEDCOM"
self.parent.read_gedcom(filename)
elif filetype == "x-directory/normal":
print "Type: GRAMPS XML"
self.parent.read_xml(filename)
elif filetype == const.app_gramps_package:
print "Type: GRAMPS package"
self.parent.read_pkg(filename)

View File

@ -1027,28 +1027,6 @@ class Gramps:
if self.active_person:
Plugins.ReportPlugins(self,self.db,self.active_person)
def read_gedcom(self,filename):
import ReadGedcom
filename = os.path.normpath(os.path.abspath(filename))
try:
ReadGedcom.importData(self.db,filename,None)
self.import_tool_callback()
except:
DisplayTrace.DisplayTrace()
def read_xml(self,filename):
import ReadXML
filename = os.path.normpath(
os.path.abspath(os.path.join(filename,const.xmlFile)))
try:
ReadXML.importData(self.db,filename,None)
self.import_tool_callback()
except:
DisplayTrace.DisplayTrace()
def read_pkg(self,filename):
# Create tempdir, if it does not exist, then check for writability
tmpdir_path = os.path.expanduser("~/.gramps/tmp" )