Improved editor handling for marriage and person edits
svn: r1199
This commit is contained in:
parent
037ef4bc75
commit
7cbf2d3935
@ -89,16 +89,14 @@ class AddressEditor:
|
||||
self.country.set_text(self.addr.getCountry())
|
||||
self.postal.set_text(self.addr.getPostal())
|
||||
self.priv.set_active(self.addr.getPrivacy())
|
||||
self.note_field.set_point(0)
|
||||
self.note_field.insert_defaults(self.addr.getNote())
|
||||
self.note_field.set_word_wrap(1)
|
||||
self.note_field.get_buffer().set_text(self.addr.getNote())
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,
|
||||
self.top, self.slist,
|
||||
self.top.get_widget('add_btn'),
|
||||
self.top.get_widget('del_btn'))
|
||||
self.top.get_widget('add_src'),
|
||||
self.top.get_widget('del_src'))
|
||||
|
||||
date_stat = self.top.get_widget("date_stat")
|
||||
self.date_check = DateEdit(self.addr_start,date_stat)
|
||||
@ -119,14 +117,15 @@ class AddressEditor:
|
||||
state = self.state.get_text()
|
||||
country = self.country.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()
|
||||
|
||||
if self.addr == None:
|
||||
self.addr = RelLib.Address()
|
||||
self.parent.plist.append(self.addr)
|
||||
self.addr.setSourceRefList(self.srcreflist)
|
||||
|
||||
|
||||
self.update(date,street,city,state,country,postal,note,priv)
|
||||
self.parent.redraw_addr_list()
|
||||
Utils.destroy_passed_object(obj)
|
||||
|
@ -51,6 +51,7 @@ from RelLib import *
|
||||
import ImageSelect
|
||||
import sort
|
||||
import AutoComp
|
||||
import ListModel
|
||||
from DateEdit import DateEdit
|
||||
from QuestionDialog import QuestionDialog
|
||||
|
||||
@ -110,13 +111,10 @@ class EditPerson:
|
||||
"on_add_aka_clicked" : self.on_add_aka_clicked,
|
||||
"on_add_attr_clicked" : self.on_add_attr_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_aka_delete_clicked" : self.on_aka_delete_clicked,
|
||||
"on_aka_update_clicked" : self.on_aka_update_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_death_clicked" : self.on_edit_death_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_editperson_switch_page" : self.on_switch_page,
|
||||
"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_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_ldsbap_note_clicked" : self.on_ldsbap_note_clicked,
|
||||
"on_ldsendow_note_clicked" : self.on_ldsendow_note_clicked,
|
||||
@ -219,38 +215,36 @@ class EditPerson:
|
||||
self.plist = person.getAddressList()[:]
|
||||
|
||||
# event display
|
||||
self.event_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING,gobject.TYPE_STRING)
|
||||
|
||||
self.build_columns(self.event_list, [(_('Event'),150), (_('Description'),150),
|
||||
(_('Date'),100), (_('Place'),100)])
|
||||
self.event_list.set_model(self.event_model)
|
||||
self.event_list.get_selection().connect('changed',self.on_event_select_row)
|
||||
etitles = [(_('Event'),0,150),(_('Description'),1,150),
|
||||
(_('Date'),3,100),(_('Place'),4,100)]
|
||||
|
||||
self.etree = ListModel.ListModel(self.event_list,etitles,
|
||||
self.on_event_select_row,
|
||||
self.on_event_update_clicked)
|
||||
|
||||
# attribute display
|
||||
self.attr_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING)
|
||||
self.build_columns(self.attr_list, [(_('Attribute'),150),(_('Value'),150)])
|
||||
self.attr_list.set_model(self.attr_model)
|
||||
self.attr_list.get_selection().connect('changed',self.on_attr_select_row)
|
||||
|
||||
atitles = [(_('Attribute'),0,150),(_('Value'),1,150)]
|
||||
self.atree = ListModel.ListModel(self.attr_list,atitles,
|
||||
self.on_attr_select_row,
|
||||
self.on_update_attr_clicked)
|
||||
|
||||
# address display
|
||||
self.addr_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING)
|
||||
self.build_columns(self.addr_list, [(_('Date'),150),(_('Address'),150)])
|
||||
self.addr_list.set_model(self.addr_model)
|
||||
self.addr_list.get_selection().connect('changed',self.on_addr_select_row)
|
||||
ptitles = [(_('Date'),0,150),(_('Address'),1,150)]
|
||||
self.ptree = ListModel.ListModel(self.addr_list, ptitles,
|
||||
self.on_addr_select_row,
|
||||
self.on_update_addr_clicked)
|
||||
|
||||
# name display
|
||||
self.name_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING)
|
||||
self.build_columns(self.name_list,[(_('Name'),250),(_('Type'),100)])
|
||||
self.name_list.set_model(self.name_model)
|
||||
self.name_list.get_selection().connect('changed',self.on_name_select_row)
|
||||
ntitles = [(_('Name'),0,250),(_('Type'),1,100)]
|
||||
self.ntree = ListModel.ListModel(self.name_list,ntitles,
|
||||
self.on_name_select_row)
|
||||
self.ntree.tree.connect('event',self.aka_double_click)
|
||||
|
||||
# web display
|
||||
self.web_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING)
|
||||
self.build_columns(self.web_list, [(_('Path'),250),(_('Description'),100)])
|
||||
self.web_list.set_model(self.web_model)
|
||||
self.web_list.get_selection().connect('changed',self.on_web_select_row)
|
||||
wtitles = [(_('Path'),0,250),(_('Description'),1,100)]
|
||||
self.wtree = ListModel.ListModel(self.web_list,wtitles,
|
||||
self.on_web_select_row,
|
||||
self.on_update_url_clicked)
|
||||
|
||||
self.autoplace = AutoComp.AutoCombo(self.bpcombo,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_editable(GrampsCfg.id_edit)
|
||||
|
||||
self.event_list = self.get_widget("eventList")
|
||||
|
||||
self.lds_baptism = LdsOrd(self.person.getLdsBaptism())
|
||||
self.lds_endowment = LdsOrd(self.person.getLdsEndowment())
|
||||
self.lds_sealing = LdsOrd(self.person.getLdsSeal())
|
||||
@ -568,27 +560,37 @@ class EditPerson:
|
||||
|
||||
def redraw_name_list(self):
|
||||
"""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):
|
||||
"""redraws the url list, disabling the go button if no url
|
||||
is selected"""
|
||||
length = Utils.redraw_list(self.ulist,self.web_model,disp_url)
|
||||
if length > 0:
|
||||
#self.web_go.set_sensitive(1)
|
||||
self.wtree.clear()
|
||||
for url in self.ulist:
|
||||
self.wtree.add([url.get_path(),url.get_description()],url)
|
||||
|
||||
if len(self.ulist) > 0:
|
||||
self.web_go.set_sensitive(0)
|
||||
else:
|
||||
self.web_go.set_sensitive(0)
|
||||
self.web_url.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):
|
||||
"""redraws the address list for the person"""
|
||||
Utils.redraw_list(self.plist,self.addr_model,disp_addr)
|
||||
"""Redraws the address list"""
|
||||
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):
|
||||
"""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
|
||||
combo list resets its present value, this code will have to save
|
||||
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
|
||||
prev_btext = Utils.strip_id(self.bplace.get_text())
|
||||
@ -697,25 +702,33 @@ class EditPerson:
|
||||
|
||||
def on_aka_delete_clicked(self,obj):
|
||||
"""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.redraw_name_list()
|
||||
|
||||
def on_delete_url_clicked(self,obj):
|
||||
"""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.redraw_url_list()
|
||||
|
||||
def on_delete_attr_clicked(self,obj):
|
||||
"""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.redraw_attr_list()
|
||||
|
||||
def on_delete_addr_clicked(self,obj):
|
||||
"""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.redraw_addr_list()
|
||||
|
||||
@ -877,29 +890,19 @@ class EditPerson:
|
||||
# self.bplace.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):
|
||||
import AttrEdit
|
||||
if obj.selection:
|
||||
attr = obj.get_row_data(obj.selection[0])
|
||||
store,iter = self.atree.get_selected()
|
||||
if iter:
|
||||
attr = self.atree.get_object(iter)
|
||||
pname = self.person.getPrimaryName().getName()
|
||||
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):
|
||||
import AddrEdit
|
||||
if obj.selection:
|
||||
AddrEdit.AddressEditor(self,obj.get_row_data(obj.selection[0]))
|
||||
|
||||
def url_double_click(self,obj,event):
|
||||
if event.button == 1 and event.type == _2BUTTON_PRESS:
|
||||
self.on_update_url_clicked(obj)
|
||||
store,iter = self.ptree.get_selected()
|
||||
if iter:
|
||||
AddrEdit.AddressEditor(self.ptree.get_object(iter))
|
||||
|
||||
def on_update_url_clicked(self,obj):
|
||||
import UrlEdit
|
||||
@ -908,18 +911,17 @@ class EditPerson:
|
||||
url = obj.get_row_data(obj.selection[0])
|
||||
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):
|
||||
import EventEdit
|
||||
if obj.selection:
|
||||
pname = self.person.getPrimaryName().getName()
|
||||
event = obj.get_row_data(obj.selection[0])
|
||||
EventEdit.EventEditor(self,pname,const.personalEvents,
|
||||
const.save_fevent,event,None,0,
|
||||
self.callback)
|
||||
|
||||
store,iter = self.etree.get_selected()
|
||||
if not iter:
|
||||
return
|
||||
pname = self.person.getPrimaryName().getName()
|
||||
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):
|
||||
store,iter = obj.get_selected()
|
||||
@ -950,10 +952,9 @@ class EditPerson:
|
||||
self.event_delete_btn.set_sensitive(0)
|
||||
|
||||
def on_addr_select_row(self,obj):
|
||||
store,iter = obj.get_selected()
|
||||
store,iter = self.ptree.get_selected()
|
||||
if iter:
|
||||
row = store.get_path(iter)
|
||||
addr = self.plist[row[0]]
|
||||
addr = self.ptree.get_object(iter)
|
||||
label = "%s %s %s" % (addr.getCity(),addr.getState(),addr.getCountry())
|
||||
self.addr_label.set_label(label)
|
||||
self.addr_start.set_text(addr.getDate())
|
||||
@ -983,10 +984,9 @@ class EditPerson:
|
||||
self.addr_delete_btn.set_sensitive(0)
|
||||
|
||||
def on_name_select_row(self,obj):
|
||||
store,iter = obj.get_selected()
|
||||
store,iter = self.ntree.get_selected()
|
||||
if iter:
|
||||
row = store.get_path(iter)
|
||||
name = self.nlist[row[0]]
|
||||
name = self.ntree.get_object(iter)
|
||||
self.name_frame.set_label(name.getName())
|
||||
self.alt_given_field.set_text(name.getFirstName())
|
||||
self.alt_title_field.set_text(name.getTitle())
|
||||
@ -1013,10 +1013,9 @@ class EditPerson:
|
||||
self.name_delete_btn.set_sensitive(0)
|
||||
|
||||
def on_web_select_row(self,obj):
|
||||
store,iter = obj.get_selected()
|
||||
store,iter = self.wtree.get_selected()
|
||||
if iter:
|
||||
row = store.get_path(iter)
|
||||
url = self.ulist[row[0]]
|
||||
url = self.wtree.get_object(iter)
|
||||
path = url.get_path()
|
||||
self.web_url.set_text(path)
|
||||
self.web_description.set_text(url.get_description())
|
||||
@ -1030,10 +1029,9 @@ class EditPerson:
|
||||
self.web_delete_btn.set_sensitive(0)
|
||||
|
||||
def on_attr_select_row(self,obj):
|
||||
store,iter = obj.get_selected()
|
||||
store,iter = self.atree.get_selected()
|
||||
if iter:
|
||||
row = store.get_path(iter)
|
||||
attr = self.alist[row[0]]
|
||||
attr = self.atree.get_object(iter)
|
||||
self.attr_type.set_label(const.display_pattr(attr.getType()))
|
||||
self.attr_value.set_text(attr.getValue())
|
||||
if len(attr.getSourceRefList()) > 0:
|
||||
@ -1052,9 +1050,9 @@ class EditPerson:
|
||||
self.attr_delete_btn.set_sensitive(0)
|
||||
|
||||
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)
|
||||
elif event.button == 3:
|
||||
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
|
||||
menu = gtk.Menu()
|
||||
item = gtk.TearoffMenuItem()
|
||||
item.show()
|
||||
@ -1065,8 +1063,9 @@ class EditPerson:
|
||||
|
||||
def on_aka_update_clicked(self,obj):
|
||||
import NameEdit
|
||||
if obj.selection:
|
||||
NameEdit.NameEditor(self,obj.get_row_data(obj.selection[0]))
|
||||
store,iter = self.ntree.get_selected()
|
||||
if iter:
|
||||
NameEdit.NameEditor(self,self.ntree.get_object(iter))
|
||||
|
||||
def load_photo(self,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.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
|
||||
|
@ -113,7 +113,6 @@ class FamilyView:
|
||||
self.add_spouse_btn.connect('clicked',self.add_spouse)
|
||||
self.spouse_list.connect('button-press-event',self.edit_releationship)
|
||||
|
||||
|
||||
self.child_list.set_model(self.child_model)
|
||||
self.child_list.set_search_column(0)
|
||||
self.child_selection = self.child_list.get_selection()
|
||||
@ -269,6 +268,7 @@ class FamilyView:
|
||||
|
||||
self.selected_spouse = None
|
||||
self.spouse_model.clear()
|
||||
self.child_model.clear()
|
||||
splist = self.person.getFamilyList()
|
||||
f = None
|
||||
first_family = None
|
||||
|
@ -81,6 +81,13 @@ class ListModel:
|
||||
def remove(self,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):
|
||||
return self.model.get_value(iter,self.data_index)
|
||||
|
||||
|
@ -40,19 +40,17 @@ import const
|
||||
import GrampsCfg
|
||||
import Utils
|
||||
import AutoComp
|
||||
import ListModel
|
||||
from QuestionDialog import QuestionDialog
|
||||
from RelLib import *
|
||||
import ImageSelect
|
||||
from intl import gettext
|
||||
_ = gettext
|
||||
|
||||
from intl import gettext as _
|
||||
|
||||
_temple_names = const.lds_temple_codes.keys()
|
||||
_temple_names.sort()
|
||||
_temple_names = [""] + _temple_names
|
||||
|
||||
pycode_tgts = [('fevent', 0, 0),
|
||||
('fattr', 0, 1)]
|
||||
pycode_tgts = [('fevent', 0, 0), ('fattr', 0, 1)]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -82,12 +80,12 @@ class Marriage:
|
||||
"destroy_passed_object" : self.on_cancel_edit,
|
||||
"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_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_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_lds_src_clicked" : self.lds_src_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_marriageAddBtn_clicked" : self.on_add_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")
|
||||
@ -137,26 +130,15 @@ class Marriage:
|
||||
# set initial data
|
||||
self.gallery.load_images()
|
||||
|
||||
self.event_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING,
|
||||
gobject.TYPE_STRING)
|
||||
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)
|
||||
etitles = [(_('Event'),0,150),(_('Date'),1,150),(_('Place'),2,150)]
|
||||
atitles = [(_('Attribute'),0,150),(_('Value'),1,150)]
|
||||
|
||||
self.attr_model = gtk.ListStore(gobject.TYPE_STRING,gobject.TYPE_STRING)
|
||||
cnum = 0
|
||||
for name in [_('Attribute'),_('Value')]:
|
||||
renderer = gtk.CellRendererText()
|
||||
column = gtk.TreeViewColumn(name,renderer,text=cnum)
|
||||
cnum = cnum + 1
|
||||
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.etree = ListModel.ListModel(self.event_list, etitles,
|
||||
self.on_select_row,
|
||||
self.on_update_clicked)
|
||||
self.atree = ListModel.ListModel(self.attr_list, atitles,
|
||||
self.on_attr_list_select_row,
|
||||
self.on_update_attr_clicked)
|
||||
|
||||
self.type_field.set_popdown_strings(const.familyRelations)
|
||||
frel = const.display_frel(family.getRelationship())
|
||||
@ -241,18 +223,38 @@ class Marriage:
|
||||
NoteEdit.NoteEditor(ord)
|
||||
|
||||
def on_up_clicked(self,obj):
|
||||
if len(obj.selection) == 0:
|
||||
model,iter = self.etree.get_selected()
|
||||
if not iter:
|
||||
return
|
||||
row = obj.selection[0]
|
||||
|
||||
row = self.etree.get_row(iter)
|
||||
if row != 0:
|
||||
obj.select_row(row-1,0)
|
||||
self.etree.select_row(row-1)
|
||||
|
||||
def on_down_clicked(self,obj):
|
||||
if len(obj.selection) == 0:
|
||||
model,iter = self.etree.get_selected()
|
||||
if not iter:
|
||||
return
|
||||
row = obj.selection[0]
|
||||
if row != obj.rows-1:
|
||||
obj.select_row(row+1,0)
|
||||
|
||||
row = self.etree.get_row(iter)
|
||||
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):
|
||||
if selection_data and selection_data.data:
|
||||
@ -314,10 +316,12 @@ class Marriage:
|
||||
self.family.setAttributeList(self.alist)
|
||||
|
||||
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):
|
||||
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):
|
||||
return self.top.get_widget(name)
|
||||
@ -469,10 +473,10 @@ class Marriage:
|
||||
|
||||
def on_update_clicked(self,obj):
|
||||
import EventEdit
|
||||
if len(obj.selection) <= 0:
|
||||
model,iter = self.etree.get_selected()
|
||||
if not iter:
|
||||
return
|
||||
|
||||
event = obj.get_row_data(obj.selection[0])
|
||||
event = self.etree.get_object(iter)
|
||||
name = Utils.family_name(self.family)
|
||||
EventEdit.EventEditor(self,name,const.marriageEvents,
|
||||
const.save_pevent,event,None,0,self.cb)
|
||||
@ -482,8 +486,12 @@ class Marriage:
|
||||
self.lists_changed = 1
|
||||
self.redraw_event_list()
|
||||
|
||||
def on_select_row(self,obj,row,b,c):
|
||||
event = obj.get_row_data(row)
|
||||
def on_select_row(self,obj):
|
||||
|
||||
model,iter = self.etree.get_selected()
|
||||
if not iter:
|
||||
return
|
||||
event = self.etree.get_object(iter)
|
||||
|
||||
self.date_field.set_text(event.getDate())
|
||||
self.place_field.set_text(event.getPlaceName())
|
||||
@ -498,8 +506,11 @@ class Marriage:
|
||||
self.event_conf_field.set_text('')
|
||||
self.descr_field.set_text(event.getDescription())
|
||||
|
||||
def on_attr_list_select_row(self,obj,row,b,c):
|
||||
attr = obj.get_row_data(row)
|
||||
def on_attr_list_select_row(self,obj):
|
||||
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_value.set_text(attr.getValue())
|
||||
@ -513,19 +524,22 @@ class Marriage:
|
||||
|
||||
def on_update_attr_clicked(self,obj):
|
||||
import AttrEdit
|
||||
if len(obj.selection) > 0:
|
||||
row = obj.selection[0]
|
||||
attr = obj.get_row_data(row)
|
||||
father = self.family.getFather()
|
||||
mother = self.family.getMother()
|
||||
if father and mother:
|
||||
name = _("%s and %s") % (father.getPrimaryName().getName(),
|
||||
model,iter = self.atree.get_selected()
|
||||
if not iter:
|
||||
return
|
||||
|
||||
attr = self.atree.get_object(iter)
|
||||
|
||||
father = self.family.getFather()
|
||||
mother = self.family.getMother()
|
||||
if father and mother:
|
||||
name = _("%s and %s") % (father.getPrimaryName().getName(),
|
||||
mother.getPrimaryName().getName())
|
||||
elif father:
|
||||
name = father.getPrimaryName().getName()
|
||||
else:
|
||||
name = mother.getPrimaryName().getName()
|
||||
AttrEdit.AttributeEditor(self,attr,name,const.familyAttributes)
|
||||
elif father:
|
||||
name = father.getPrimaryName().getName()
|
||||
else:
|
||||
name = mother.getPrimaryName().getName()
|
||||
AttrEdit.AttributeEditor(self,attr,name,const.familyAttributes)
|
||||
|
||||
def on_delete_attr_clicked(self,obj):
|
||||
if Utils.delete_selected(obj,self.alist):
|
||||
|
BIN
gramps2/src/bad.png
Normal file
BIN
gramps2/src/bad.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 300 B |
BIN
gramps2/src/caution.png
Normal file
BIN
gramps2/src/caution.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 342 B |
@ -56,9 +56,9 @@ if os.environ.has_key('GRAMPSDIR'):
|
||||
else:
|
||||
rootDir = "."
|
||||
|
||||
good_xpm = "%s/good.xpm" % rootDir
|
||||
bad_xpm = "%s/bad.xpm" % rootDir
|
||||
caution_xpm = "%s/caution.xpm" % rootDir
|
||||
good_xpm = "%s/good.png" % rootDir
|
||||
bad_xpm = "%s/bad.png" % rootDir
|
||||
caution_xpm = "%s/caution.png" % rootDir
|
||||
|
||||
papersize = "%s/papersize.xml" % rootDir
|
||||
system_filters = "%s/system_filters.xml" % rootDir
|
||||
|
BIN
gramps2/src/good.png
Normal file
BIN
gramps2/src/good.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 301 B |
@ -783,6 +783,20 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</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>
|
||||
<widget class="GtkButton" id="button112">
|
||||
@ -804,6 +818,15 @@
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
@ -826,6 +849,11 @@
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
@ -1205,6 +1233,20 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</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>
|
||||
<widget class="GtkButton" id="button110">
|
||||
@ -1212,7 +1254,7 @@
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</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>
|
||||
<widget class="GtkArrow" id="arrow1">
|
||||
@ -1226,6 +1268,15 @@
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
@ -1234,7 +1285,7 @@
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</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>
|
||||
<widget class="GtkArrow" id="arrow2">
|
||||
@ -1248,6 +1299,11 @@
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
|
Loading…
Reference in New Issue
Block a user