From 6c18165084cb194688ff3d2758a9745ed9c64adc Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 22 Apr 2003 21:52:59 +0000 Subject: [PATCH] Fixed Find from popping up multiple windows. svn: r1474 --- gramps2/src/Find.py | 13 ++++++++++++- gramps2/src/gramps_main.py | 24 ++++++++++++++++++++---- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/gramps2/src/Find.py b/gramps2/src/Find.py index 4c609e2f8..d87ccddd3 100644 --- a/gramps2/src/Find.py +++ b/gramps2/src/Find.py @@ -70,12 +70,15 @@ class FindBase: 'on_close_clicked' : self.on_close_clicked, }) self.top = self.glade.get_widget('find') + self.top.connect('delete_event',self.on_destroy) + self.entry = self.glade.get_widget('entry') self.forward_button = self.glade.get_widget('forward') self.back_button = self.glade.get_widget('back') Utils.set_titles(self.top, self.glade.get_widget('title'), name) self.list = None self.index = 0 + self.visible = 1 def get_value(self,id): return id @@ -114,8 +117,16 @@ class FindBase: def on_close_clicked(self,obj): """Destroys the window in response to a close window button press""" - self.top.destroy() + self.visible = 0 + self.top.hide() + def on_destroy(self,obj,event): + self.on_close_clicked(obj) + return 1 + + def show(self): + self.top.show() + def on_next_clicked(self,obj): """Advances to the next person that matches the dialog text""" self.advance(self.forward) diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 86824b23c..fbcf1b013 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -322,6 +322,10 @@ class Gramps: self.enable_filter(self.use_filter) self.enable_sidebar(self.use_sidebar) + self.find_place = None + self.find_person = None + self.find_source = None + self.find_media = None self.topWindow.show() def change_alpha_page(self,obj,junk,page): @@ -439,13 +443,25 @@ class Gramps: def on_find_activate(self,obj): """Display the find box""" if self.views.get_current_page() == 4: - Find.FindPlace(self.find_goto_place,self.db) + if self.find_place: + self.find_place.show() + else: + self.find_place = Find.FindPlace(self.find_goto_place,self.db) elif self.views.get_current_page() == 3: - Find.FindSource(self.find_goto_source,self.db) + if self.find_source: + self.find_source.show() + else: + Find.FindSource(self.find_goto_source,self.db) elif self.views.get_current_page() == 5: - Find.FindMedia(self.find_goto_media,self.db) + if self.find_media: + self.find_media.show() + else: + Find.FindMedia(self.find_goto_media,self.db) else: - Find.FindPerson(self.find_goto_person,self.db) + if self.find_person: + self.find_person.show() + else: + self.find_person = Find.FindPerson(self.find_goto_person,self.db) def on_findname_activate(self,obj): """Display the find box"""