Improved editor handling for marriage and person edits

svn: r1199
This commit is contained in:
Don Allingham 2002-11-21 04:41:40 +00:00
parent a3c7e8c4f9
commit 7b84333116
10 changed files with 239 additions and 206 deletions

View File

@ -89,16 +89,14 @@ class AddressEditor:
self.country.set_text(self.addr.getCountry()) self.country.set_text(self.addr.getCountry())
self.postal.set_text(self.addr.getPostal()) self.postal.set_text(self.addr.getPostal())
self.priv.set_active(self.addr.getPrivacy()) self.priv.set_active(self.addr.getPrivacy())
self.note_field.set_point(0) self.note_field.get_buffer().set_text(self.addr.getNote())
self.note_field.insert_defaults(self.addr.getNote())
self.note_field.set_word_wrap(1)
else: else:
self.srcreflist = [] self.srcreflist = []
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent, self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,
self.top, self.slist, self.top, self.slist,
self.top.get_widget('add_btn'), self.top.get_widget('add_src'),
self.top.get_widget('del_btn')) self.top.get_widget('del_src'))
date_stat = self.top.get_widget("date_stat") date_stat = self.top.get_widget("date_stat")
self.date_check = DateEdit(self.addr_start,date_stat) self.date_check = DateEdit(self.addr_start,date_stat)
@ -119,14 +117,15 @@ class AddressEditor:
state = self.state.get_text() state = self.state.get_text()
country = self.country.get_text() country = self.country.get_text()
postal = self.postal.get_text() postal = self.postal.get_text()
note = self.note_field.get_chars(0,-1) b = self.note_field.get_buffer()
note = b.get_text(b.get_start_iter(),b.get_end_iter(),gtk.FALSE)
priv = self.priv.get_active() priv = self.priv.get_active()
if self.addr == None: if self.addr == None:
self.addr = RelLib.Address() self.addr = RelLib.Address()
self.parent.plist.append(self.addr) self.parent.plist.append(self.addr)
self.addr.setSourceRefList(self.srcreflist) self.addr.setSourceRefList(self.srcreflist)
self.update(date,street,city,state,country,postal,note,priv) self.update(date,street,city,state,country,postal,note,priv)
self.parent.redraw_addr_list() self.parent.redraw_addr_list()
Utils.destroy_passed_object(obj) Utils.destroy_passed_object(obj)

View File

