* src/ArgHandler.py: start fixing.

* src/gramps_main.py: Run ArgHandler with new arguments.


svn: r5061
This commit is contained in:
Alex Roitman 2005-08-12 16:25:43 +00:00
parent 6356e91983
commit 4e4f558c6e
3 changed files with 40 additions and 35 deletions

View File

@ -1,3 +1,7 @@
2005-08-12 Alex Roitman <shura@gramps-project.org>
* src/ArgHandler.py: start fixing.
* src/gramps_main.py: Run ArgHandler with new arguments.
2005-08-12 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/MapView.py: Corrected coordinate handling; Show all location in map;
fetch locations from xearth config file

View File

@ -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

View File

@ -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)