diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 643c4d6b2..174ec9d51 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,16 @@ +2006-04-23 Don Allingham + * src/DataViews/_MediaView.py: Column editor changes + * src/DataViews/_RepositoryView.py: Column editor changes + * src/DataViews/_SourceView.py: Column editor changes + * src/DataViews/_EventView.py: Column editor changes + * src/DataViews/_FamilyView.py: Column editor changes + * src/DataViews/_PlaceView.py: Column editor changes + * src/DataViews/_PersonView.py: Column editor changes + * src/GrampsDb/_DbUtils.py: fix add_child_to_family to handle refs + * src/ColumnOrder.py: format changes + * src/glade/gramps.glade: format changes + * src/SelectFamily.py: ManagedWindow support + 2006-04-23 Alex Roitman * src/Utils.py: Make set_titles call ManagedWindow.set_titles with warning. diff --git a/gramps2/src/ColumnOrder.py b/gramps2/src/ColumnOrder.py index cac8a60c5..41017838a 100644 --- a/gramps2/src/ColumnOrder.py +++ b/gramps2/src/ColumnOrder.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2006 Donald N. Allingham +# Copyright (C) 2000-2003 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 @@ -40,13 +40,16 @@ log = logging.getLogger(".ColumnOrder") class ColumnOrder(ManagedWindow.ManagedWindow): - def __init__(self, uistate, arglist, column_names, callback): + def __init__(self, win_name, uistate, arglist, column_names, callback): ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) self.glade = gtk.glade.XML(const.gladeFile,"columns","gramps") - self.set_window(self.glade.get_widget('columns'),None, - _('Select Columns')) + + self.set_window(self.glade.get_widget('columns'), + self.glade.get_widget('title'), + win_name, + _('Select Columns')) self.tree = self.glade.get_widget('list') self.arglist = arglist @@ -82,7 +85,7 @@ class ColumnOrder(ManagedWindow.ManagedWindow): 3, item) def build_menu_names(self,obj): - return (_('Column Editor'), None) + return (_('Column Editor'), _('Column Editor')) def ok_clicked(self,obj): newlist = [] diff --git a/gramps2/src/DataViews/_EventView.py b/gramps2/src/DataViews/_EventView.py index 8c73017de..66acc8708 100644 --- a/gramps2/src/DataViews/_EventView.py +++ b/gramps2/src/DataViews/_EventView.py @@ -127,6 +127,7 @@ class EventView(PageView.ListView): import ColumnOrder ColumnOrder.ColumnOrder( + _('Select Event Columns'), self.uistate, self.dbstate.db.get_event_column_order(), column_names, diff --git a/gramps2/src/DataViews/_FamilyView.py b/gramps2/src/DataViews/_FamilyView.py index 9de5c6924..0884f8cd7 100644 --- a/gramps2/src/DataViews/_FamilyView.py +++ b/gramps2/src/DataViews/_FamilyView.py @@ -707,15 +707,17 @@ class FamilyView(PageView.PersonNavView): if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: from SelectFamily import SelectFamily - dialog = SelectFamily(self.dbstate.db, _('Select Family')) + dialog = SelectFamily(self.dbstate, self.uistate) family = dialog.run() if family: active_handle = self.dbstate.active.handle child = self.dbstate.db.get_person_from_handle(active_handle) - GrampsDb.add_child_to_family(family, child, - RelLib.ChildRef(), - RelLib.ChildRef()) + + GrampsDb.add_child_to_family( + self.dbstate.db, + family, + child) def add_parent_family(self, obj, event, handle): if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1: diff --git a/gramps2/src/DataViews/_MediaView.py b/gramps2/src/DataViews/_MediaView.py index db18318bc..f9c2977ec 100644 --- a/gramps2/src/DataViews/_MediaView.py +++ b/gramps2/src/DataViews/_MediaView.py @@ -84,6 +84,7 @@ class MediaView(PageView.ListView): import ColumnOrder ColumnOrder.ColumnOrder( + _('Select Media Columns'), self.uistate, self.dbstate.db.get_media_column_order(), column_names, diff --git a/gramps2/src/DataViews/_PersonView.py b/gramps2/src/DataViews/_PersonView.py index 486ef9035..582864a04 100644 --- a/gramps2/src/DataViews/_PersonView.py +++ b/gramps2/src/DataViews/_PersonView.py @@ -126,6 +126,7 @@ class PersonView(PageView.PersonNavView): import ColumnOrder ColumnOrder.ColumnOrder( + _('Select Person Columns'), self.uistate, self.dbstate.db.get_person_column_order(), column_names, diff --git a/gramps2/src/DataViews/_PlaceView.py b/gramps2/src/DataViews/_PlaceView.py index 9d04e49c1..8924c67db 100644 --- a/gramps2/src/DataViews/_PlaceView.py +++ b/gramps2/src/DataViews/_PlaceView.py @@ -90,6 +90,7 @@ class PlaceView(PageView.ListView): import ColumnOrder ColumnOrder.ColumnOrder( + _('Select Place Columns'), self.uistate, self.dbstate.db.get_place_column_order(), column_names, diff --git a/gramps2/src/DataViews/_RepositoryView.py b/gramps2/src/DataViews/_RepositoryView.py index 0626170b4..b81a5d66b 100644 --- a/gramps2/src/DataViews/_RepositoryView.py +++ b/gramps2/src/DataViews/_RepositoryView.py @@ -96,6 +96,7 @@ class RepositoryView(PageView.ListView): import ColumnOrder ColumnOrder.ColumnOrder( + _('Select Repository Columns'), self.uistate, self.dbstate.db.get_repository_column_order(), column_names, diff --git a/gramps2/src/DataViews/_SourceView.py b/gramps2/src/DataViews/_SourceView.py index dfdf09e96..856101973 100644 --- a/gramps2/src/DataViews/_SourceView.py +++ b/gramps2/src/DataViews/_SourceView.py @@ -89,6 +89,7 @@ class SourceView(PageView.ListView): import ColumnOrder ColumnOrder.ColumnOrder( + _('Select Source Columns'), self.uistate, self.dbstate.db.get_source_column_order(), column_names, diff --git a/gramps2/src/GrampsDb/_DbUtils.py b/gramps2/src/GrampsDb/_DbUtils.py index 7739c070b..ca5a9c9a7 100644 --- a/gramps2/src/GrampsDb/_DbUtils.py +++ b/gramps2/src/GrampsDb/_DbUtils.py @@ -124,8 +124,13 @@ def add_child_to_family(db, family, child, frel=RelLib.ChildRefType(), trans=None): - family.add_child_handle(child.handle) - child.add_parent_family_handle(family.handle, mrel, frel ) + cref = RelLib.ChildRef() + cref.ref = child.handle + cref.set_father_relation(frel) + cref.set_mother_relation(mrel) + + family.add_child_ref(cref) + child.add_parent_family_handle(family.handle) if trans == None: need_commit = True @@ -134,7 +139,7 @@ def add_child_to_family(db, family, child, need_commit = False db.commit_family(family,trans) - db.commit_person(person,trans) + db.commit_person(child,trans) if need_commit: db.transaction_commit(trans, _('Add child to family') ) diff --git a/gramps2/src/SelectFamily.py b/gramps2/src/SelectFamily.py index 3406f5356..37d5de7cf 100644 --- a/gramps2/src/SelectFamily.py +++ b/gramps2/src/SelectFamily.py @@ -44,36 +44,36 @@ import pango import const import Utils import DisplayModels +import ManagedWindow #------------------------------------------------------------------------- # # SelectFamily # #------------------------------------------------------------------------- -class SelectFamily: +class SelectFamily(ManagedWindow.ManagedWindow): - def __init__(self, db, title, filter=None, skip=[], parent_window=None): + def __init__(self, dbstate, uistate, filter=None, skip=[]): + ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) + self.renderer = gtk.CellRendererText() self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END) - self.db = db + self.db = dbstate.db self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps") - self.top = self.glade.get_widget('select_person') self.plist = self.glade.get_widget('plist') self.notebook = self.glade.get_widget('notebook') - Utils.set_titles(self.top, - self.glade.get_widget('title'), - title) + self.set_window( + self.glade.get_widget('select_person'), + self.glade.get_widget('title'), + _('Select Family')) self.model = DisplayModels.FamilyModel(self.db) self.add_columns(self.plist) self.plist.set_model(self.model) - self.top.show() - - if parent_window: - self.top.set_transient_for(parent_window) + self.show() def add_columns(self,tree): column = gtk.TreeViewColumn(_('ID'), self.renderer, text=0) @@ -95,21 +95,25 @@ class SelectFamily: def select_function(self,store,path,iter,id_list): id_list.append(self.model.get_value(iter,5)) + + def build_menu_names(self,obj): + return (_('Select Family'), None) + def get_selected_ids(self): mlist = [] self.plist.get_selection().selected_foreach(self.select_function,mlist) return mlist def run(self): - val = self.top.run() + val = self.window.run() if val == gtk.RESPONSE_OK: idlist = self.get_selected_ids() - self.top.destroy() + self.close() if idlist and idlist[0]: return_value = self.db.get_family_from_handle(idlist[0]) else: return_value = None return return_value else: - self.top.destroy() + self.close() return None diff --git a/gramps2/src/glade/gramps.glade b/gramps2/src/glade/gramps.glade index 7bec2183b..cc9d8d08d 100644 --- a/gramps2/src/glade/gramps.glade +++ b/gramps2/src/glade/gramps.glade @@ -413,7 +413,7 @@ 12 True 4 - 2 + 1 False 6 6 @@ -444,23 +444,23 @@ - 1 - 2 + 0 + 1 1 4 - + True - <b>Select columns</b> + False - True + False GTK_JUSTIFY_LEFT False False - 0 + 0.5 0.5 0 0 @@ -471,7 +471,7 @@ 0 - 2 + 1 0 1 fill