@ -51,6 +51,7 @@ from RelLib import *
import ImageSelect import ImageSelect
import sort import sort
import AutoComp import AutoComp
import ListModel
from DateEdit import DateEdit from DateEdit import DateEdit
from QuestionDialog import QuestionDialog from QuestionDialog import QuestionDialog
@ -110,13 +111,10 @@ class EditPerson:
"on_add_aka_clicked" : self.on_add_aka_clicked, "on_add_aka_clicked" : self.on_add_aka_clicked,
"on_add_attr_clicked" : self.on_add_attr_clicked, "on_add_attr_clicked" : self.on_add_attr_clicked,
"on_add_url_clicked" : self.on_add_url_clicked, "on_add_url_clicked" : self.on_add_url_clicked,
"on_addr_button_press" : self.addr_double_click,
"on_web_button_press" : self.url_double_click,
"on_addphoto_clicked" : self.gallery.on_add_photo_clicked, "on_addphoto_clicked" : self.gallery.on_add_photo_clicked,
"on_aka_delete_clicked" : self.on_aka_delete_clicked, "on_aka_delete_clicked" : self.on_aka_delete_clicked,
"on_aka_update_clicked" : self.on_aka_update_clicked, "on_aka_update_clicked" : self.on_aka_update_clicked,
"on_apply_person_clicked" : self.on_apply_person_clicked, "on_apply_person_clicked" : self.on_apply_person_clicked,
"on_attr_button_press" : self.attr_double_click,
"on_edit_birth_clicked" : self.on_edit_birth_clicked, "on_edit_birth_clicked" : self.on_edit_birth_clicked,
"on_edit_death_clicked" : self.on_edit_death_clicked, "on_edit_death_clicked" : self.on_edit_death_clicked,
"on_delete_address_clicked" : self.on_delete_addr_clicked, "on_delete_address_clicked" : self.on_delete_addr_clicked,
@ -127,10 +125,8 @@ class EditPerson:
"on_edit_properties_clicked": self.gallery.popup_change_description, "on_edit_properties_clicked": self.gallery.popup_change_description,
"on_editperson_switch_page" : self.on_switch_page, "on_editperson_switch_page" : self.on_switch_page,
"on_event_add_clicked" : self.on_event_add_clicked, "on_event_add_clicked" : self.on_event_add_clicked,
"on_event_button_press" : self.event_double_click,
"on_event_delete_clicked" : self.on_event_delete_clicked, "on_event_delete_clicked" : self.on_event_delete_clicked,
"on_event_update_clicked" : self.on_event_update_clicked, "on_event_update_clicked" : self.on_event_update_clicked,
"on_name_button_press" : self.aka_double_click,
"on_name_note_clicked" : self.on_name_note_clicked, "on_name_note_clicked" : self.on_name_note_clicked,
"on_ldsbap_note_clicked" : self.on_ldsbap_note_clicked, "on_ldsbap_note_clicked" : self.on_ldsbap_note_clicked,
"on_ldsendow_note_clicked" : self.on_ldsendow_note_clicked, "on_ldsendow_note_clicked" : self.on_ldsendow_note_clicked,
@ -219,38 +215,36 @@ class EditPerson:
self.plist = person.getAddressList()[:] self.plist = person.getAddressList()[:]
# event display # event display
self.event_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING, etitles = [(_('Event'),0,150),(_('Description'),1,150),
gobject.TYPE_STRING,gobject.TYPE_STRING) (_('Date'),3,100),(_('Place'),4,100)]
self.build_columns(self.event_list, [(_('Event'),150), (_('Description'),150), self.etree = ListModel.ListModel(self.event_list,etitles,
(_('Date'),100), (_('Place'),100)]) self.on_event_select_row,
self.event_list.set_model(self.event_model) self.on_event_update_clicked)
self.event_list.get_selection().connect('changed',self.on_event_select_row)
# attribute display # attribute display
self.attr_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING) atitles = [(_('Attribute'),0,150),(_('Value'),1,150)]
self.build_columns(self.attr_list, [(_('Attribute'),150),(_('Value'),150)]) self.atree = ListModel.ListModel(self.attr_list,atitles,
self.attr_list.set_model(self.attr_model) self.on_attr_select_row,
self.attr_list.get_selection().connect('changed',self.on_attr_select_row) self.on_update_attr_clicked)
# address display # address display
self.addr_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING, ptitles = [(_('Date'),0,150),(_('Address'),1,150)]
gobject.TYPE_STRING) self.ptree = ListModel.ListModel(self.addr_list, ptitles,
self.build_columns(self.addr_list, [(_('Date'),150),(_('Address'),150)]) self.on_addr_select_row,
self.addr_list.set_model(self.addr_model) self.on_update_addr_clicked)
self.addr_list.get_selection().connect('changed',self.on_addr_select_row)
# name display # name display
self.name_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING) ntitles = [(_('Name'),0,250),(_('Type'),1,100)]
self.build_columns(self.name_list,[(_('Name'),250),(_('Type'),100)]) self.ntree = ListModel.ListModel(self.name_list,ntitles,
self.name_list.set_model(self.name_model) self.on_name_select_row)
self.name_list.get_selection().connect('changed',self.on_name_select_row) self.ntree.tree.connect('event',self.aka_double_click)
# web display # web display
self.web_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING) wtitles = [(_('Path'),0,250),(_('Description'),1,100)]
self.build_columns(self.web_list, [(_('Path'),250),(_('Description'),100)]) self.wtree = ListModel.ListModel(self.web_list,wtitles,
self.web_list.set_model(self.web_model) self.on_web_select_row,
self.web_list.get_selection().connect('changed',self.on_web_select_row) self.on_update_url_clicked)
self.autoplace = AutoComp.AutoCombo(self.bpcombo,self.pmap.keys()) self.autoplace = AutoComp.AutoCombo(self.bpcombo,self.pmap.keys())
self.autodeath = AutoComp.AutoCombo(self.dpcombo,self.pmap.keys(), self.autodeath = AutoComp.AutoCombo(self.dpcombo,self.pmap.keys(),
@ -260,8 +254,6 @@ class EditPerson:
self.gid.set_text(person.getId()) self.gid.set_text(person.getId())
self.gid.set_editable(GrampsCfg.id_edit) self.gid.set_editable(GrampsCfg.id_edit)
self.event_list = self.get_widget("eventList")
self.lds_baptism = LdsOrd(self.person.getLdsBaptism()) self.lds_baptism = LdsOrd(self.person.getLdsBaptism())
self.lds_endowment = LdsOrd(self.person.getLdsEndowment()) self.lds_endowment = LdsOrd(self.person.getLdsEndowment())
self.lds_sealing = LdsOrd(self.person.getLdsSeal()) self.lds_sealing = LdsOrd(self.person.getLdsSeal())
@ -568,27 +560,37 @@ class EditPerson:
def redraw_name_list(self): def redraw_name_list(self):
"""redraws the name list""" """redraws the name list"""
Utils.redraw_list(self.nlist,self.name_model,disp_name) self.ntree.clear()
for name in self.nlist:
self.ntree.add([name.getName(),_(name.getType())],name)
def redraw_url_list(self): def redraw_url_list(self):
"""redraws the url list, disabling the go button if no url """redraws the url list, disabling the go button if no url
is selected""" is selected"""
length = Utils.redraw_list(self.ulist,self.web_model,disp_url) self.wtree.clear()
if length > 0: for url in self.ulist:
#self.web_go.set_sensitive(1) self.wtree.add([url.get_path(),url.get_description()],url)
if len(self.ulist) > 0:
self.web_go.set_sensitive(0) self.web_go.set_sensitive(0)
else: else:
self.web_go.set_sensitive(0) self.web_go.set_sensitive(0)
self.web_url.set_text("") self.web_url.set_text("")
self.web_description.set_text("") self.web_description.set_text("")
def redraw_attr_list(self):
"""Redraws the attribute list"""
Utils.redraw_list(self.alist,self.attr_model,disp_attr)
def redraw_addr_list(self): def redraw_addr_list(self):
"""redraws the address list for the person""" """Redraws the address list"""
Utils.redraw_list(self.plist,self.addr_model,disp_addr) self.ptree.clear()
for addr in self.plist:
location = "%s %s %s %s" % (addr.getStreet(),addr.getCity(),
addr.getState(),addr.getCountry())
self.ptree.add([addr.getDate(),location],addr)
def redraw_attr_list(self):
"""redraws the attribute list for the person"""
self.atree.clear()
for attr in self.alist:
self.atree.add([const.display_pattr(attr.getType()),attr.getValue()],attr)
def redraw_event_list(self): def redraw_event_list(self):
"""redraw_event_list - Update both the birth and death place combo """redraw_event_list - Update both the birth and death place combo
@ -597,8 +599,11 @@ class EditPerson:
any values in the death event, and vice versa. Since updating a any values in the death event, and vice versa. Since updating a
combo list resets its present value, this code will have to save combo list resets its present value, this code will have to save
and restore the value for the event *not* being edited.""" and restore the value for the event *not* being edited."""
Utils.redraw_list(self.elist,self.event_model,disp_event) self.etree.clear()
for event in self.elist:
self.etree.add([const.display_pevent(event.getName()),event.getDescription(),
event.getQuoteDate(),event.getPlaceName()],event)
# Remember old combo list input # Remember old combo list input
prev_btext = Utils.strip_id(self.bplace.get_text()) prev_btext = Utils.strip_id(self.bplace.get_text())
@ -697,25 +702,33 @@ class EditPerson:
def on_aka_delete_clicked(self,obj): def on_aka_delete_clicked(self,obj):
"""Deletes the selected name from the name list""" """Deletes the selected name from the name list"""
if Utils.delete_selected(obj,self.nlist): store,iter = self.ntree.get_selected()
if iter:
self.nlist.remove(self.ntree.get_object(iter))
self.lists_changed = 1 self.lists_changed = 1
self.redraw_name_list() self.redraw_name_list()
def on_delete_url_clicked(self,obj): def on_delete_url_clicked(self,obj):
"""Deletes the selected URL from the URL list""" """Deletes the selected URL from the URL list"""
if Utils.delete_selected(obj,self.ulist): store,iter = self.wtree.get_selected()
if iter:
self.ulist.remove(self.wtree.get_object(iter))
self.lists_changed = 1 self.lists_changed = 1
self.redraw_url_list() self.redraw_url_list()
def on_delete_attr_clicked(self,obj): def on_delete_attr_clicked(self,obj):
"""Deletes the selected attribute from the attribute list""" """Deletes the selected attribute from the attribute list"""
if Utils.delete_selected(obj,self.alist): store,iter = self.atree.get_selected()
if iter:
self.alist.remove(self.atree.get_object(iter))
self.lists_changed = 1 self.lists_changed = 1
self.redraw_attr_list() self.redraw_attr_list()
def on_delete_addr_clicked(self,obj): def on_delete_addr_clicked(self,obj):
"""Deletes the selected address from the address list""" """Deletes the selected address from the address list"""
if Utils.delete_selected(obj,self.plist): store,iter = self.ptree.get_selected()
if iter:
self.plist.remove(self.ptree.get_object(iter))
self.lists_changed = 1 self.lists_changed = 1
self.redraw_addr_list() self.redraw_addr_list()
@ -877,29 +890,19 @@ class EditPerson:
# self.bplace.set_position(0) # self.bplace.set_position(0)
# self.dplace.set_position(0) # self.dplace.set_position(0)
def attr_double_click(self,obj,event):
if event.button == 1 and event.type == _2BUTTON_PRESS:
self.on_update_attr_clicked(obj)
def on_update_attr_clicked(self,obj): def on_update_attr_clicked(self,obj):
import AttrEdit import AttrEdit
if obj.selection: store,iter = self.atree.get_selected()
attr = obj.get_row_data(obj.selection[0]) if iter:
attr = self.atree.get_object(iter)
pname = self.person.getPrimaryName().getName() pname = self.person.getPrimaryName().getName()
AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes) AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes)
def addr_double_click(self,obj,event):
if event.button == 1 and event.type == _2BUTTON_PRESS:
self.on_update_addr_clicked(obj)
def on_update_addr_clicked(self,obj): def on_update_addr_clicked(self,obj):
import AddrEdit import AddrEdit
if obj.selection: store,iter = self.ptree.get_selected()
AddrEdit.AddressEditor(self,obj.get_row_data(obj.selection[0])) if iter:
AddrEdit.AddressEditor(self.ptree.get_object(iter))
def url_double_click(self,obj,event):
if event.button == 1 and event.type == _2BUTTON_PRESS:
self.on_update_url_clicked(obj)
def on_update_url_clicked(self,obj): def on_update_url_clicked(self,obj):
import UrlEdit import UrlEdit
@ -908,18 +911,17 @@ class EditPerson:
url = obj.get_row_data(obj.selection[0]) url = obj.get_row_data(obj.selection[0])
UrlEdit.UrlEditor(self,pname,url) UrlEdit.UrlEditor(self,pname,url)
def event_double_click(self,obj,event):
if event.button == 1 and event.type == _2BUTTON_PRESS:
self.on_event_update_clicked(obj)
def on_event_update_clicked(self,obj): def on_event_update_clicked(self,obj):
import EventEdit import EventEdit
if obj.selection:
pname = self.person.getPrimaryName().getName() store,iter = self.etree.get_selected()
event = obj.get_row_data(obj.selection[0]) if not iter:
EventEdit.EventEditor(self,pname,const.personalEvents, return
const.save_fevent,event,None,0, pname = self.person.getPrimaryName().getName()
self.callback) event = self.etree.get_object(iter)
EventEdit.EventEditor(self,pname,const.personalEvents,
const.save_fevent,event,None,0,
self.callback)
def on_event_select_row(self,obj): def on_event_select_row(self,obj):
store,iter = obj.get_selected() store,iter = obj.get_selected()
@ -950,10 +952,9 @@ class EditPerson:
self.event_delete_btn.set_sensitive(0) self.event_delete_btn.set_sensitive(0)
def on_addr_select_row(self,obj): def on_addr_select_row(self,obj):
store,iter = obj.get_selected() store,iter = self.ptree.get_selected()
if iter: if iter:
row = store.get_path(iter) addr = self.ptree.get_object(iter)
addr = self.plist[row[0]]
label = "%s %s %s" % (addr.getCity(),addr.getState(),addr.getCountry()) label = "%s %s %s" % (addr.getCity(),addr.getState(),addr.getCountry())
self.addr_label.set_label(label) self.addr_label.set_label(label)
self.addr_start.set_text(addr.getDate()) self.addr_start.set_text(addr.getDate())
@ -983,10 +984,9 @@ class EditPerson:
self.addr_delete_btn.set_sensitive(0) self.addr_delete_btn.set_sensitive(0)
def on_name_select_row(self,obj): def on_name_select_row(self,obj):
store,iter = obj.get_selected() store,iter = self.ntree.get_selected()
if iter: if iter:
row = store.get_path(iter) name = self.ntree.get_object(iter)
name = self.nlist[row[0]]
self.name_frame.set_label(name.getName()) self.name_frame.set_label(name.getName())
self.alt_given_field.set_text(name.getFirstName()) self.alt_given_field.set_text(name.getFirstName())
self.alt_title_field.set_text(name.getTitle()) self.alt_title_field.set_text(name.getTitle())
@ -1013,10 +1013,9 @@ class EditPerson:
self.name_delete_btn.set_sensitive(0) self.name_delete_btn.set_sensitive(0)
def on_web_select_row(self,obj): def on_web_select_row(self,obj):
store,iter = obj.get_selected() store,iter = self.wtree.get_selected()
if iter: if iter:
row = store.get_path(iter) url = self.wtree.get_object(iter)
url = self.ulist[row[0]]
path = url.get_path() path = url.get_path()
self.web_url.set_text(path) self.web_url.set_text(path)
self.web_description.set_text(url.get_description()) self.web_description.set_text(url.get_description())
@ -1030,10 +1029,9 @@ class EditPerson:
self.web_delete_btn.set_sensitive(0) self.web_delete_btn.set_sensitive(0)
def on_attr_select_row(self,obj): def on_attr_select_row(self,obj):
store,iter = obj.get_selected() store,iter = self.atree.get_selected()
if iter: if iter:
row = store.get_path(iter) attr = self.atree.get_object(iter)
attr = self.alist[row[0]]
self.attr_type.set_label(const.display_pattr(attr.getType())) self.attr_type.set_label(const.display_pattr(attr.getType()))
self.attr_value.set_text(attr.getValue()) self.attr_value.set_text(attr.getValue())
if len(attr.getSourceRefList()) > 0: if len(attr.getSourceRefList()) > 0:
@ -1052,9 +1050,9 @@ class EditPerson:
self.attr_delete_btn.set_sensitive(0) self.attr_delete_btn.set_sensitive(0)
def aka_double_click(self,obj,event): def aka_double_click(self,obj,event):
if event.button == 1 and event.type == _2BUTTON_PRESS: if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
self.on_aka_update_clicked(obj) self.on_aka_update_clicked(obj)
elif event.button == 3: elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
menu = gtk.Menu() menu = gtk.Menu()
item = gtk.TearoffMenuItem() item = gtk.TearoffMenuItem()
item.show() item.show()
@ -1065,8 +1063,9 @@ class EditPerson:
def on_aka_update_clicked(self,obj): def on_aka_update_clicked(self,obj):
import NameEdit import NameEdit
if obj.selection: store,iter = self.ntree.get_selected()
NameEdit.NameEditor(self,obj.get_row_data(obj.selection[0])) if iter:
NameEdit.NameEditor(self,self.ntree.get_object(iter))
def load_photo(self,photo): def load_photo(self,photo):
"""loads, scales, and displays the person's main photo""" """loads, scales, and displays the person's main photo"""
@ -1386,48 +1385,6 @@ class EditPerson:
self.ntype_field.entry.set_text(_(self.pname.getType())) self.ntype_field.entry.set_text(_(self.pname.getType()))
self.title.set_text(self.pname.getTitle()) self.title.set_text(self.pname.getTitle())
#-------------------------------------------------------------------------
#
# disp_name
#
#-------------------------------------------------------------------------
def disp_name(name):
return [name.getName(),_(name.getType())]
#-------------------------------------------------------------------------
#
# disp_url
#
#-------------------------------------------------------------------------
def disp_url(url):
return [url.get_path(),url.get_description()]
#-------------------------------------------------------------------------
#
# disp_attr
#
#-------------------------------------------------------------------------
def disp_attr(attr):
return [const.display_pattr(attr.getType()),attr.getValue()]
#-------------------------------------------------------------------------
#
# disp_addr
#
#-------------------------------------------------------------------------
def disp_addr(addr):
location = "%s %s %s" % (addr.getCity(),addr.getState(),addr.getCountry())
return [addr.getDate(),location]
#-------------------------------------------------------------------------
#
# disp_event
#
#-------------------------------------------------------------------------
def disp_event(event):
return [const.display_pevent(event.getName()),event.getDescription(),
event.getQuoteDate(),event.getPlaceName()]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# birth_dates_in_order # birth_dates_in_order

