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


svn: r4815
This commit is contained in:
Alex Roitman 2005-06-09 01:18:03 +00:00
parent 27c0af8356
commit f5ffcaeee7
5 changed files with 161 additions and 442 deletions

View File

@ -30,6 +30,14 @@
* src/Utils.py: Minor. * src/Utils.py: Minor.
* src/gramps.glade: Minor update. * 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 <Martin.Hawlisch@gmx.de> 2005-06-08 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/EventView.py (column_names): Add missing column * src/EventView.py (column_names): Add missing column
* src/RepositoryView.py (column_names): Add missing columns * src/RepositoryView.py (column_names): Add missing columns

View File

@ -142,7 +142,7 @@ class StandardCustomSelector:
self.selector.set_text_column(1) self.selector.set_text_column(1)
else: else:
self.selector = gtk.ComboBoxEntry(self.store,1) self.selector = gtk.ComboBoxEntry(self.store,1)
if self.active_key: if self.active_key != None:
self.selector.set_active(self.active_index) self.selector.set_active(self.active_index)
# make autocompletion work # make autocompletion work

View File

@ -217,11 +217,16 @@ class ReorderListBox(ListBox):
class AttrListBox(ReorderListBox): 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, attrlist = filter(lambda x: x != custom_str,
Utils.personal_attributes.values()) self.attr_dict.values())
attrlist.sort(locale.strcoll) attrlist.sort(locale.strcoll)
titles = [ titles = [
@ -232,12 +237,12 @@ class AttrListBox(ReorderListBox):
(_('Note'), NOSORT, 50, TOGGLE, None, None), (_('Note'), NOSORT, 50, TOGGLE, None, None),
] ]
self.data = person.get_attribute_list()[:] self.data = primary.get_attribute_list()[:]
ListBox.__init__(self, parent, person, obj, label, ListBox.__init__(self, parent, primary, obj, label,
button_list, titles) button_list, titles)
self.attr_name_map,self.attr_val_map = self.build_maps( 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): def set_type(self,index,value):
val = self.attr_name_map.get(value,RelLib.Attribute.CUSTOM) val = self.attr_name_map.get(value,RelLib.Attribute.CUSTOM)
@ -253,7 +258,7 @@ class AttrListBox(ReorderListBox):
def add(self,obj): def add(self,obj):
"""Brings up the AttributeEditor for a new attribute""" """Brings up the AttributeEditor for a new attribute"""
AttrEdit.AttributeEditor(self.parent, None, self.name, AttrEdit.AttributeEditor(self.parent, None, self.name,
Utils.personal_attributes, self.attr_dict,
self.edit_callback,self.parent.window) self.edit_callback,self.parent.window)
def update(self,obj): def update(self,obj):
@ -261,7 +266,7 @@ class AttrListBox(ReorderListBox):
if node: if node:
attr = self.list_model.get_object(node) attr = self.list_model.get_object(node)
AttrEdit.AttributeEditor(self.parent, attr, self.name, AttrEdit.AttributeEditor(self.parent, attr, self.name,
Utils.personal_attributes, self.attr_dict,
self.edit_callback,self.parent.window) self.edit_callback,self.parent.window)
def display_data(self,attr): def display_data(self,attr):
@ -270,10 +275,10 @@ class AttrListBox(ReorderListBox):
etype = attr.get_type() etype = attr.get_type()
if etype[0] == RelLib.Attribute.CUSTOM \ 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] name = etype[1]
else: else:
name = Utils.personal_attributes[etype[0]] name = self.attr_dict[etype[0]]
return [name, attr.get_value(), has_source, has_note] return [name, attr.get_value(), has_source, has_note]

View File

