diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 285f67709..353e9f373 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -13,6 +13,14 @@ * src/plugins/Leak.py: icon, window management, single instance. * src/plugins/leak.glade: dialog. + * src/plugins/FilterEditor.py: single instance, help. + * src/rule.glade: icon, help. + * src/plugins/SoundGen.py: single instance, icon, help. + * src/soundex.glade: help. + * src/plugins/RelCalc.py: icon. + * src/plugins/ScratchPad.py: single instance, help. + * src/scratchpad.glade: help. + 2005-03-24 Richard Taylor * src/DdTargets.py: new module to manage drag and drop target data. * src/Makefile.am: added DdTargets.py diff --git a/gramps2/src/plugins/FilterEditor.py b/gramps2/src/plugins/FilterEditor.py index 0d7885e69..d0ae10f32 100644 --- a/gramps2/src/plugins/FilterEditor.py +++ b/gramps2/src/plugins/FilterEditor.py @@ -40,6 +40,7 @@ from gettext import gettext as _ import gtk import gtk.glade import gobject +from gnome import help_display #------------------------------------------------------------------------- # @@ -260,14 +261,17 @@ class MyEntry(gtk.Entry): #------------------------------------------------------------------------- class FilterEditor: def __init__(self,filterdb,db,parent): + self.parent = parent + if self.parent.child_windows.has_key(self.__class__): + self.parent.child_windows[self.__class__].present(None) + return + self.win_key = self.__class__ + self.child_windows = {} + self.db = db self.filterdb = GenericFilter.GenericFilterList(filterdb) self.filterdb.load() - self.parent = parent - self.win_key = self - self.child_windows = {} - self.editor = gtk.glade.XML(const.filterFile,'filter_list',"gramps") self.window = self.editor.get_widget('filter_list') self.filter_list = self.editor.get_widget('filters') @@ -283,6 +287,7 @@ class FilterEditor: 'on_edit_clicked' : self.edit_filter, 'on_test_clicked' : self.test_clicked, 'on_close_clicked' : self.close_filter_editor, + "on_help_filters_clicked" : self.on_help_clicked, 'on_delete_clicked' : self.delete_filter, 'on_filter_list_delete_event' : self.on_delete_event, }) @@ -295,6 +300,10 @@ class FilterEditor: self.add_itself_to_menu() self.window.show() + def on_help_clicked(self,obj): + """Display the relevant portion of GRAMPS manual""" + help_display('gramps-manual','tools-util') + def on_delete_event(self,obj,b): self.filterdb.save() self.close_child_windows() @@ -423,6 +432,7 @@ class EditFilter: 'on_filter_name_changed' : self.filter_name_changed, 'on_delete_clicked' : self.on_delete_clicked, 'on_add_clicked' : self.on_add_clicked, + "on_help_filtdef_clicked" : self.on_help_clicked, 'on_edit_clicked' : self.on_edit_clicked, "on_edit_filter_delete_event" : self.on_delete_event, }) @@ -443,6 +453,10 @@ class EditFilter: self.add_itself_to_menu() self.window.show() + def on_help_clicked(self,obj): + """Display the relevant portion of GRAMPS manual""" + help_display('gramps-manual','tools-util') + def on_delete_event(self,obj,b): self.close_child_windows() self.remove_itself_from_menu() @@ -705,6 +719,7 @@ class EditRule: self.rule.signal_autoconnect({ 'rule_ok_clicked' : self.rule_ok, "on_rule_edit_delete_event" : self.on_delete_event, + "on_help_rule_clicked" : self.on_help_clicked, 'rule_cancel_clicked' : self.close, }) @@ -712,6 +727,10 @@ class EditRule: self.add_itself_to_menu() self.window.show() + def on_help_clicked(self,obj): + """Display the relevant portion of GRAMPS manual""" + help_display('gramps-manual','append-filtref') + def on_delete_event(self,obj,b): self.remove_itself_from_menu() diff --git a/gramps2/src/plugins/RelCalc.py b/gramps2/src/plugins/RelCalc.py index f54feece2..c010ec550 100644 --- a/gramps2/src/plugins/RelCalc.py +++ b/gramps2/src/plugins/RelCalc.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,6 +28,7 @@ # #------------------------------------------------------------------------- import os +from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -41,13 +42,11 @@ import gtk.glade # GRAMPS modules # #------------------------------------------------------------------------- - import RelLib import Utils import NameDisplay import ListModel import PluginMgr -from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -80,12 +79,15 @@ class RelCalc: self.glade = gtk.glade.XML(glade_file,"relcalc","gramps") name = self.person.get_primary_name().get_regular_name() - + self.title = _('Relationship calculator: %(person_name)s') % { + 'person_name' : name } self.window = self.glade.get_widget('relcalc') + self.window.set_icon(self.parent.topWindow.get_icon()) Utils.set_titles(self.window, self.glade.get_widget('title'), - _('Relationship to %s') % name, - _('Relationship calculator')) + _('Relationship to %(person_name)s') % { + 'person_name' : name }, + self.title) self.people = self.glade.get_widget("peopleList") @@ -135,7 +137,7 @@ class RelCalc: 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 = gtk.MenuItem(self.title) self.parent_menu_item.connect("activate",self.present) self.parent_menu_item.show() self.parent.winsmenu.append(self.parent_menu_item) diff --git a/gramps2/src/plugins/ScratchPad.py b/gramps2/src/plugins/ScratchPad.py index c078b08a1..aa6c2229c 100644 --- a/gramps2/src/plugins/ScratchPad.py +++ b/gramps2/src/plugins/ScratchPad.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modiy # it under the terms of the GNU General Public License as published by @@ -20,9 +20,15 @@ # $Id$ +#------------------------------------------------------------------------ +# +# standard python modules +# +#------------------------------------------------------------------------ import pickle import os from xml.sax.saxutils import escape +from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -30,24 +36,20 @@ from xml.sax.saxutils import escape # #------------------------------------------------------------------------- import gtk -import gtk.gdk import gtk.glade +from gtk.gdk import ACTION_COPY, BUTTON1_MASK +from gnome import help_display #------------------------------------------------------------------------- # # gramps modules # #------------------------------------------------------------------------- - import const import Utils import ListModel import TreeTips -from gettext import gettext as _ - -from gtk.gdk import ACTION_COPY, BUTTON1_MASK - #------------------------------------------------------------------------- # # Globals @@ -90,8 +92,6 @@ from DdTargets import DdTargets ## 'srcref': [('srcref', 0, 4)], ## TEXT_TARGET: text_tgts} - - #------------------------------------------------------------------------- # # ScatchPadWindow class @@ -120,7 +120,10 @@ class ScratchPadWindow: self.db = database self.parent = parent - self.win_key = self + if self.parent.child_windows.has_key(self.__class__): + self.parent.child_windows[self.__class__].present(None) + return + self.win_key = self.__class__ self.olist = [] self.otitles = [(_('Type'),-1,150), @@ -147,6 +150,7 @@ class ScratchPadWindow: "on_close_scratchpad" : self.on_close_scratchpad, "on_clear_clicked": self.on_clear_clicked, "on_clear_all_clicked": self.on_clear_all_clicked, + "on_help_clicked": self.on_help_clicked, "on_objectlist_delete_event": self.on_delete_event, "on_scratchPad_delete_event": self.on_delete_event }) @@ -163,7 +167,6 @@ class ScratchPadWindow: self.add_itself_to_menu() self.window.show() - def on_delete_event(self,obj,b): self.remove_itself_from_menu() @@ -172,64 +175,71 @@ class ScratchPadWindow: main GRAMPS interface. If this is the first instance to be created a submenu is created, if it is not the first instance then an entry is created in the existing sub menu.""" - - sub_menu_label = _("Scratch Pad Tool") - instance_number_key = "scratch_pad_instance_number" - +##ALEX +## sub_menu_label = _("Scratch Pad Tool") +## instance_number_key = "scratch_pad_instance_number" +## +## self.parent.child_windows[self.win_key] = self +## +## # First check to see if the Scratch Pad sub menu already exists. +## # The MenuItems contain a list of child widgets, the first one +## # should be the AccelLabel so we can check the label text on +## # that one. +## sub_menu_list = [ menu for menu in self.parent.winsmenu.get_children() if \ +## menu.get_children()[0].get_label() == sub_menu_label ] +## +## if len(sub_menu_list) > 0: +## # This list should always be of length 0 or 1 but in the unlikely +## # situation that it is greater than 1 it will still be safe to use +## # the first. +## self.parent_menu_item = sub_menu_list[0] +## else: +## # There is no existing instances so we must create the submenu. +## self.parent_menu_item = gtk.MenuItem(sub_menu_label) +## self.parent_menu_item.set_submenu(gtk.Menu()) +## self.parent_menu_item.show() +## self.parent.winsmenu.append(self.parent_menu_item) +## +## # Get a handle to the submenu and remember it so that +## # remove_itself_from_menu can delete it later. +## self.winsmenu = self.parent_menu_item.get_submenu() +## +## # Get the first available instance number. The instance number +## # is stored in the data item store of the menu item so we can +## # read it with get_data. +## num = 1 +## existing_instances = [ menu_item.get_data(instance_number_key) \ +## for menu_item in self.winsmenu.get_children() ] +## +## if len(existing_instances) > 0: +## # Calculate the first available instance number. +## existing_instances.sort() +## for instance_num in existing_instances: +## if instance_num != num: +## break +## else: +## num += 1 +## +## # Create the instance menuitem with the instance number in the +## # label. +## instance_title = _('Scratch Pad - %d') % (num,) +## self.menu_item = gtk.MenuItem(instance_title) +## self.menu_item.set_data(instance_number_key,num) +## self.menu_item.connect("activate",self.present) +## self.menu_item.show() +## +## # Set the window title to the same as the menu label. +## self.window.set_title(instance_title) +## +## # Add the item to the submenu. +## self.winsmenu.append(self.menu_item) +## +##ALEX This code remporarily replaces the commented above self.parent.child_windows[self.win_key] = self - - # First check to see if the Scratch Pad sub menu already exists. - # The MenuItems contain a list of child widgets, the first one - # should be the AccelLabel so we can check the label text on - # that one. - sub_menu_list = [ menu for menu in self.parent.winsmenu.get_children() if \ - menu.get_children()[0].get_label() == sub_menu_label ] - - if len(sub_menu_list) > 0: - # This list should always be of length 0 or 1 but in the unlikely - # situation that it is greater than 1 it will still be safe to use - # the first. - self.parent_menu_item = sub_menu_list[0] - else: - # There is no existing instances so we must create the submenu. - self.parent_menu_item = gtk.MenuItem(sub_menu_label) - self.parent_menu_item.set_submenu(gtk.Menu()) - self.parent_menu_item.show() - self.parent.winsmenu.append(self.parent_menu_item) - - # Get a handle to the submenu and remember it so that - # remove_itself_from_menu can delete it later. - self.winsmenu = self.parent_menu_item.get_submenu() - - # Get the first available instance number. The instance number - # is stored in the data item store of the menu item so we can - # read it with get_data. - num = 1 - existing_instances = [ menu_item.get_data(instance_number_key) \ - for menu_item in self.winsmenu.get_children() ] - - if len(existing_instances) > 0: - # Calculate the first available instance number. - existing_instances.sort() - for instance_num in existing_instances: - if instance_num != num: - break - else: - num += 1 - - # Create the instance menuitem with the instance number in the - # label. - instance_title = _('Scratch Pad - %d') % (num,) - self.menu_item = gtk.MenuItem(instance_title) - self.menu_item.set_data(instance_number_key,num) - self.menu_item.connect("activate",self.present) - self.menu_item.show() - - # Set the window title to the same as the menu label. - self.window.set_title(instance_title) - - # Add the item to the submenu. - self.winsmenu.append(self.menu_item) + self.parent_menu_item = gtk.MenuItem(_('Scratch Pad')) + 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): """Remove the instance of the pad from the Window menu in the @@ -237,14 +247,20 @@ class ScratchPadWindow: ScratchPad sub menu as well.""" del self.parent.child_windows[self.win_key] - self.menu_item.destroy() - if len(self.winsmenu.get_children()) == 0: - self.winsmenu.destroy() - self.parent_menu_item.destroy() +##ALEX +## self.menu_item.destroy() +## if len(self.winsmenu.get_children()) == 0: +## self.winsmenu.destroy() +## self.parent_menu_item.destroy() +##ALEX This code remporarily replaces the commented above + self.parent_menu_item.destroy() def present(self,obj): self.window.present() + def on_help_clicked(self,obj): + """Display the relevant portion of GRAMPS manual""" + help_display('gramps-manual','tools-util') def on_close_scratchpad(self,obj): self.remove_itself_from_menu() diff --git a/gramps2/src/plugins/SoundGen.py b/gramps2/src/plugins/SoundGen.py index 38909e646..f5c657189 100644 --- a/gramps2/src/plugins/SoundGen.py +++ b/gramps2/src/plugins/SoundGen.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,17 +22,32 @@ "Utilities/Generate SoundEx codes" +#------------------------------------------------------------------------ +# +# standard python modules +# +#------------------------------------------------------------------------ import os +from gettext import gettext as _ +#------------------------------------------------------------------------ +# +# GNOME/GTK modules +# +#------------------------------------------------------------------------ import gtk import gtk.glade +from gnome import help_display +#------------------------------------------------------------------------ +# +# GRAMPS modules +# +#------------------------------------------------------------------------ import soundex import Utils import AutoComp -from gettext import gettext as _ - #------------------------------------------------------------------------- # # @@ -40,12 +55,18 @@ from gettext import gettext as _ def runTool(database,active_person,callback,parent=None): SoundGen(database,active_person,parent) - +#------------------------------------------------------------------------- +# +# +#------------------------------------------------------------------------- class SoundGen: def __init__(self,database,active_person,parent): self.db = database self.parent = parent - self.win_key = self + if self.parent.child_windows.has_key(self.__class__): + self.parent.child_windows[self.__class__].present(None) + return + self.win_key = self.__class__ base = os.path.dirname(__file__) glade_file = base + os.sep + "soundex.glade" @@ -53,10 +74,12 @@ class SoundGen: self.glade = gtk.glade.XML(glade_file,"soundEx","gramps") self.glade.signal_autoconnect({ "destroy_passed_object" : self.close, + "on_help_clicked" : self.on_help_clicked, "on_delete_event" : self.on_delete_event, }) self.window = self.glade.get_widget("soundEx") + self.window.set_icon(self.parent.topWindow.get_icon()) Utils.set_titles(self.window, self.glade.get_widget('title'), _('SoundEx code generator')) @@ -89,10 +112,13 @@ class SoundGen: else: self.name.set_text("") - self.window.show() self.add_itself_to_menu() self.window.show() + def on_help_clicked(self,obj): + """Display the relevant portion of GRAMPS manual""" + help_display('gramps-manual','tools-util') + def on_delete_event(self,obj,b): self.remove_itself_from_menu() diff --git a/gramps2/src/plugins/scratchpad.glade b/gramps2/src/plugins/scratchpad.glade index 983f07f86..b745e8dd2 100644 --- a/gramps2/src/plugins/scratchpad.glade +++ b/gramps2/src/plugins/scratchpad.glade @@ -4,116 +4,6 @@ - - True - Scratch Pad - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - 400 - 200 - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - - - - - True - False - 0 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - False - False - False - - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_END - 0 - - - - True - True - True - Clear_All - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - C_lear - True - GTK_RELIEF_NORMAL - True - - - - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - - - - - - 3 - False - True - - - - - - True Scratch Pad @@ -129,7 +19,6 @@ False GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST - True True @@ -146,7 +35,6 @@ True - False True True gtk-help @@ -225,9 +113,6 @@ False False True - False - False - False diff --git a/gramps2/src/plugins/soundex.glade b/gramps2/src/plugins/soundex.glade index cf8fd863a..6cf748206 100644 --- a/gramps2/src/plugins/soundex.glade +++ b/gramps2/src/plugins/soundex.glade @@ -44,6 +44,20 @@ + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + True + -11 + + + 0 diff --git a/gramps2/src/rule.glade b/gramps2/src/rule.glade index aec7737f3..f33e8d8dc 100644 --- a/gramps2/src/rule.glade +++ b/gramps2/src/rule.glade @@ -60,6 +60,20 @@ + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + True + -11 + + + 0 @@ -610,6 +624,20 @@ + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + True + -11 + + + 0 @@ -783,9 +811,9 @@ True - Note: changes take effect only after this window is closed + <i>Note: changes take effect only after this window is closed</i> False - False + True GTK_JUSTIFY_LEFT False False @@ -930,6 +958,7 @@ False True False + gramps.png True False False @@ -976,6 +1005,20 @@ + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + True + -11 + + + 0