View File

@ -113,7 +113,6 @@ class FamilyView:
self.add_spouse_btn.connect('clicked',self.add_spouse) self.add_spouse_btn.connect('clicked',self.add_spouse)
self.spouse_list.connect('button-press-event',self.edit_releationship) self.spouse_list.connect('button-press-event',self.edit_releationship)
self.child_list.set_model(self.child_model) self.child_list.set_model(self.child_model)
self.child_list.set_search_column(0) self.child_list.set_search_column(0)
self.child_selection = self.child_list.get_selection() self.child_selection = self.child_list.get_selection()
@ -269,6 +268,7 @@ class FamilyView:
self.selected_spouse = None self.selected_spouse = None
self.spouse_model.clear() self.spouse_model.clear()
self.child_model.clear()
splist = self.person.getFamilyList() splist = self.person.getFamilyList()
f = None f = None
first_family = None first_family = None

View File

@ -81,6 +81,13 @@ class ListModel:
def remove(self,iter): def remove(self,iter):
self.model.remove(iter) self.model.remove(iter)
def get_row(self,iter):
row = self.model.get_path(iter)
return row[0]
def select_row(self,row):
self.selection.select_path((row))
def get_object(self,iter): def get_object(self,iter):
return self.model.get_value(iter,self.data_index) return self.model.get_value(iter,self.data_index)