@ -115,23 +115,14 @@ class Marriage:
"on_help_marriage_editor" : self.on_help_clicked, "on_help_marriage_editor" : self.on_help_clicked,
"on_up_clicked" : self.on_up_clicked, "on_up_clicked" : self.on_up_clicked,
"on_down_clicked" : self.on_down_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_addphoto_clicked" : self.gallery.on_add_media_clicked,
"on_selectphoto_clicked" : self.gallery.on_select_media_clicked, "on_selectphoto_clicked" : self.gallery.on_select_media_clicked,
"on_close_marriage_editor" : self.on_close_marriage_editor, "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_src_clicked" : self.lds_src_clicked,
"on_lds_note_clicked" : self.lds_note_clicked, "on_lds_note_clicked" : self.lds_note_clicked,
"on_deletephoto_clicked" : self.gallery.on_delete_media_clicked, "on_deletephoto_clicked" : self.gallery.on_delete_media_clicked,
"on_edit_photo_clicked" : self.gallery.on_edit_media_clicked, "on_edit_photo_clicked" : self.gallery.on_edit_media_clicked,
"on_edit_properties_clicked": self.gallery.popup_change_description, "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 "on_switch_page" : self.on_switch_page
}) })
@ -159,11 +150,6 @@ class Marriage:
# widgets # widgets
self.complete = self.get_widget('complete') self.complete = self.get_widget('complete')
self.complete.set_sensitive(mode) 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 = self.get_widget("marriage_type")
self.type_field.set_sensitive(mode) self.type_field.set_sensitive(mode)
self.notes_field = self.get_widget("marriageNotes") self.notes_field = self.get_widget("marriageNotes")
@ -171,16 +157,13 @@ class Marriage:
self.gid = self.get_widget("gid") self.gid = self.get_widget("gid")
self.gid.set_editable(mode) self.gid.set_editable(mode)
self.attr_list = self.get_widget("attr_list") 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_add_btn = self.get_widget("marriage_add")
event_edit_btn = self.get_widget("marriage_edit") event_edit_btn = self.get_widget("marriage_edit")
event_delete_btn = self.get_widget("marriage_del") event_delete_btn = self.get_widget("marriage_del")
event_sel_btn = self.get_widget("marriage_sel") event_sel_btn = self.get_widget("marriage_sel")
self.attr_src_field = self.get_widget("attr_srcinfo") attr_add_btn = self.get_widget("attr_add")
self.attr_conf_field = self.get_widget("attr_conf") 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 = self.get_widget("lds_date")
self.lds_date.set_editable(mode) self.lds_date.set_editable(mode)
self.lds_date_led = self.get_widget("lds_date_stat") 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 = self.get_widget("mar_preform")
self.preform.set_sensitive(mode) self.preform.set_sensitive(mode)
#self.ereflist = family.get_event_ref_list()[:]
self.alist = family.get_attribute_list()[:] self.alist = family.get_attribute_list()[:]
self.lists_changed = 0 self.lists_changed = 0
@ -214,16 +196,6 @@ class Marriage:
# set initial data # set initial data
self.gallery.load_images() 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 # event display
self.event_box = ListBox.EventListBox( self.event_box = ListBox.EventListBox(
self, family, self.event_ref_list, self.events_label, self, family, self.event_ref_list, self.events_label,
@ -236,6 +208,13 @@ class Marriage:
frel = family.get_relationship() frel = family.get_relationship()
self.type_selector.set_values(frel) 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()) self.gid.set_text(family.get_gramps_id())
@ -286,17 +265,17 @@ class Marriage:
# self.ev_dest_drag_data_received) # self.ev_dest_drag_data_received)
#self.event_list.connect('drag_begin', self.ev_drag_begin) #self.event_list.connect('drag_begin', self.ev_drag_begin)
self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, #self.attr_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,
[DdTargets.FAMILY_ATTRIBUTE.target()], # [DdTargets.FAMILY_ATTRIBUTE.target()],
gtk.gdk.ACTION_COPY) # gtk.gdk.ACTION_COPY)
self.attr_list.drag_source_set(gtk.gdk.BUTTON1_MASK, #self.attr_list.drag_source_set(gtk.gdk.BUTTON1_MASK,
[DdTargets.FAMILY_ATTRIBUTE.target()], # [DdTargets.FAMILY_ATTRIBUTE.target()],
gtk.gdk.ACTION_COPY) # gtk.gdk.ACTION_COPY)
self.attr_list.connect('drag_data_get', #self.attr_list.connect('drag_data_get',
self.at_source_drag_data_get) # self.at_source_drag_data_get)
self.attr_list.connect('drag_data_received', #self.attr_list.connect('drag_data_received',
self.at_dest_drag_data_received) # self.at_dest_drag_data_received)
self.attr_list.connect('drag_begin', self.at_drag_begin) #self.attr_list.connect('drag_begin', self.at_drag_begin)
# set notes data # set notes data
self.notes_buffer = self.notes_field.get_buffer() 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('add_src'), self.top.get_widget('edit_src'),
self.top.get_widget('del_src'), self.db.readonly) self.top.get_widget('del_src'), self.db.readonly)
#self.redraw_event_list()
self.redraw_attr_list()
self.add_itself_to_winsmenu() self.add_itself_to_winsmenu()
self.top.get_widget('ok').set_sensitive(not self.db.readonly) self.top.get_widget('ok').set_sensitive(not self.db.readonly)
@ -536,7 +513,7 @@ class Marriage:
def update_lists(self): def update_lists(self):
eref_list = [event_ref for (event_ref,event) in self.event_box.data] eref_list = [event_ref for (event_ref,event) in self.event_box.data]
self.family.set_event_ref_list(eref_list) 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): def attr_edit_callback(self,attr):
self.redraw_attr_list() self.redraw_attr_list()
@ -739,11 +716,6 @@ class Marriage:
import EventEdit import EventEdit
EventEdit.EventRefEditor(None,None,self.family,self.db, EventEdit.EventRefEditor(None,None,self.family,self.db,
self.event_box.edit_callback,self) 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): def on_event_update_clicked(self,obj):
import EventEdit import EventEdit
@ -863,6 +835,8 @@ class Marriage:
def on_switch_page(self,obj,a,page): def on_switch_page(self,obj,a,page):
if page == 0: if page == 0:
self.event_box.redraw() self.event_box.redraw()
elif page == 1:
self.attr_box.redraw()
text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(),
self.notes_buffer.get_end_iter(),False)) self.notes_buffer.get_end_iter(),False))
if text: if text:

