From 739729de9786e2188c9dc719ada07ff064ec4449 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 11 May 2004 01:51:56 +0000 Subject: [PATCH] * src/plugins/SoundGen.py: Window management. Replaces soundgen.py. * src/plugins/soundgen.py: Remove from CVS. * src/plugins/soundex.glade: Define event handler. * src/plugins/RelCalc.py: Window management. * src/plugins/relcalc.glade: Define event handler. * src/plugins/Makefile.am: Ship SoundGen.py instead of soundgen.py. * src/plugins/Verify.py: Window management. * src/plugins/verify.glade: Define event handler. svn: r3154 --- gramps2/ChangeLog | 9 ++ gramps2/src/plugins/Makefile.am | 2 +- gramps2/src/plugins/Merge.py | 15 +- gramps2/src/plugins/RelCalc.py | 38 ++++- .../src/plugins/{soundgen.py => SoundGen.py} | 39 ++++- gramps2/src/plugins/Verify.py | 70 +++++++-- gramps2/src/plugins/relcalc.glade | 9 ++ gramps2/src/plugins/soundex.glade | 7 + gramps2/src/plugins/verify.glade | 141 +++--------------- 9 files changed, 179 insertions(+), 151 deletions(-) rename gramps2/src/plugins/{soundgen.py => SoundGen.py} (71%) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 8693aedbf..52aabbfe6 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -12,6 +12,15 @@ * src/plugins/merge.glade: Define event handlers. * src/plugins/ChangeTypes.py: Convert to db. + * src/plugins/SoundGen.py: Window management. Replaces soundgen.py. + * src/plugins/soundgen.py: Remove from CVS. + * src/plugins/soundex.glade: Define event handler. + * src/plugins/RelCalc.py: Window management. + * src/plugins/relcalc.glade: Define event handler. + * src/plugins/Makefile.am: Ship SoundGen.py instead of soundgen.py. + * src/plugins/Verify.py: Window management. + * src/plugins/verify.glade: Define event handler. + 2004-05-09 Don Allingham * src/DbPrompter.py: added a .grdb if not specified. diff --git a/gramps2/src/plugins/Makefile.am b/gramps2/src/plugins/Makefile.am index 72c205ebf..7888d6f26 100644 --- a/gramps2/src/plugins/Makefile.am +++ b/gramps2/src/plugins/Makefile.am @@ -32,7 +32,7 @@ pkgpython_PYTHON = \ ReadNative.py\ RelCalc.py\ ReorderIds.py\ - soundgen.py\ + SoundGen.py\ Summary.py\ TimeLine.py\ Verify.py\ diff --git a/gramps2/src/plugins/Merge.py b/gramps2/src/plugins/Merge.py index 130309868..a9345c166 100644 --- a/gramps2/src/plugins/Merge.py +++ b/gramps2/src/plugins/Merge.py @@ -237,6 +237,7 @@ class Merge: def show(self): top = gtk.glade.XML(self.glade_file,"mergelist","gramps") self.window = top.get_widget("mergelist") + self.win_show_key = self.window Utils.set_titles(self.window, top.get_widget('title'), _('Potential Merges')) @@ -265,15 +266,15 @@ class Merge: self.window.destroy() def add_show_to_menu(self): - self.parent.child_windows[self.win_key] = self - self.parent_menu_item = gtk.MenuItem(_('Potential Merges')) - self.parent_menu_item.connect("activate",self.present_show) - self.parent_menu_item.show() - self.parent.winsmenu.append(self.parent_menu_item) + self.show_parent.child_windows[self.win_show_key] = self.window + self.show_parent_menu_item = gtk.MenuItem(_('Potential Merges')) + self.show_parent_menu_item.connect("activate",self.present_show) + self.show_parent_menu_item.show() + self.parent.winsmenu.append(self.show_parent_menu_item) def remove_show_from_menu(self): - del self.parent.child_windows[self.win_key] - self.parent_menu_item.destroy() + del self.parent.child_windows[self.win_show_key] + self.show_parent_menu_item.destroy() def present_show(self,obj): self.window.present() diff --git a/gramps2/src/plugins/RelCalc.py b/gramps2/src/plugins/RelCalc.py index 4210fa773..5987ef828 100644 --- a/gramps2/src/plugins/RelCalc.py +++ b/gramps2/src/plugins/RelCalc.py @@ -53,8 +53,8 @@ from gettext import gettext as _ # # #------------------------------------------------------------------------- -def runTool(database,person,callback): - RelCalc(database,person) +def runTool(database,person,callback,parent=None): + RelCalc(database,person,parent) #------------------------------------------------------------------------- # @@ -66,11 +66,13 @@ class RelCalc: Relationship calculator class. """ - def __init__(self,database,person): + def __init__(self,database,person,parent): self.person = person self.db = database self.RelClass = Plugins.relationship_class self.relationship = self.RelClass(database) + self.parent = parent + self.win_key = self base = os.path.dirname(__file__) glade_file = "%s/relcalc.glade" % base @@ -78,7 +80,8 @@ class RelCalc: name = self.person.get_primary_name().get_regular_name() - Utils.set_titles(self.glade.get_widget('relcalc'), + self.window = self.glade.get_widget('relcalc') + Utils.set_titles(self.window, self.glade.get_widget('title'), _('Relationship to %s') % name, _('Relationship calculator')) @@ -100,10 +103,35 @@ class RelCalc: self.clist.connect_model() self.glade.signal_autoconnect({ - "on_close_clicked" : Utils.destroy_passed_object, + "on_close_clicked" : self.close, + "on_delete_event" : self.on_delete_event, "on_apply_clicked" : self.on_apply_clicked }) + self.add_itself_to_menu() + self.window.show() + + def on_delete_event(self,obj,b): + self.remove_itself_from_menu() + + def close(self,obj): + self.remove_itself_from_menu() + self.window.destroy() + + def add_itself_to_menu(self): + self.parent.child_windows[self.win_key] = self + self.parent_menu_item = gtk.MenuItem(_('Relationship calculator tool')) + self.parent_menu_item.connect("activate",self.present) + self.parent_menu_item.show() + self.parent.winsmenu.append(self.parent_menu_item) + + def remove_itself_from_menu(self): + del self.parent.child_windows[self.win_key] + self.parent_menu_item.destroy() + + def present(self,obj): + self.window.present() + def on_apply_clicked(self,obj): model,iter = self.clist.get_selected() if not iter: diff --git a/gramps2/src/plugins/soundgen.py b/gramps2/src/plugins/SoundGen.py similarity index 71% rename from gramps2/src/plugins/soundgen.py rename to gramps2/src/plugins/SoundGen.py index 484389a12..c72d89b5b 100644 --- a/gramps2/src/plugins/soundgen.py +++ b/gramps2/src/plugins/SoundGen.py @@ -37,23 +37,27 @@ from gettext import gettext as _ # # #------------------------------------------------------------------------- -def runTool(database,active_person,callback): - SoundGen(database,active_person) +def runTool(database,active_person,callback,parent=None): + SoundGen(database,active_person,parent) class SoundGen: - def __init__(self,database,active_person): + def __init__(self,database,active_person,parent): self.db = database + self.parent = parent + self.win_key = self base = os.path.dirname(__file__) glade_file = base + os.sep + "soundex.glade" self.glade = gtk.glade.XML(glade_file,"soundEx","gramps") self.glade.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, + "destroy_passed_object" : self.close, + "on_delete_event" : self.on_delete_event, }) - Utils.set_titles(self.glade.get_widget('soundEx'), + self.window = self.glade.get_widget("soundEx") + Utils.set_titles(self.window, self.glade.get_widget('title'), _('SoundEx code generator')) @@ -84,7 +88,30 @@ class SoundGen: else: self.name.set_text("") - self.glade.get_widget("soundEx").show() + self.window.show() + self.add_itself_to_menu() + self.window.show() + + def on_delete_event(self,obj,b): + self.remove_itself_from_menu() + + def close(self,obj): + self.remove_itself_from_menu() + self.window.destroy() + + def add_itself_to_menu(self): + self.parent.child_windows[self.win_key] = self + self.parent_menu_item = gtk.MenuItem(_('SoundEx code generator tool')) + self.parent_menu_item.connect("activate",self.present) + self.parent_menu_item.show() + self.parent.winsmenu.append(self.parent_menu_item) + + def remove_itself_from_menu(self): + del self.parent.child_windows[self.win_key] + self.parent_menu_item.destroy() + + def present(self,obj): + self.window.present() def on_apply_clicked(self,obj): try: diff --git a/gramps2/src/plugins/Verify.py b/gramps2/src/plugins/Verify.py index a4c99aa6e..0e68c8c05 100644 --- a/gramps2/src/plugins/Verify.py +++ b/gramps2/src/plugins/Verify.py @@ -57,30 +57,57 @@ import Gregorian from gettext import gettext as _ -def runTool(database,active_person,callback): - Verify(database,active_person) +def runTool(database,active_person,callback,parent=None): + Verify(database,active_person,parent) #------------------------------------------------------------------------- # # #------------------------------------------------------------------------- class Verify: - def __init__(self,database,active_person): + def __init__(self,database,active_person,parent): self.db = database + self.parent = parent + self.win_key = self base = os.path.dirname(__file__) self.glade_file = base + os.sep + "verify.glade" self.top = gtk.glade.XML(self.glade_file,"verify_settings","gramps") self.top.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, - "on_verify_ok_clicked" : self.on_apply_clicked + "destroy_passed_object" : self.close, + "on_verify_delete_event" : self.on_delete_event, + "on_verify_ok_clicked" : self.on_apply_clicked }) - Utils.set_titles(self.top.get_widget('verify_settings'), + self.window = self.top.get_widget('verify_settings') + Utils.set_titles(self.window, self.top.get_widget('title'), _('Database Verify')) + self.add_itself_to_menu() + self.window.show() + + def on_delete_event(self,obj,b): + self.remove_itself_from_menu() + + def close(self,obj): + self.remove_itself_from_menu() + self.window.destroy() + + def add_itself_to_menu(self): + self.parent.child_windows[self.win_key] = self + self.parent_menu_item = gtk.MenuItem(_('Database Verify')) + self.parent_menu_item.connect("activate",self.present) + self.parent_menu_item.show() + self.parent.winsmenu.append(self.parent_menu_item) + + def remove_itself_from_menu(self): + del self.parent.child_windows[self.win_key] + self.parent_menu_item.destroy() + + def present(self,obj): + self.window.present() def get_year(self,event_id): """ @@ -435,14 +462,39 @@ class Verify: _('Database Verify')) top.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, + "destroy_passed_object" : self.close_result, + "on_result_delete_event" : self.on_result_delete_event, }) - topwin = top.get_widget("verify_result") + self.topwin = top.get_widget("verify_result") + self.win_result_key = self.topwin textwindow = top.get_widget("textwindow") textwindow.get_buffer().set_text(text) - topwin.show() + + self.add_result_to_menu() + self.topwin.show() + def on_result_delete_event(self,obj,b): + self.remove_result_from_menu() + + def close_result(self,obj): + self.remove_result_from_menu() + self.topwin.destroy() + + def add_result_to_menu(self): + self.parent.child_windows[self.win_result_key] = self.topwin + self.result_parent_menu_item = gtk.MenuItem(_('Database Verify results')) + self.result_parent_menu_item.connect("activate",self.present_result) + self.result_parent_menu_item.show() + self.parent.winsmenu.append(self.result_parent_menu_item) + + def remove_result_from_menu(self): + del self.parent.child_windows[self.win_result_key] + self.result_parent_menu_item.destroy() + + def present_result(self,obj): + self.topwin.present() + #------------------------------------------------------------------------- # # diff --git a/gramps2/src/plugins/relcalc.glade b/gramps2/src/plugins/relcalc.glade index 6a783164a..e7a72c495 100644 --- a/gramps2/src/plugins/relcalc.glade +++ b/gramps2/src/plugins/relcalc.glade @@ -13,7 +13,13 @@ 400 True False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST False + @@ -34,6 +40,7 @@ gtk-close True GTK_RELIEF_NORMAL + True 0 @@ -117,6 +124,8 @@ True True False + False + True GTK_JUSTIFY_LEFT GTK_WRAP_WORD True diff --git a/gramps2/src/plugins/soundex.glade b/gramps2/src/plugins/soundex.glade index 8d24ef46c..433a9c078 100644 --- a/gramps2/src/plugins/soundex.glade +++ b/gramps2/src/plugins/soundex.glade @@ -11,7 +11,13 @@ False True False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST False + @@ -33,6 +39,7 @@ gtk-close True GTK_RELIEF_NORMAL + True 0 diff --git a/gramps2/src/plugins/verify.glade b/gramps2/src/plugins/verify.glade index 5c94e32b9..b2369341f 100644 --- a/gramps2/src/plugins/verify.glade +++ b/gramps2/src/plugins/verify.glade @@ -4,129 +4,6 @@ - - True - - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 500 - 400 - True - False - False - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - - - - True - GTK_BUTTONBOX_END - 30 - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - - - - - - - - 0 - False - True - GTK_PACK_END - - - - - - 6 - True - False - 0 - - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 6 - - - 8 - False - False - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - False - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - True @@ -135,6 +12,12 @@ False True False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + @@ -903,6 +786,7 @@ Estimate missing dates True GTK_RELIEF_NORMAL + True False False True @@ -945,6 +829,7 @@ gtk-cancel True GTK_RELIEF_NORMAL + True @@ -957,6 +842,7 @@ gtk-ok True GTK_RELIEF_NORMAL + True @@ -981,6 +867,12 @@ 400 True False + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + @@ -1030,6 +922,8 @@ True True False + False + True GTK_JUSTIFY_LEFT GTK_WRAP_NONE True @@ -1071,6 +965,7 @@ gtk-close True GTK_RELIEF_NORMAL + True