View File

@ -40,19 +40,17 @@ import const
import GrampsCfg import GrampsCfg
import Utils import Utils
import AutoComp import AutoComp
import ListModel
from QuestionDialog import QuestionDialog from QuestionDialog import QuestionDialog
from RelLib import * from RelLib import *
import ImageSelect import ImageSelect
from intl import gettext from intl import gettext as _
_ = gettext
_temple_names = const.lds_temple_codes.keys() _temple_names = const.lds_temple_codes.keys()
_temple_names.sort() _temple_names.sort()
_temple_names = [""] + _temple_names _temple_names = [""] + _temple_names
pycode_tgts = [('fevent', 0, 0), pycode_tgts = [('fevent', 0, 0), ('fattr', 0, 1)]
('fattr', 0, 1)]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -82,12 +80,12 @@ class Marriage:
"destroy_passed_object" : self.on_cancel_edit, "destroy_passed_object" : self.on_cancel_edit,
"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_add_attr_clicked" : self.on_add_attr_clicked,
"on_addphoto_clicked" : self.gallery.on_add_photo_clicked,
"on_attr_list_select_row" : self.on_attr_list_select_row,
# "on_combo_insert_text" : Utils.combo_insert_text,
"on_close_marriage_editor" : self.on_close_marriage_editor,
"on_delete_attr_clicked" : self.on_delete_attr_clicked, "on_delete_attr_clicked" : self.on_delete_attr_clicked,
"on_addphoto_clicked" : self.gallery.on_add_photo_clicked,
"on_close_marriage_editor" : self.on_close_marriage_editor,
"on_delete_event" : self.on_delete_event, "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,
@ -95,11 +93,6 @@ class Marriage:
"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_marriageAddBtn_clicked" : self.on_add_clicked,
"on_marriageDeleteBtn_clicked" : self.on_delete_clicked, "on_marriageDeleteBtn_clicked" : self.on_delete_clicked,
"on_marriageEventList_select_row" : self.on_select_row,
"on_marriageUpdateBtn_clicked" : self.on_update_clicked,
"on_photolist_button_press_event" : self.gallery.on_button_press_event,
"on_photolist_select_icon" : self.gallery.on_photo_select_icon,
"on_update_attr_clicked" : self.on_update_attr_clicked,
}) })
text_win = self.get_widget("marriageTitle") text_win = self.get_widget("marriageTitle")
@ -137,26 +130,15 @@ class Marriage:
# set initial data # set initial data
self.gallery.load_images() self.gallery.load_images()
self.event_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING, etitles = [(_('Event'),0,150),(_('Date'),1,150),(_('Place'),2,150)]
gobject.TYPE_STRING) atitles = [(_('Attribute'),0,150),(_('Value'),1,150)]
cnum = 0
for name in [_('Event'),_('Date'),_('Place')]:
renderer = gtk.CellRendererText()
column = gtk.TreeViewColumn(name,renderer,text=cnum)
cnum = cnum + 1
self.event_list.append_column(column)
self.event_list.set_model(self.event_model)
self.attr_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING) self.etree = ListModel.ListModel(self.event_list, etitles,
cnum = 0 self.on_select_row,
for name in [_('Attribute'),_('Value')]: self.on_update_clicked)
renderer = gtk.CellRendererText() self.atree = ListModel.ListModel(self.attr_list, atitles,
column = gtk.TreeViewColumn(name,renderer,text=cnum) self.on_attr_list_select_row,
cnum = cnum + 1 self.on_update_attr_clicked)
self.attr_list.append_column(column)
self.attr_list.set_model(self.attr_model)
self.addr_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING)
self.type_field.set_popdown_strings(const.familyRelations) self.type_field.set_popdown_strings(const.familyRelations)
frel = const.display_frel(family.getRelationship()) frel = const.display_frel(family.getRelationship())
@ -241,18 +223,38 @@ class Marriage:
NoteEdit.NoteEditor(ord) NoteEdit.NoteEditor(ord)
def on_up_clicked(self,obj): def on_up_clicked(self,obj):
if len(obj.selection) == 0: model,iter = self.etree.get_selected()
if not iter:
return return
row = obj.selection[0]
row = self.etree.get_row(iter)
if row != 0: if row != 0:
obj.select_row(row-1,0) self.etree.select_row(row-1)
def on_down_clicked(self,obj): def on_down_clicked(self,obj):
if len(obj.selection) == 0: model,iter = self.etree.get_selected()
if not iter:
return return
row = obj.selection[0]
if row != obj.rows-1: row = self.etree.get_row(iter)
obj.select_row(row+1,0) self.etree.select_row(row+1)
def on_attr_up_clicked(self,obj):
model,iter = self.atree.get_selected()
if not iter:
return
row = self.atree.get_row(iter)
if row != 0:
self.atree.select_row(row-1)
def on_attr_down_clicked(self,obj):
model,iter = self.atree.get_selected()
if not iter:
return
row = self.atree.get_row(iter)
self.atree.select_row(row+1)
def ev_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time): def ev_dest_drag_data_received(self,widget,context,x,y,selection_data,info,time):
if selection_data and selection_data.data: if selection_data and selection_data.data:
@ -314,10 +316,12 @@ class Marriage:
self.family.setAttributeList(self.alist) self.family.setAttributeList(self.alist)
def redraw_attr_list(self): def redraw_attr_list(self):
Utils.redraw_list(self.alist,self.attr_model,disp_attr) for data in self.alist:
self.atree.add([data.getName(),data.getValue()],data)
def redraw_event_list(self): def redraw_event_list(self):
Utils.redraw_list(self.elist,self.event_model,disp_event) for data in self.elist:
self.etree.add([data.getName(),data.getQuoteDate(),data.getPlaceName()],data)
def get_widget(self,name): def get_widget(self,name):
return self.top.get_widget(name) return self.top.get_widget(name)
@ -469,10 +473,10 @@ class Marriage:
def on_update_clicked(self,obj): def on_update_clicked(self,obj):
import EventEdit import EventEdit
if len(obj.selection) <= 0: model,iter = self.etree.get_selected()
if not iter:
return return
event = self.etree.get_object(iter)
event = obj.get_row_data(obj.selection[0])
name = Utils.family_name(self.family) name = Utils.family_name(self.family)
EventEdit.EventEditor(self,name,const.marriageEvents, EventEdit.EventEditor(self,name,const.marriageEvents,
const.save_pevent,event,None,0,self.cb) const.save_pevent,event,None,0,self.cb)
@ -482,8 +486,12 @@ class Marriage:
self.lists_changed = 1 self.lists_changed = 1
self.redraw_event_list() self.redraw_event_list()
def on_select_row(self,obj,row,b,c): def on_select_row(self,obj):
event = obj.get_row_data(row)
model,iter = self.etree.get_selected()
if not iter:
return
event = self.etree.get_object(iter)
self.date_field.set_text(event.getDate()) self.date_field.set_text(event.getDate())
self.place_field.set_text(event.getPlaceName()) self.place_field.set_text(event.getPlaceName())
@ -498,8 +506,11 @@ class Marriage:
self.event_conf_field.set_text('') self.event_conf_field.set_text('')
self.descr_field.set_text(event.getDescription()) self.descr_field.set_text(event.getDescription())
def on_attr_list_select_row(self,obj,row,b,c): def on_attr_list_select_row(self,obj):
attr = obj.get_row_data(row) model,iter = self.atree.get_selected()
if not iter:
return
attr = self.atree.get_object(iter)
self.attr_type.set_label(const.display_fattr(attr.getType())) self.attr_type.set_label(const.display_fattr(attr.getType()))
self.attr_value.set_text(attr.getValue()) self.attr_value.set_text(attr.getValue())
@ -513,19 +524,22 @@ class Marriage:
def on_update_attr_clicked(self,obj): def on_update_attr_clicked(self,obj):
import AttrEdit import AttrEdit
if len(obj.selection) > 0: model,iter = self.atree.get_selected()
row = obj.selection[0] if not iter:
attr = obj.get_row_data(row) return
father = self.family.getFather()
mother = self.family.getMother() attr = self.atree.get_object(iter)
if father and mother:
name = _("%s and %s") % (father.getPrimaryName().getName(), father = self.family.getFather()
mother = self.family.getMother()
if father and mother:
name = _("%s and %s") % (father.getPrimaryName().getName(),
mother.getPrimaryName().getName()) mother.getPrimaryName().getName())
elif father: elif father:
name = father.getPrimaryName().getName() name = father.getPrimaryName().getName()
else: else:
name = mother.getPrimaryName().getName() name = mother.getPrimaryName().getName()
AttrEdit.AttributeEditor(self,attr,name,const.familyAttributes) AttrEdit.AttributeEditor(self,attr,name,const.familyAttributes)
def on_delete_attr_clicked(self,obj): def on_delete_attr_clicked(self,obj):
if Utils.delete_selected(obj,self.alist): if Utils.delete_selected(obj,self.alist):

