diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 399996860..285f67709 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -5,6 +5,14 @@ * src/plugins/summary.glade: non-modal dialog. * src/plugins/Verify.py (VerifyResults): Use title once. + * src/plugins/ChangeTypes.py: icon, window management, single instance. + * src/plugins/changetype.glade: delete event. + * src/plugins/ReorderIds.py: Disable for the time being. + * src/plugins/Eval.py: icon, window management, single instance. + * src/plugins/eval.glade: dialog. + * src/plugins/Leak.py: icon, window management, single instance. + * src/plugins/leak.glade: dialog. + 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/ChangeTypes.py b/gramps2/src/plugins/ChangeTypes.py index 4d84cda3a..f4fbaded1 100644 --- a/gramps2/src/plugins/ChangeTypes.py +++ b/gramps2/src/plugins/ChangeTypes.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,14 +22,29 @@ "Database Processing/Rename personal event types" +#------------------------------------------------------------------------ +# +# standard python modules +# +#------------------------------------------------------------------------ import os +from gettext import gettext as _ +#------------------------------------------------------------------------ +# +# GNOME/GTK modules +# +#------------------------------------------------------------------------ import gtk import gtk.glade +#------------------------------------------------------------------------ +# +# GRAMPS modules +# +#------------------------------------------------------------------------ import const import Utils -from gettext import gettext as _ from QuestionDialog import OkDialog import AutoComp @@ -54,6 +69,12 @@ class ChangeTypes: def __init__(self,db,person,parent): self.person = person self.db = db + 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.trans = db.transaction_begin() base = os.path.dirname(__file__) glade_file = "%s/%s" % (base,"changetype.glade") @@ -65,15 +86,43 @@ class ChangeTypes: AutoComp.fill_combo(self.auto1,const.personalEvents) AutoComp.fill_combo(self.auto2,const.personalEvents) - Utils.set_titles(self.glade.get_widget('top'), + self.title = _('Change Event Types') + self.window = self.glade.get_widget('top') + self.window.set_icon(self.parent.topWindow.get_icon()) + Utils.set_titles(self.window, self.glade.get_widget('title'), - _('Change event types')) + self.title) self.glade.signal_autoconnect({ - "on_close_clicked" : Utils.destroy_passed_object, - "on_apply_clicked" : self.on_apply_clicked + "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(self.title) + 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): modified = 0 original = unicode(self.auto1.child.get_text()) @@ -95,9 +144,9 @@ class ChangeTypes: else: msg = _("%d event records were modified") % modified - OkDialog(_('Change types'),msg) + OkDialog(_('Change types'),msg,self.parent) self.db.transaction_commit(self.trans,_('Change types')) - Utils.destroy_passed_object(obj) + self.close(None) #------------------------------------------------------------------------ # diff --git a/gramps2/src/plugins/Eval.py b/gramps2/src/plugins/Eval.py index 6159f7bdd..d64757876 100644 --- a/gramps2/src/plugins/Eval.py +++ b/gramps2/src/plugins/Eval.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2003-2004 Donald N. Allingham +# Copyright (C) 2003-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 @@ -23,27 +23,50 @@ """ Provides a python evaluation window """ +#------------------------------------------------------------------------ +# +# standard python modules +# +#------------------------------------------------------------------------ import os import cStringIO import sys +from gettext import gettext as _ +#------------------------------------------------------------------------ +# +# GNOME/GTK modules +# +#------------------------------------------------------------------------ import gtk import gtk.glade +#------------------------------------------------------------------------ +# +# GRAMPS modules +# +#------------------------------------------------------------------------ import Utils -from gettext import gettext as _ - +#------------------------------------------------------------------------- +# +# Actual tool +# +#------------------------------------------------------------------------- class EvalWindow: def __init__(self,parent): 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__ glade_file = "%s/%s" % (os.path.dirname(__file__),"eval.glade") self.glade = gtk.glade.XML(glade_file,"top","gramps") self.top = self.glade.get_widget("top") + self.top.set_icon(self.parent.topWindow.get_icon()) self.dbuf = self.glade.get_widget("display").get_buffer() self.ebuf = self.glade.get_widget("eval").get_buffer() self.error = self.glade.get_widget("error").get_buffer() diff --git a/gramps2/src/plugins/Leak.py b/gramps2/src/plugins/Leak.py index 39ef127be..7040c3039 100644 --- a/gramps2/src/plugins/Leak.py +++ b/gramps2/src/plugins/Leak.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2003-2004 Donald N. Allingham +# Copyright (C) 2003-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 @@ -24,28 +24,58 @@ Show uncollected objects in a window. """ +#------------------------------------------------------------------------ +# +# standard python modules +# +#------------------------------------------------------------------------ import os +from gettext import gettext as _ + +#------------------------------------------------------------------------ +# +# GNOME/GTK modules +# +#------------------------------------------------------------------------ import gtk import gtk.glade import gc -import string -from gettext import gettext as _ +#------------------------------------------------------------------------ +# +# GRAMPS modules +# +#------------------------------------------------------------------------ +import Utils +#------------------------------------------------------------------------- +# +# Actual tool +# +#------------------------------------------------------------------------- class Leak: def __init__(self,parent): 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__ glade_file = "%s/%s" % (os.path.dirname(__file__),"leak.glade") self.glade = gtk.glade.XML(glade_file,"top","gramps") self.top = self.glade.get_widget("top") + self.top.set_icon(self.parent.topWindow.get_icon()) self.eval = self.glade.get_widget("eval") self.ebuf = self.eval.get_buffer() gc.set_debug(gc.DEBUG_UNCOLLECTABLE | gc.DEBUG_OBJECTS | gc.DEBUG_SAVEALL) + self.title = _('Uncollected Objects Tool') + Utils.set_titles(self.top, + self.glade.get_widget('title'), + self.title) + self.glade.signal_autoconnect({ "on_apply_clicked" : self.apply_clicked, "on_delete_event" : self.on_delete_event, @@ -65,7 +95,7 @@ class Leak: def add_itself_to_menu(self): self.parent.child_windows[self.win_key] = self - self.parent_menu_item = gtk.MenuItem(_('Uncollected objects')) + 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) @@ -83,7 +113,7 @@ class Leak: if len(gc.garbage): for each in gc.garbage: mylist.append(str(each)) - self.ebuf.set_text(_("Uncollected objects:\n\n") + string.join(mylist,'\n\n')) + self.ebuf.set_text(_("Uncollected objects:\n\n") + '\n\n'.join(mylist)) else: self.ebuf.set_text(_("No uncollected objects\n") + str(gc.get_debug())) diff --git a/gramps2/src/plugins/ReorderIds.py b/gramps2/src/plugins/ReorderIds.py index 5a4369aa3..7e978f732 100644 --- a/gramps2/src/plugins/ReorderIds.py +++ b/gramps2/src/plugins/ReorderIds.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 @@ -25,20 +25,44 @@ Change id IDs of all the elements in the database to conform to the scheme specified in the database's prefix ids """ +#------------------------------------------------------------------------ +# +# standard python modules +# +#------------------------------------------------------------------------ import re -import Utils from gettext import gettext as _ +#------------------------------------------------------------------------ +# +# GRAMPS modules +# +#------------------------------------------------------------------------ +import Utils +from QuestionDialog import WarningDialog + _findint = re.compile('^[^\d]*(\d+)[^\d]*') def runTool(db,active_person,callback,parent): """Changed person, family, object, source, and place ids""" + #FIXME -- Remove when the tool is back from the dead + WarningDialog(_('Tool currently unavailable'), + _('This tool has not yet been brought up to date ' + 'after transition to the database, sorry.'),parent.topWindow) + return + + #FIXME try: ReorderIds(db,callback) except: import DisplayTrace DisplayTrace.DisplayTrace() +#------------------------------------------------------------------------- +# +# Actual tool +# +#------------------------------------------------------------------------- class ReorderIds: def __init__(self,db,callback): @@ -52,7 +76,7 @@ class ReorderIds: self.reorder(db.get_place_handle_map(),db.pprefix,db.build_place_display) callback(1) - def reorder_person(): + def reorder_person(self): dups = [] newids = {} key_list = [] diff --git a/gramps2/src/plugins/changetype.glade b/gramps2/src/plugins/changetype.glade index b16e2f687..cb3282ff8 100644 --- a/gramps2/src/plugins/changetype.glade +++ b/gramps2/src/plugins/changetype.glade @@ -17,6 +17,7 @@ GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST False + diff --git a/gramps2/src/plugins/eval.glade b/gramps2/src/plugins/eval.glade index 3aef197d1..c3eb2deee 100644 --- a/gramps2/src/plugins/eval.glade +++ b/gramps2/src/plugins/eval.glade @@ -4,7 +4,7 @@ - + True GTK_WINDOW_TOPLEVEL @@ -17,246 +17,21 @@ True False False - GDK_WINDOW_TYPE_HINT_NORMAL + GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST - + False + - - - 6 + + True False - 6 + 0 - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - 6 - True - 6 - 2 - False - 6 - 6 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 1 - 2 - 1 - 2 - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 1 - 2 - 3 - 4 - fill - - - - - - True - <b>Evaluation Window</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 2 - 0 - 1 - fill - - - - - - - True - <b>Output Window</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 2 - 2 - 3 - fill - - - - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - False - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 1 - 2 - 5 - 6 - fill - - - - - - True - <b>Error Window</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 2 - 4 - 5 - fill - - - - - - 0 - True - True - - - - - - 6 + + True GTK_BUTTONBOX_END - 6 @@ -267,6 +42,7 @@ True GTK_RELIEF_NORMAL True + 0 @@ -280,6 +56,7 @@ True GTK_RELIEF_NORMAL True + 0 @@ -293,6 +70,7 @@ True GTK_RELIEF_NORMAL True + 0 @@ -301,6 +79,258 @@ 0 False True + GTK_PACK_END + + + + + + 6 + True + False + 6 + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + 6 + True + 6 + 2 + False + 6 + 6 + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 1 + 2 + 1 + 2 + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 1 + 2 + 3 + 4 + fill + + + + + + True + <b>Evaluation Window</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 2 + 0 + 1 + fill + + + + + + + True + <b>Output Window</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 2 + 2 + 3 + fill + + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 1 + 2 + 5 + 6 + fill + + + + + + True + <b>Error Window</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 2 + 4 + 5 + fill + + + + + + 0 + True + True + + + + + + 6 + True + GTK_BUTTONBOX_END + 6 + + + 0 + False + True + + + + + 0 + True + True diff --git a/gramps2/src/plugins/leak.glade b/gramps2/src/plugins/leak.glade index bb26678b6..df22d5e7b 100644 --- a/gramps2/src/plugins/leak.glade +++ b/gramps2/src/plugins/leak.glade @@ -4,7 +4,7 @@ - + True GTK_WINDOW_TOPLEVEL @@ -17,122 +17,21 @@ True False False - GDK_WINDOW_TYPE_HINT_NORMAL + GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST - + False + - - - 6 + + True False - 6 + 0 - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - 6 - True - 2 - 2 - False - 6 - 6 - - - - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - 1 - 2 - 1 - 2 - - - - - - True - <b>Uncollected Objects</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 2 - 0 - 1 - fill - - - - - - 0 - True - True - - - - - - 6 + + True GTK_BUTTONBOX_END - 6 @@ -143,6 +42,7 @@ True GTK_RELIEF_NORMAL True + 0 @@ -156,6 +56,7 @@ True GTK_RELIEF_NORMAL True + 0 @@ -164,6 +65,134 @@ 0 False True + GTK_PACK_END + + + + + + 6 + True + False + 6 + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + 6 + True + 2 + 2 + False + 6 + 6 + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 1 + 2 + 1 + 2 + + + + + + True + <b>Uncollected Objects</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 2 + 0 + 1 + fill + + + + + + 0 + True + True + + + + + + 6 + True + GTK_BUTTONBOX_END + 6 + + + 0 + False + True + + + + + 0 + True + True