View File

@ -13223,267 +13223,6 @@ tories&lt;/b&gt;</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkVBox" id="vbox34">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child>
<widget class="GtkTable" id="table13">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">6</property>
<property name="n_columns">5</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label220">
<property name="visible">True</property>
<property name="label" translatable="yes">Value</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label243">
<property name="visible">True</property>
<property name="label" translatable="yes">Confidence:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label252">
<property name="visible">True</property>
<property name="label" translatable="yes">Name:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label253">
<property name="visible">True</property>
<property name="label" translatable="yes">Type:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label222">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Primary source&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">5</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label251">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Attributes&lt;/b&gt;</property>
<property name="use_underline">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>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">5</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="attr_value">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">5</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="attr_srcinfo">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="attr_conf">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="attr_type">
<property name="visible">True</property>
<property name="label" translatable="yes"></property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">5</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child> <child>
<widget class="GtkHBox" id="hbox21"> <widget class="GtkHBox" id="hbox21">
<property name="border_width">6</property> <property name="border_width">6</property>
@ -13552,7 +13291,7 @@ tories&lt;/b&gt;</property>
</child> </child>
<child> <child>
<widget class="GtkButton" id="button118"> <widget class="GtkButton" id="attr_edit">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property> <property name="relief">GTK_RELIEF_NORMAL</property>
@ -13616,13 +13355,6 @@ tories&lt;/b&gt;</property>
</packing> </packing>
</child> </child>
</widget> </widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
<packing> <packing>
<property name="tab_expand">False</property> <property name="tab_expand">False</property>
<property name="tab_fill">True</property> <property name="tab_fill">True</property>