BIN
src/bad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 300 B

BIN
src/caution.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 342 B

View File

@ -56,9 +56,9 @@ if os.environ.has_key('GRAMPSDIR'):
else: else:
rootDir = "." rootDir = "."
good_xpm = "%s/good.xpm" % rootDir good_xpm = "%s/good.png" % rootDir
bad_xpm = "%s/bad.xpm" % rootDir bad_xpm = "%s/bad.png" % rootDir
caution_xpm = "%s/caution.xpm" % rootDir caution_xpm = "%s/caution.png" % rootDir
papersize = "%s/papersize.xml" % rootDir papersize = "%s/papersize.xml" % rootDir
system_filters = "%s/system_filters.xml" % rootDir system_filters = "%s/system_filters.xml" % rootDir

BIN
src/good.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 B

View File

@ -783,6 +783,20 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property> <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
<property name="spacing">2</property> <property name="spacing">2</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox36">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child> <child>
<widget class="GtkButton" id="button112"> <widget class="GtkButton" id="button112">
@ -804,6 +818,15 @@
</widget> </widget>
</child> </child>
</widget> </widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child> </child>
<child> <child>
@ -826,6 +849,11 @@
</widget> </widget>
</child> </child>
</widget> </widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child> </child>
</widget> </widget>
<packing> <packing>
@ -1205,6 +1233,20 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property> <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
<property name="spacing">2</property> <property name="spacing">2</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<widget class="GtkVBox" id="vbox37">
<property name="border_width">5</property>
<property name="visible">True</property>
<property name="homogeneous">True</property>
<property name="spacing">0</property>
<child> <child>
<widget class="GtkButton" id="button110"> <widget class="GtkButton" id="button110">
@ -1212,7 +1254,7 @@
<property name="can_default">True</property> <property name="can_default">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>
<signal name="clicked" handler="on_up_clicked" object="attr_list"/> <signal name="clicked" handler="on_attr_up_clicked" last_modification_time="Wed, 20 Nov 2002 04:42:10 GMT"/>
<child> <child>
<widget class="GtkArrow" id="arrow1"> <widget class="GtkArrow" id="arrow1">
@ -1226,6 +1268,15 @@
</widget> </widget>
</child> </child>
</widget> </widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<placeholder/>
</child> </child>
<child> <child>
@ -1234,7 +1285,7 @@
<property name="can_default">True</property> <property name="can_default">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>
<signal name="clicked" handler="on_down_clicked" object="attr_list"/> <signal name="clicked" handler="on_attr_down_clicked" last_modification_time="Wed, 20 Nov 2002 04:42:25 GMT"/>
<child> <child>
<widget class="GtkArrow" id="arrow2"> <widget class="GtkArrow" id="arrow2">
@ -1248,6 +1299,11 @@
</widget> </widget>
</child> </child>
</widget> </widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child> </child>
</widget> </widget>
<packing> <packing>