* src/ViewManager.py: exposed a private method via a new method,
post_load_newdb() * src/ArgHandler.py: made ArgHandler.handle_args() return filename, and filetype, if commandline or recentfile * src/gramps_main.py: handles return values from AH.handle_args() 2007-12-10 Douglas S. Blank <dblank@cs.brynmawr.edu> svn: r9486
This commit is contained in:
parent
10d24dd35f
commit
0aba9e8e2b
@ -1,3 +1,10 @@
|
||||
2007-12-10 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||
* src/ViewManager.py: exposed a private method via a new method,
|
||||
post_load_newdb()
|
||||
* src/ArgHandler.py: made ArgHandler.handle_args() return filename,
|
||||
and filetype, if commandline or recentfile
|
||||
* src/gramps_main.py: handles return values from AH.handle_args()
|
||||
|
||||
2007-12-10 Douglas S. Blank <dblank@cs.brynmawr.edu>
|
||||
* src/DbManager.py: fixed issue in breaking lock on lock
|
||||
which has already been removed
|
||||
|
@ -312,13 +312,13 @@ class ArgHandler:
|
||||
print "Type: GEDCOM file"
|
||||
elif filetype == const.APP_GRAMPS_XML:
|
||||
print "Type: GRAMPS XML database"
|
||||
|
||||
|
||||
try:
|
||||
self.vm.read_recent_file(filename, filetype)
|
||||
self.vm.db_loader.read_file(filename, filetype)
|
||||
print "Opened successfully!"
|
||||
success = True
|
||||
except:
|
||||
print "Cannot open %s. Exiting..."
|
||||
print "Cannot open '%s'. Exiting..." % filename
|
||||
|
||||
elif filetype in (const.APP_GRAMPS_PKG,):
|
||||
QuestionDialog.OkDialog( _("Opening non-native format"),
|
||||
@ -350,11 +350,10 @@ class ArgHandler:
|
||||
sys.exit(1)
|
||||
if success:
|
||||
# Add the file to the recent items
|
||||
#RecentFiles.recent_files(filename,filetype)
|
||||
pass
|
||||
RecentFiles.recent_files(filename,const.APP_GRAMPS)
|
||||
else:
|
||||
sys.exit(1)
|
||||
return
|
||||
return (filename, filetype)
|
||||
|
||||
if self.open:
|
||||
# Filename to open was given. Open it natively (grdb or any of
|
||||
@ -430,17 +429,19 @@ class ArgHandler:
|
||||
print "Exiting."
|
||||
sys.exit(0)
|
||||
|
||||
## read recent file is broken in GRAMPS 30 ! DISABLE
|
||||
##elif Config.get(Config.RECENT_FILE) and Config.get(Config.AUTOLOAD):
|
||||
## rf = Config.get(Config.RECENT_FILE)
|
||||
##
|
||||
## if os.path.isfile(rf):
|
||||
## filetype = Mime.get_type(rf)
|
||||
## self.vm.read_recent_file(rf, filetype)
|
||||
## elif os.path.isdir(rf):
|
||||
## if os.path.isfile(os.path.join(rf, "name.txt")) and \
|
||||
## not os.path.isfile(os.path.join(rf,"need_recover")):
|
||||
## self.vm.read_recent_file(rf, 'x-directory/normal')
|
||||
## read recent file is broken in GRAMPS 30 ! DISABLE
|
||||
elif Config.get(Config.RECENT_FILE) and Config.get(Config.AUTOLOAD):
|
||||
filename = Config.get(Config.RECENT_FILE)
|
||||
self.vm.db_loader.read_file(filename, const.APP_GRAMPS)
|
||||
return (filename, const.APP_GRAMPS)
|
||||
|
||||
#if os.path.isfile(rf):
|
||||
# filetype = Mime.get_type(rf)
|
||||
# self.vm.read_recent_file(rf, filetype)
|
||||
#elif os.path.isdir(rf):
|
||||
# if os.path.isfile(os.path.join(rf, "name.txt")) and \
|
||||
# not os.path.isfile(os.path.join(rf,"need_recover")):
|
||||
# self.vm.read_recent_file(rf, 'x-directory/normal')
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -575,6 +575,17 @@ class ViewManager:
|
||||
if not self.state.db.is_open():
|
||||
self.__open_activate(None)
|
||||
|
||||
def post_load_newdb(self, filename, filetype):
|
||||
# Attempt to figure out the database title
|
||||
path = os.path.join(filename, "name.txt")
|
||||
try:
|
||||
ifile = open(path)
|
||||
title = ifile.readline().strip()
|
||||
ifile.close()
|
||||
except:
|
||||
title = filename
|
||||
self.__post_load_newdb(filename, filetype, title)
|
||||
|
||||
def __do_load_plugins(self):
|
||||
"""
|
||||
Loads the plugins at initialization time. We load the document
|
||||
|
@ -248,8 +248,11 @@ class Gramps:
|
||||
# we may need to change the order of operation
|
||||
ah = ArgHandler.ArgHandler(state, self.vm, args)
|
||||
if ah.need_gui():
|
||||
ah.handle_args()
|
||||
retval = ah.handle_args()
|
||||
self.vm.post_init_interface()
|
||||
if retval:
|
||||
filename, filetype = retval
|
||||
self.vm.post_load_newdb(filename, filetype)
|
||||
else:
|
||||
ah.handle_args()
|
||||
self.vm.post_init_interface()
|
||||
|
Loading…
Reference in New Issue
Block a user