diff --git a/ChangeLog b/ChangeLog index 764772f7a..90d19054b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 * src/plugins/NavWebPage.py: More enhancements * src/Sort.py: sort places by title diff --git a/src/ArgHandler.py b/src/ArgHandler.py index 6e5637d18..87dafc514 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -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) diff --git a/src/gramps_main.py b/src/gramps_main.py index 8324006d9..50de4e0fd 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -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" )