From f14d881fb73eb4c7d38fb21de76cf264ee3895cb Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 10 Feb 2006 05:36:32 +0000 Subject: [PATCH] * src/DisplayState.py: Manage history on db change * src/Navigation.py: Manage history on db change svn: r5918 --- gramps2/ChangeLog | 2 ++ gramps2/src/DisplayState.py | 3 +++ gramps2/src/Navigation.py | 7 +++++-- gramps2/src/ViewManager.py | 8 ++++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 59e0cbf53..fbf575995 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,6 @@ 2006-02-09 Don Allingham + * src/DisplayState.py: Manage history on db change + * src/Navigation.py: Manage history on db change * src/PedView.py: fix quote * src/PersonView.py: reset db and build tree on database reload * src/GrampsDb/_GrampsDbBase.py: clear active on database change diff --git a/gramps2/src/DisplayState.py b/gramps2/src/DisplayState.py index 4ac90b4d2..7b0ea5e2c 100644 --- a/gramps2/src/DisplayState.py +++ b/gramps2/src/DisplayState.py @@ -585,6 +585,9 @@ class DisplayState(GrampsDb.GrampsDBCallback): self.log.setLevel(logging.WARN) self.log.addHandler(self.rh) + def clear_history(self): + self.phistory.clear() + def set_busy_cursor(self,value): if value: self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) diff --git a/gramps2/src/Navigation.py b/gramps2/src/Navigation.py index c780cecc9..f8bceec9f 100644 --- a/gramps2/src/Navigation.py +++ b/gramps2/src/Navigation.py @@ -46,11 +46,14 @@ class BaseNavigation: def __init__(self,uistate,history,title): self.title = title self.ui = _top+_btm - history.connect('menu-changed', self.update_menu) + self.uistate = uistate self.action_group = gtk.ActionGroup(self.title) self.active = DISABLED - self.uistate = uistate self.items = [] + self.history = history + + def clear(self): + self.history.clear() def disable(self): """ diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index edf041b57..3acf91c87 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -234,8 +234,8 @@ class ViewManager: self.uistate.set_open_widget(openbtn) toolbar.insert(openbtn,1) - person_nav = Navigation.PersonNavigation(self.uistate) - self.navigation_type[PageView.NAVIGATION_PERSON] = (person_nav,None) + self.person_nav = Navigation.PersonNavigation(self.uistate) + self.navigation_type[PageView.NAVIGATION_PERSON] = (self.person_nav,None) self.recent_manager = DisplayState.RecentDocsMenu(self.uistate,self.state, self.read_file) self.recent_manager.build() @@ -654,6 +654,7 @@ class ViewManager: except: pass self.state.change_database(GrampsDb.gramps_db_factory(const.app_gramps)()) + self.uistate.clear_history() self.read_file(filename) self.change_page(None,None) # Add the file to the recent items @@ -693,6 +694,7 @@ class ViewManager: RecentFiles.recent_files(filename,filetype) self.recent_manager.build() + self.uistate.clear_history() return success def read_file(self,filename,callback=None): @@ -932,6 +934,7 @@ class ViewManager: self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) self.progress.show() GrampsDb.gramps_db_reader_factory(filetype)(self.state.db,filename,self.pulse_progressbar) + self.uistate.clear_history() self.progress.hide() self.window.window.set_cursor(None) return True @@ -940,6 +943,7 @@ class ViewManager: self.window.window.set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH)) self.progress.show() GrampsDb.gramps_db_reader_factory(filetype)(self.state.db,filename,self.pulse_progressbar) + self.uistate.clear_history() self.progress.hide() self.window.window.set_cursor(None) return True