* 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.


svn: r4235
This commit is contained in:
Alex Roitman 2005-03-25 03:34:52 +00:00
parent 0f1878e639
commit 5f0f7001fa
8 changed files with 219 additions and 206 deletions

View File

@ -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 <rjt-gramps@thegrindstone.me.uk>
* src/DdTargets.py: new module to manage drag and drop target data.
* src/Makefile.am: added DdTargets.py

View File

@ -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()

View File

@ -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)

View File

@ -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,79 +175,92 @@ 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 = 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)
# 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)
def remove_itself_from_menu(self):
"""Remove the instance of the pad from the Window menu in the
main GRAMPS window. If this is the last pad then remove the
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()
##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()

View File

@ -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()

View File

@ -4,116 +4,6 @@
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkWindow" id="scratchPad">
<property name="visible">True</property>
<property name="title" translatable="yes">Scratch Pad</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">400</property>
<property name="default_height">200</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<signal name="delete_event" handler="on_scratchPad_delete_event" object="ScratchPad" last_modification_time="Fri, 11 Mar 2005 11:35:07 GMT"/>
<child>
<widget class="GtkVBox" id="vbx_scratchpad">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow85">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="objectlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
<signal name="delete_event" handler="on_objectlist_delete_event" object="ScratchPad" last_modification_time="Wed, 09 Mar 2005 13:48:09 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox37">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">0</property>
<child>
<widget class="GtkButton" id="btn_clear_all">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Clear_All</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_clear_all_clicked" object="ScratchPad" last_modification_time="Tue, 08 Mar 2005 15:26:49 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="btn_clear">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">C_lear</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_clear_clicked" object="ScratchPad" last_modification_time="Tue, 08 Mar 2005 15:26:40 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="btn_close">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_close_scratchpad" object="ScratchPad" last_modification_time="Tue, 08 Mar 2005 15:26:57 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">3</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
<widget class="GtkDialog" id="scratch_pad">
<property name="visible">True</property>
<property name="title" translatable="yes">Scratch Pad</property>
@ -129,7 +19,6 @@
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
@ -146,7 +35,6 @@
<child>
<widget class="GtkButton" id="helpbutton1">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
@ -225,9 +113,6 @@
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
</widget>
</child>
</widget>

View File

@ -44,6 +44,20 @@
<signal name="clicked" handler="destroy_passed_object" object="soundEx"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button4">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_clicked" last_modification_time="Fri, 25 Mar 2005 02:17:46 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -60,6 +60,20 @@
<signal name="clicked" handler="on_ok_clicked"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button11">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_filtdef_clicked" last_modification_time="Fri, 25 Mar 2005 02:22:11 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -610,6 +624,20 @@
</child>
</widget>
</child>
<child>
<widget class="GtkButton" id="button10">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_filters_clicked" last_modification_time="Fri, 25 Mar 2005 02:20:54 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -783,9 +811,9 @@
<child>
<widget class="GtkLabel" id="label30">
<property name="visible">True</property>
<property name="label" translatable="yes">Note: changes take effect only after this window is closed</property>
<property name="label" translatable="yes">&lt;i&gt;Note: changes take effect only after this window is closed&lt;/i&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
@ -930,6 +958,7 @@
<property name="modal">False</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="icon">gramps.png</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
@ -976,6 +1005,20 @@
<signal name="clicked" handler="rule_ok_clicked" last_modification_time="Mon, 10 May 2004 04:30:20 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="button12">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_rule_clicked" last_modification_time="Fri, 25 Mar 2005 02:22:53 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>