diff --git a/ChangeLog b/ChangeLog index 0369c8b97..6a7975720 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,14 @@ * src/Utils.py: Minor. * src/gramps.glade: Minor update. + * src/AutoComp.py (StandardCustomSelector.__init__): Compare + active_key to None. + * src/gramps.glade (marriageDialog): Remove displayed strings from + the Sttributes tab. + * src/Marriage.py: Delegate attribute handling to ListBox. + * src/ListBox.py (AttrListBox): Support both personal and family + attributes. + 2005-06-08 Martin Hawlisch * src/EventView.py (column_names): Add missing column * src/RepositoryView.py (column_names): Add missing columns diff --git a/src/AutoComp.py b/src/AutoComp.py index cb069b6dc..2225df611 100644 --- a/src/AutoComp.py +++ b/src/AutoComp.py @@ -142,7 +142,7 @@ class StandardCustomSelector: self.selector.set_text_column(1) else: self.selector = gtk.ComboBoxEntry(self.store,1) - if self.active_key: + if self.active_key != None: self.selector.set_active(self.active_index) # make autocompletion work diff --git a/src/ListBox.py b/src/ListBox.py index e165faeda..8e229d846 100644 --- a/src/ListBox.py +++ b/src/ListBox.py @@ -217,11 +217,16 @@ class ReorderListBox(ListBox): class AttrListBox(ReorderListBox): - def __init__(self, parent, person, obj, label, button_list): + def __init__(self, parent, primary, obj, label, button_list): - custom_str = Utils.personal_attributes[RelLib.Attribute.CUSTOM] + if primary.__class__.__name__ == 'Person': + self.attr_dict = Utils.personal_attributes + elif primary.__class__.__name__ == 'Family': + self.attr_dict = Utils.family_attributes + + custom_str = self.attr_dict[RelLib.Attribute.CUSTOM] attrlist = filter(lambda x: x != custom_str, - Utils.personal_attributes.values()) + self.attr_dict.values()) attrlist.sort(locale.strcoll) titles = [ @@ -232,12 +237,12 @@ class AttrListBox(ReorderListBox): (_('Note'), NOSORT, 50, TOGGLE, None, None), ] - self.data = person.get_attribute_list()[:] - ListBox.__init__(self, parent, person, obj, label, + self.data = primary.get_attribute_list()[:] + ListBox.__init__(self, parent, primary, obj, label, button_list, titles) self.attr_name_map,self.attr_val_map = self.build_maps( - RelLib.Attribute.CUSTOM,Utils.personal_attributes) + RelLib.Attribute.CUSTOM,self.attr_dict) def set_type(self,index,value): val = self.attr_name_map.get(value,RelLib.Attribute.CUSTOM) @@ -253,7 +258,7 @@ class AttrListBox(ReorderListBox): def add(self,obj): """Brings up the AttributeEditor for a new attribute""" AttrEdit.AttributeEditor(self.parent, None, self.name, - Utils.personal_attributes, + self.attr_dict, self.edit_callback,self.parent.window) def update(self,obj): @@ -261,7 +266,7 @@ class AttrListBox(ReorderListBox): if node: attr = self.list_model.get_object(node) AttrEdit.AttributeEditor(self.parent, attr, self.name, - Utils.personal_attributes, + self.attr_dict, self.edit_callback,self.parent.window) def display_data(self,attr): @@ -270,10 +275,10 @@ class AttrListBox(ReorderListBox): etype = attr.get_type() if etype[0] == RelLib.Attribute.CUSTOM \ - or not Utils.personal_attributes.has_key(etype[0]): + or not self.attr_dict.has_key(etype[0]): name = etype[1] else: - name = Utils.personal_attributes[etype[0]] + name = self.attr_dict[etype[0]] return [name, attr.get_value(), has_source, has_note] diff --git a/src/Marriage.py b/src/Marriage.py index 10d609ddc..b02aa7bf6 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -115,23 +115,14 @@ class Marriage: "on_help_marriage_editor" : self.on_help_clicked, "on_up_clicked" : self.on_up_clicked, "on_down_clicked" : self.on_down_clicked, - "on_attr_up_clicked" : self.on_attr_up_clicked, - "on_attr_down_clicked" : self.on_attr_down_clicked, - "on_add_attr_clicked" : self.on_add_attr_clicked, - "on_delete_attr_clicked" : self.on_delete_attr_clicked, "on_addphoto_clicked" : self.gallery.on_add_media_clicked, "on_selectphoto_clicked" : self.gallery.on_select_media_clicked, "on_close_marriage_editor" : self.on_close_marriage_editor, - #"on_delete_event" : self.on_delete_event, "on_lds_src_clicked" : self.lds_src_clicked, "on_lds_note_clicked" : self.lds_note_clicked, "on_deletephoto_clicked" : self.gallery.on_delete_media_clicked, "on_edit_photo_clicked" : self.gallery.on_edit_media_clicked, "on_edit_properties_clicked": self.gallery.popup_change_description, - #"on_marriageAddBtn_clicked" : self.on_add_clicked, - #"on_event_update_clicked" : self.on_event_update_clicked, - "on_attr_update_clicked" : self.on_update_attr_clicked, - #"on_marriageDeleteBtn_clicked" : self.on_delete_clicked, "on_switch_page" : self.on_switch_page }) @@ -159,11 +150,6 @@ class Marriage: # widgets self.complete = self.get_widget('complete') self.complete.set_sensitive(mode) - #self.date_field = self.get_widget("marriageDate") - #self.place_field = self.get_widget("marriagePlace") - #self.cause_field = self.get_widget("marriageCause") - #self.name_field = self.get_widget("marriageEventName") - #self.descr_field = self.get_widget("marriageDescription") self.type_field = self.get_widget("marriage_type") self.type_field.set_sensitive(mode) self.notes_field = self.get_widget("marriageNotes") @@ -171,16 +157,13 @@ class Marriage: self.gid = self.get_widget("gid") self.gid.set_editable(mode) self.attr_list = self.get_widget("attr_list") - self.attr_type = self.get_widget("attr_type") - self.attr_value = self.get_widget("attr_value") - #self.event_src_field = self.get_widget("event_srcinfo") - #self.event_conf_field = self.get_widget("event_conf") event_add_btn = self.get_widget("marriage_add") event_edit_btn = self.get_widget("marriage_edit") event_delete_btn = self.get_widget("marriage_del") event_sel_btn = self.get_widget("marriage_sel") - self.attr_src_field = self.get_widget("attr_srcinfo") - self.attr_conf_field = self.get_widget("attr_conf") + attr_add_btn = self.get_widget("attr_add") + attr_edit_btn = self.get_widget("attr_edit") + attr_del_btn = self.get_widget("attr_del") self.lds_date = self.get_widget("lds_date") self.lds_date.set_editable(mode) self.lds_date_led = self.get_widget("lds_date_stat") @@ -205,7 +188,6 @@ class Marriage: self.preform = self.get_widget("mar_preform") self.preform.set_sensitive(mode) - #self.ereflist = family.get_event_ref_list()[:] self.alist = family.get_attribute_list()[:] self.lists_changed = 0 @@ -214,16 +196,6 @@ class Marriage: # set initial data self.gallery.load_images() - #etitles = [(_('Event'),-1,100),(_('Date'),-1,125),(_('Place'),-1,150)] - atitles = [(_('Attribute'),-1,150),(_('Value'),-1,150)] - - #self.etree = ListModel.ListModel(self.event_list, etitles, - # self.on_select_row, - # self.on_event_update_clicked) - self.atree = ListModel.ListModel(self.attr_list, atitles, - self.on_attr_list_select_row, - self.on_update_attr_clicked) - # event display self.event_box = ListBox.EventListBox( self, family, self.event_ref_list, self.events_label, @@ -236,6 +208,13 @@ class Marriage: frel = family.get_relationship() self.type_selector.set_values(frel) + + # attribute display + self.attr_box = ListBox.AttrListBox( + self, family, self.attr_list, self.attr_label, + [attr_add_btn,attr_edit_btn,attr_del_btn]) + self.attr_box.redraw() + self.gid.set_text(family.get_gramps_id()) @@ -286,17 +265,17 @@ class Marriage: # self.ev_dest_drag_data_received) #self.event_list.connect('drag_begin', self.ev_drag_begin) - self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, - [DdTargets.FAMILY_ATTRIBUTE.target()], - gtk.gdk.ACTION_COPY) - self.attr_list.drag_source_set(gtk.gdk.BUTTON1_MASK, - [DdTargets.FAMILY_ATTRIBUTE.target()], - gtk.gdk.ACTION_COPY) - self.attr_list.connect('drag_data_get', - self.at_source_drag_data_get) - self.attr_list.connect('drag_data_received', - self.at_dest_drag_data_received) - self.attr_list.connect('drag_begin', self.at_drag_begin) + #self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, + # [DdTargets.FAMILY_ATTRIBUTE.target()], + # gtk.gdk.ACTION_COPY) + #self.attr_list.drag_source_set(gtk.gdk.BUTTON1_MASK, + # [DdTargets.FAMILY_ATTRIBUTE.target()], + # gtk.gdk.ACTION_COPY) + #self.attr_list.connect('drag_data_get', + # self.at_source_drag_data_get) + #self.attr_list.connect('drag_data_received', + # self.at_dest_drag_data_received) + #self.attr_list.connect('drag_begin', self.at_drag_begin) # set notes data self.notes_buffer = self.notes_field.get_buffer() @@ -313,8 +292,6 @@ class Marriage: self.top.get_widget('add_src'), self.top.get_widget('edit_src'), self.top.get_widget('del_src'), self.db.readonly) - #self.redraw_event_list() - self.redraw_attr_list() self.add_itself_to_winsmenu() self.top.get_widget('ok').set_sensitive(not self.db.readonly) @@ -536,7 +513,7 @@ class Marriage: def update_lists(self): eref_list = [event_ref for (event_ref,event) in self.event_box.data] self.family.set_event_ref_list(eref_list) - self.family.set_attribute_list(self.alist) + self.family.set_attribute_list(self.attr_box.data) def attr_edit_callback(self,attr): self.redraw_attr_list() @@ -739,11 +716,6 @@ class Marriage: import EventEdit EventEdit.EventRefEditor(None,None,self.family,self.db, self.event_box.edit_callback,self) - #name = Utils.family_name(self.family,self.db) - #EventEdit.EventRefEditor(None,self.family, self.db,None,self) - #self,name, Utils.family_events, - #None, None, 0, self.event_edit_callback, - #RelLib.Event.MARRIAGE, self.db.readonly) def on_event_update_clicked(self,obj): import EventEdit @@ -863,6 +835,8 @@ class Marriage: def on_switch_page(self,obj,a,page): if page == 0: self.event_box.redraw() + elif page == 1: + self.attr_box.redraw() text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), self.notes_buffer.get_end_iter(),False)) if text: diff --git a/src/gramps.glade b/src/gramps.glade index f0a0ebf82..ec466c06c 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -13224,396 +13224,29 @@ tories</b> - + + 6 True False - 0 + 6 - - 12 + True - 6 - 5 - False - 6 - 12 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT - + True - Value - False - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 + True + True + False + False + True - - 1 - 2 - 2 - 3 - fill - - - - - - - True - Confidence: - False - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 3 - 4 - 5 - 6 - fill - - - - - - - True - Name: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 1 - 2 - 5 - 6 - fill - - - - - - - True - Type: - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 1 - 2 - 1 - 2 - fill - - - - - - - True - <b>Primary source</b> - False - True - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 5 - 4 - 5 - fill - - - - - - - True - <b>Attributes</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 5 - 0 - 1 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 2 - 5 - 2 - 3 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 2 - 3 - 5 - 6 - - - - - - - True - - False - False - GTK_JUSTIFY_CENTER - False - False - 0 - 0.5 - 0 - 0 - - - 4 - 5 - 5 - 6 - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 2 - 5 - 1 - 2 - fill - - - - - - 0 - False - True - - - - - - 6 - True - False - 6 - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - - True - True - True - False - False - True - - - - - 0 - True - True - - - - - - True - False - 6 - - - - True - Create a new attribute for this marriage - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - True - GTK_RELIEF_NORMAL - True - - - - - True - edit_sm.png - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - True - Delete the selected attribute - True - GTK_RELIEF_NORMAL - True - - - - - True - gtk-remove - 4 - 0.5 - 0.5 - 0 - 0 - - - - - 0 - False - False - - - - - - - - - 0 - False - True - @@ -13622,6 +13255,105 @@ tories</b> True + + + + True + False + 6 + + + + True + Create a new attribute for this marriage + True + GTK_RELIEF_NORMAL + True + + + + + True + gtk-add + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + + + + + + True + True + GTK_RELIEF_NORMAL + True + + + + + True + edit_sm.png + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + + + + + + True + Delete the selected attribute + True + GTK_RELIEF_NORMAL + True + + + + + True + gtk-remove + 4 + 0.5 + 0.5 + 0 + 0 + + + + + 0 + False + False + + + + + + + + + 0 + False + True + + False