From 6216a6503efa0759566211fc9f5445ebb4face42 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 12 Aug 2005 16:25:43 +0000 Subject: [PATCH] * src/ArgHandler.py: start fixing. * src/gramps_main.py: Run ArgHandler with new arguments. svn: r5061 --- ChangeLog | 4 ++++ src/ArgHandler.py | 26 ++++++++------------------ src/gramps_main.py | 45 ++++++++++++++++++++++++++++----------------- 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1596d2485..f1fbdd56d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-08-12 Alex Roitman + * src/ArgHandler.py: start fixing. + * src/gramps_main.py: Run ArgHandler with new arguments. + 2005-08-12 Martin Hawlisch * src/MapView.py: Corrected coordinate handling; Show all location in map; fetch locations from xearth config file diff --git a/src/ArgHandler.py b/src/ArgHandler.py index a398431e5..744c85db4 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -85,8 +85,9 @@ class ArgHandler: interactive session will not be launched. """ - def __init__(self,parent,args): - self.parent = parent + def __init__(self,state,vm,args): + self.state = state + self.vm = vm self.args = args self.open_gui = None @@ -221,24 +222,13 @@ class ArgHandler: # #------------------------------------------------------------------------- def auto_save_load(self,filename): - self.parent.active_person = None filename = os.path.normpath(os.path.abspath(filename)) filetype = GrampsMime.get_type(filename) - if filetype == const.app_gramps: - import GrampsBSDDB - self.parent.db.close() - self.parent.db = GrampsBSDDB.GrampsBSDDB() - return self.parent.read_file(filename) - elif filetype == const.app_gramps_xml: - import GrampsXMLDB - self.parent.db.close() - self.parent.db = GrampsXMLDB.GrampsXMLDB() - return self.parent.read_file(filename) - elif filetype == const.app_gedcom: - import GrampsGEDDB - self.parent.db.close() - self.parent.db = GrampsGEDDB.GrampsGEDDB() - return self.parent.read_file(filename) + if filetype in (const.app_gramps, + const.app_gramps_xml, + const.app_gedcom): + print "Here" + return self.vm.open_native(filename,filetype) else: return 0 diff --git a/src/gramps_main.py b/src/gramps_main.py index 33b9fe0f8..1b0da139e 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -20,7 +20,19 @@ # $Id$ +#------------------------------------------------------------------------- +# +# GTK+/GNOME modules +# +#------------------------------------------------------------------------- import gtk +import gnome + +#------------------------------------------------------------------------- +# +# GRAMPS modules +# +#------------------------------------------------------------------------- import ViewManager import PersonView import RepositoryView @@ -42,8 +54,6 @@ import GrampsDbBase from GrampsMime import mime_type_is_defined from QuestionDialog import ErrorDialog -import gnome - iconpaths = [".",const.rootDir] @@ -135,8 +145,23 @@ class Gramps: gtk.main_quit() return - ArgHandler.ArgHandler(self,args) + register_stock_icons() + + state = GrampsDbBase.DbState() + vm = ViewManager.ViewManager(state) + vm.register_view(PersonView.PersonView) + vm.register_view(PedView.PedView) + vm.register_view(EventView.EventView) + vm.register_view(SourceView.SourceView) + vm.register_view(PlaceView.PlaceView) + vm.register_view(MapView.MapView) + vm.register_view(RepositoryView.RepositoryView) + + ArgHandler.ArgHandler(state,vm,args) + + vm.init_interface() + # Don't show main window until ArgHandler is done. # This prevents a window from annoyingly popping up when # the command line args are sufficient to operate without it. @@ -159,20 +184,6 @@ class Gramps: # GrampsKeys.client.notify_add("/apps/gramps/preferences/date-format", # self.date_format_key_update) - register_stock_icons() - - state = GrampsDbBase.DbState() - - a = ViewManager.ViewManager(state) - a.register_view(PersonView.PersonView) - a.register_view(PedView.PedView) - a.register_view(EventView.EventView) - a.register_view(SourceView.SourceView) - a.register_view(PlaceView.PlaceView) - a.register_view(MapView.MapView) - a.register_view(RepositoryView.RepositoryView) - a.init_interface() - if GrampsKeys.get_usetips(): TipOfDay.TipOfDay(self)