From 2002d9a1ba586a6c547a930ecd233a0f8baaa63a Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 30 Mar 2007 04:23:46 +0000 Subject: [PATCH] 2007-03-29 Don Allingham * src/ViewManager.py: load previous db if requested * src/gramps_main.py: load previous db if requested * src/ArgHandler.py: load previous db if requested svn: r8340 --- ChangeLog | 5 +++++ src/ArgHandler.py | 6 +++++- src/ViewManager.py | 15 +++++++++++++-- src/gramps_main.py | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 974847273..23c2827e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2007-03-29 Don Allingham + * src/ViewManager.py: load previous db if requested + * src/gramps_main.py: load previous db if requested + * src/ArgHandler.py: load previous db if requested + 2007-03-29 Brian Matherly * src/ReportBase/_ReportOptions.py * src/ReportBase/_Report.py diff --git a/src/ArgHandler.py b/src/ArgHandler.py index 608c9a006..d5483984f 100644 --- a/src/ArgHandler.py +++ b/src/ArgHandler.py @@ -444,9 +444,13 @@ class ArgHandler: 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) + self.vm.read_recent_file(rf, filetype) + elif os.path.isdir(rf): + if os.path.isfile(os.path.join(rf, "name.txt")): + self.vm.read_recent_file(rf, 'x-directory/normal') #------------------------------------------------------------------------- # diff --git a/src/ViewManager.py b/src/ViewManager.py index df459d508..cf7e47fd2 100644 --- a/src/ViewManager.py +++ b/src/ViewManager.py @@ -999,7 +999,17 @@ class ViewManager: def read_recent_file(self, filename, filetype): if self.db_loader.read_file(filename, filetype): - self.post_load_newdb(filename, filetype) + + # Attempt to figure out the database title + path = os.path.join(filename, "name.txt") + try: + f = open(path) + title = f.readline().strip() + f.close() + except: + title = filename + + self.post_load_newdb(filename, filetype, title) def post_load(self): # This method is for the common UI post_load, both new files @@ -1060,7 +1070,8 @@ class ViewManager: self.state.db.enable_signals() self.state.signal_change() - #Config.set(Config.RECENT_FILE, filename) + print filename + Config.set(Config.RECENT_FILE, filename) self.relationship = self.RelClass(self.state.db) diff --git a/src/gramps_main.py b/src/gramps_main.py index 29fe9ee73..734b35bd3 100644 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -238,8 +238,8 @@ class Gramps: # we may need to change the order of operation ah = ArgHandler.ArgHandler(state,self.vm,args) if ah.need_gui(): - self.vm.post_init_interface() ah.handle_args() + self.vm.post_init_interface() else: ah.handle_args() self.vm.post_init_interface()