diff --git a/ChangeLog b/ChangeLog index 63960ca69..5c6cbe226 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ 2006-04-06 Don Allingham + * src/glade/gramps.glade: restored addr_edit * src/DataViews/_FamilyView.py: add select parents function 2006-04-06 Alex Roitman diff --git a/src/Navigation.py b/src/Navigation.py index f8bceec9f..e5ae03fab 100644 --- a/src/Navigation.py +++ b/src/Navigation.py @@ -18,15 +18,47 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -_top = '' -_btm = '' +""" +Base history navigation class. Builds the action group and ui for the +uimanager. Changes to the associated history objects are tracked. When +the history changes, the UI XML string and the action groups are updated. +""" + +__author__ = "Donald N. Allingham" +__revision__ = "$Revision:$" + + +#------------------------------------------------------------------- +# +# constants +# +#------------------------------------------------------------------- import gtk -import sys import NameDisplay DISABLED = -1 +#------------------------------------------------------------------- +# +# UI Manager XML code +# +#------------------------------------------------------------------- +_top = [ + '' + '' + '' + '' + ] + +_btm = [ + '' + '' + '' + '' + ] + + class BaseNavigation: """ Base history navigation class. Builds the action group and ui for the @@ -43,16 +75,20 @@ class BaseNavigation: self.func - array of functions to take action based off of. """ - def __init__(self,uistate,history,title): + def __init__(self, uistate, history, title): self.title = title - self.ui = _top+_btm + self.ui = "".join(_top) + "".join(_btm) self.uistate = uistate self.action_group = gtk.ActionGroup(self.title) self.active = DISABLED self.items = [] + self.func = [] self.history = history def clear(self): + """ + Clears out the specified history + """ self.history.clear() def disable(self): @@ -72,23 +108,24 @@ class BaseNavigation: self.uistate.uimanager.insert_action_group(self.action_group, 1) self.active = self.uistate.uimanager.add_ui_from_string(self.ui) - def build_item_name(self,handle): + def build_item_name(self, handle): """ Builds a string from the passed handle. Must be overridden by the derrived class. """ return "ERROR" - def update_menu(self,items): + def update_menu(self, items): """ Builds the UI and action group. """ self.items = items self.disable() - menu_len = min(len(items),10) - - data = map(lambda x: '' % (self.title,x), range(0,menu_len)) - self.ui = _top + "".join(data) + _btm + menu_len = min(len(items), 10) + entry = '' + + data = [ entry % (self.title, index) for index in range(0, menu_len) ] + self.ui = "".join(_top) + "".join(data) + "".join(_btm) self.action_group = gtk.ActionGroup(self.title) data = [] index = 0 @@ -97,9 +134,9 @@ class BaseNavigation: mitems.reverse() for item in mitems[:10]: name = self.build_item_name(item) - f = self.func[index] - data.append(('%s%02d'%(self.title,index), None, name, - "%d" % index, None, f)) + func = self.func[index] + data.append(('%s%02d'%(self.title, index), None, name, + "%d" % index, None, func)) index += 1 self.action_group.add_actions(data) @@ -110,15 +147,17 @@ class PersonNavigation(BaseNavigation): """ Builds a navigation item for the Person class. """ - def __init__(self,uistate): + def __init__(self, uistate): """ Associates the functions with the associated items. Builds the function array so that there are unique functions for each possible index (0-9) The callback simply calls change_active_handle """ - BaseNavigation.__init__(self,uistate,uistate.phistory,'PersonHistory') - self.func = [ self.f0, self.f1, self.f2, self.f3, self.f4, - self.f5, self.f6, self.f7, self.f8, self.f9 ] + BaseNavigation.__init__(self, uistate, uistate.phistory, 'PersonHistory') + fcn_ptr = self.uistate.dbstate.change_active_handle + + self.func = [ generate(fcn_ptr, self.items, index) \ + for index in range(0, 10) ] def build_item_name(self, item): """ @@ -128,33 +167,8 @@ class PersonNavigation(BaseNavigation): return "%s [%s]" % (NameDisplay.displayer.display(person), person.gramps_id) - def f0(self,obj): - self.uistate.dbstate.change_active_handle(self.items[0]) - - def f1(self,obj): - self.uistate.dbstate.change_active_handle(self.items[1]) - - def f2(self,obj): - self.uistate.dbstate.change_active_handle(self.items[2]) - - def f3(self,obj): - self.uistate.dbstate.change_active_handle(self.items[3]) - - def f4(self,obj): - self.uistate.dbstate.change_active_handle(self.items[4]) - - def f5(self,obj): - self.uistate.dbstate.change_active_handle(self.items[5]) - - def f6(self,obj): - self.uistate.dbstate.change_active_handle(self.items[6]) - - def f7(self,obj): - self.uistate.dbstate.change_active_handle(self.items[7]) - - def f8(self,obj): - self.uistate.dbstate.change_active_handle(self.items[8]) - - def f9(self,obj): - self.uistate.dbstate.change_active_handle(self.items[9]) - +def generate(func, items, index): + """ + Generates a callback function based off the passed arguments + """ + return lambda x: func(items[index]) diff --git a/src/SelectEvent.py b/src/SelectEvent.py index fcc1328b2..73a51d80d 100644 --- a/src/SelectEvent.py +++ b/src/SelectEvent.py @@ -20,6 +20,11 @@ # $Id$ + +__author__ = "Donald N. Allingham" +__revision__ = "$Revision$" + + #------------------------------------------------------------------------- # # internationalization diff --git a/src/glade/gramps.glade b/src/glade/gramps.glade index edc1cebf7..1bccab997 100644 --- a/src/glade/gramps.glade +++ b/src/glade/gramps.glade @@ -15803,4 +15803,554 @@ You should select parents before adding any new information. If you select paren + + True + + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 600 + 450 + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + False + + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + + True + Accept changes and close window + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + + + True + True + True + gtk-help + True + GTK_RELIEF_NORMAL + True + -11 + + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + False + 0 + + + + True + + False + True + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 10 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + 12 + True + 5 + 7 + False + 6 + 12 + + + + True + _Date: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + address_start + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + Add_ress: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + street + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + _City/County: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + city + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 3 + 2 + 3 + + + + + + + True + _State/Province: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + state + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 4 + 5 + 2 + 3 + fill + + + + + + + True + _ZIP/Postal code: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + postal + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 3 + 3 + 4 + + + + + + + True + Cou_ntry: + True + False + GTK_JUSTIFY_CENTER + False + False + 0 + 0.5 + 0 + 0 + country + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 4 + 5 + 3 + 4 + fill + + + + + + + True + P_hone: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + phone + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 3 + 4 + 5 + + + + + + + True + True + True + True + True + 0 + + True + * + False + + + 1 + 6 + 0 + 1 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 5 + 7 + 2 + 3 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 5 + 7 + 3 + 4 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 6 + 1 + 2 + + + + + + + True + True + GTK_RELIEF_NONE + True + False + False + + + + True + 1 + gtk-dialog-authentication + 0.5 + 0.5 + 0 + 0 + + + + + 6 + 7 + 1 + 2 + + + + + + + + True + True + GTK_RELIEF_NONE + True + + + + True + 0.5 + 0.5 + 0 + 0 + + + + + 6 + 7 + 0 + 1 + + fill + + + + + 0 + False + True + + + + + 0 + True + True + + + + + +