* src/ListModel.py: Be able to select based off an iter
* src/ImageSelect.py: Support keeping selecting attributes after they are edited * src/EventEdit.py: Support keeping selecting events after they are edited * src/AttrEdit.py: Support keeping selecting attributes after they are edited * src/Marriage.py: Support keeping track of events and attributes after they are edited. * src/EditPerson.py: Support keeping track of events and attributes after they are edited. svn: r1690
This commit is contained in:
parent
cd51e2c531
commit
59a6f4d79b
@ -54,7 +54,7 @@ class AttributeEditor:
|
|||||||
"""
|
"""
|
||||||
Displays a dialog that allows the user to edit an attribute.
|
Displays a dialog that allows the user to edit an attribute.
|
||||||
"""
|
"""
|
||||||
def __init__(self,parent,attrib,title,list):
|
def __init__(self,parent,attrib,title,list,callback):
|
||||||
"""
|
"""
|
||||||
Displays the dialog box.
|
Displays the dialog box.
|
||||||
|
|
||||||
@ -74,6 +74,7 @@ class AttributeEditor:
|
|||||||
self.attrib_menu = self.top.get_widget("attr_menu")
|
self.attrib_menu = self.top.get_widget("attr_menu")
|
||||||
self.source_field = self.top.get_widget("attr_source")
|
self.source_field = self.top.get_widget("attr_source")
|
||||||
self.priv = self.top.get_widget("priv")
|
self.priv = self.top.get_widget("priv")
|
||||||
|
self.callback = callback
|
||||||
|
|
||||||
self.window = self.top.get_widget("attr_edit")
|
self.window = self.top.get_widget("attr_edit")
|
||||||
|
|
||||||
@ -135,7 +136,7 @@ class AttributeEditor:
|
|||||||
|
|
||||||
self.attrib.setSourceRefList(self.srcreflist)
|
self.attrib.setSourceRefList(self.srcreflist)
|
||||||
self.update(type,value,note,priv)
|
self.update(type,value,note,priv)
|
||||||
self.parent.redraw_attr_list()
|
self.callback(self.attrib)
|
||||||
Utils.destroy_passed_object(obj)
|
Utils.destroy_passed_object(obj)
|
||||||
|
|
||||||
def check(self,get,set,data):
|
def check(self,get,set,data):
|
||||||
|
@ -657,11 +657,25 @@ class EditPerson:
|
|||||||
def redraw_attr_list(self):
|
def redraw_attr_list(self):
|
||||||
"""redraws the attribute list for the person"""
|
"""redraws the attribute list for the person"""
|
||||||
self.atree.clear()
|
self.atree.clear()
|
||||||
|
self.amap = {}
|
||||||
for attr in self.alist:
|
for attr in self.alist:
|
||||||
self.atree.add([const.display_pattr(attr.getType()),attr.getValue()],attr)
|
iter = self.atree.add([const.display_pattr(attr.getType()),attr.getValue()],attr)
|
||||||
|
self.amap[str(attr)] = iter
|
||||||
if self.alist:
|
if self.alist:
|
||||||
self.atree.select_row(0)
|
self.atree.select_row(0)
|
||||||
|
|
||||||
|
def event_edit_callback(self,event):
|
||||||
|
"""Birth and death events may not be in the map"""
|
||||||
|
self.redraw_event_list()
|
||||||
|
try:
|
||||||
|
self.etree.select_iter(self.emap[str(event)])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def attr_edit_callback(self,attr):
|
||||||
|
self.redraw_attr_list()
|
||||||
|
self.atree.select_iter(self.amap[str(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
|
||||||
boxes for any changes that occurred in the 'Event Edit' window.
|
boxes for any changes that occurred in the 'Event Edit' window.
|
||||||
@ -671,9 +685,11 @@ class EditPerson:
|
|||||||
and restore the value for the event *not* being edited."""
|
and restore the value for the event *not* being edited."""
|
||||||
|
|
||||||
self.etree.clear()
|
self.etree.clear()
|
||||||
|
self.emap = {}
|
||||||
for event in self.elist:
|
for event in self.elist:
|
||||||
self.etree.add([const.display_pevent(event.getName()),event.getDescription(),
|
iter = self.etree.add([const.display_pevent(event.getName()),event.getDescription(),
|
||||||
event.getQuoteDate(),event.getPlaceName()],event)
|
event.getQuoteDate(),event.getPlaceName()],event)
|
||||||
|
self.emap[str(event)] = iter
|
||||||
if self.elist:
|
if self.elist:
|
||||||
self.etree.select_row(0)
|
self.etree.select_row(0)
|
||||||
|
|
||||||
@ -722,7 +738,8 @@ class EditPerson:
|
|||||||
"""Brings up the AttributeEditor for a new attribute"""
|
"""Brings up the AttributeEditor for a new attribute"""
|
||||||
import AttrEdit
|
import AttrEdit
|
||||||
pname = self.person.getPrimaryName().getName()
|
pname = self.person.getPrimaryName().getName()
|
||||||
AttrEdit.AttributeEditor(self,None,pname,const.personalAttributes)
|
AttrEdit.AttributeEditor(self,None,pname,const.personalAttributes,
|
||||||
|
self.attr_edit_callback)
|
||||||
|
|
||||||
def on_up_clicked(self,obj):
|
def on_up_clicked(self,obj):
|
||||||
sel = obj.get_selection()
|
sel = obj.get_selection()
|
||||||
@ -743,7 +760,7 @@ class EditPerson:
|
|||||||
import EventEdit
|
import EventEdit
|
||||||
pname = self.person.getPrimaryName().getName()
|
pname = self.person.getPrimaryName().getName()
|
||||||
EventEdit.EventEditor(self,pname,const.personalEvents,
|
EventEdit.EventEditor(self,pname,const.personalEvents,
|
||||||
const.save_fevent,None,None,0,self.callback)
|
const.save_fevent,None,None,0,self.event_edit_callback)
|
||||||
|
|
||||||
def on_edit_birth_clicked(self,obj):
|
def on_edit_birth_clicked(self,obj):
|
||||||
"""Brings up the EventEditor for the birth record, event
|
"""Brings up the EventEditor for the birth record, event
|
||||||
@ -763,7 +780,7 @@ class EditPerson:
|
|||||||
event.setPlace(p)
|
event.setPlace(p)
|
||||||
EventEdit.EventEditor(self,pname,const.personalEvents,
|
EventEdit.EventEditor(self,pname,const.personalEvents,
|
||||||
const.save_fevent,event,def_placename,1,
|
const.save_fevent,event,def_placename,1,
|
||||||
self.callback)
|
self.event_edit_callback)
|
||||||
|
|
||||||
def on_edit_death_clicked(self,obj):
|
def on_edit_death_clicked(self,obj):
|
||||||
"""Brings up the EventEditor for the death record, event
|
"""Brings up the EventEditor for the death record, event
|
||||||
@ -783,7 +800,7 @@ class EditPerson:
|
|||||||
event.setPlace(p)
|
event.setPlace(p)
|
||||||
EventEdit.EventEditor(self,pname,const.personalEvents,
|
EventEdit.EventEditor(self,pname,const.personalEvents,
|
||||||
const.save_fevent,event,def_placename,1,
|
const.save_fevent,event,def_placename,1,
|
||||||
self.callback)
|
self.event_edit_callback)
|
||||||
|
|
||||||
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"""
|
||||||
@ -999,7 +1016,8 @@ class EditPerson:
|
|||||||
if iter:
|
if iter:
|
||||||
attr = self.atree.get_object(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,
|
||||||
|
self.attr_edit_callback)
|
||||||
|
|
||||||
def on_update_addr_clicked(self,obj):
|
def on_update_addr_clicked(self,obj):
|
||||||
import AddrEdit
|
import AddrEdit
|
||||||
@ -1025,7 +1043,7 @@ class EditPerson:
|
|||||||
event = self.etree.get_object(iter)
|
event = self.etree.get_object(iter)
|
||||||
EventEdit.EventEditor(self,pname,const.personalEvents,
|
EventEdit.EventEditor(self,pname,const.personalEvents,
|
||||||
const.save_fevent,event,None,0,
|
const.save_fevent,event,None,0,
|
||||||
self.callback)
|
self.event_edit_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()
|
||||||
|
@ -224,7 +224,7 @@ class EventEditor:
|
|||||||
|
|
||||||
self.update_event(ename,self.date,eplace_obj,edesc,enote,epriv,ecause)
|
self.update_event(ename,self.date,eplace_obj,edesc,enote,epriv,ecause)
|
||||||
self.parent.redraw_event_list()
|
self.parent.redraw_event_list()
|
||||||
self.callback(None,self.plist)
|
self.callback(self.event)
|
||||||
Utils.destroy_passed_object(obj)
|
Utils.destroy_passed_object(obj)
|
||||||
|
|
||||||
def update_event(self,name,date,place,desc,note,priv,cause):
|
def update_event(self,name,date,place,desc,note,priv,cause):
|
||||||
|
@ -661,9 +661,11 @@ class LocalMediaProperties:
|
|||||||
|
|
||||||
def redraw_attr_list(self):
|
def redraw_attr_list(self):
|
||||||
self.atree.clear()
|
self.atree.clear()
|
||||||
|
self.amap = {}
|
||||||
for attr in self.alist:
|
for attr in self.alist:
|
||||||
d = [attr.getType(),attr.getValue()]
|
d = [attr.getType(),attr.getValue()]
|
||||||
self.atree.add(d,attr)
|
iter = self.atree.add(d,attr)
|
||||||
|
self.amap[str(attr)] = iter
|
||||||
|
|
||||||
def on_apply_clicked(self, obj):
|
def on_apply_clicked(self, obj):
|
||||||
priv = self.change_dialog.get_widget("private").get_active()
|
priv = self.change_dialog.get_widget("private").get_active()
|
||||||
@ -695,7 +697,11 @@ class LocalMediaProperties:
|
|||||||
else:
|
else:
|
||||||
self.attr_type.set_label('')
|
self.attr_type.set_label('')
|
||||||
self.attr_value.set_text('')
|
self.attr_value.set_text('')
|
||||||
|
|
||||||
|
def attr_callback(self,attr):
|
||||||
|
self.redraw_attr_list()
|
||||||
|
self.atree.select_iter(self.amap[str(attr)])
|
||||||
|
|
||||||
def on_update_attr_clicked(self,obj):
|
def on_update_attr_clicked(self,obj):
|
||||||
import AttrEdit
|
import AttrEdit
|
||||||
|
|
||||||
@ -703,7 +709,8 @@ class LocalMediaProperties:
|
|||||||
if iter:
|
if iter:
|
||||||
attr = self.atree.get_object(iter)
|
attr = self.atree.get_object(iter)
|
||||||
AttrEdit.AttributeEditor(self,attr,"Media Object",
|
AttrEdit.AttributeEditor(self,attr,"Media Object",
|
||||||
Plugins.get_image_attributes())
|
Plugins.get_image_attributes(),
|
||||||
|
self.attr_callback)
|
||||||
|
|
||||||
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):
|
||||||
@ -713,7 +720,8 @@ class LocalMediaProperties:
|
|||||||
def on_add_attr_clicked(self,obj):
|
def on_add_attr_clicked(self,obj):
|
||||||
import AttrEdit
|
import AttrEdit
|
||||||
AttrEdit.AttributeEditor(self,None,"Media Object",
|
AttrEdit.AttributeEditor(self,None,"Media Object",
|
||||||
Plugins.get_image_attributes())
|
Plugins.get_image_attributes(),
|
||||||
|
self.attr_callback)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -814,9 +822,11 @@ class GlobalMediaProperties:
|
|||||||
|
|
||||||
def redraw_attr_list(self):
|
def redraw_attr_list(self):
|
||||||
self.atree.clear()
|
self.atree.clear()
|
||||||
|
self.amap = {}
|
||||||
for attr in self.alist:
|
for attr in self.alist:
|
||||||
d = [attr.getType(),attr.getValue()]
|
d = [attr.getType(),attr.getValue()]
|
||||||
self.atree.add(d,attr)
|
iter = self.atree.add(d,attr)
|
||||||
|
self.amap[str(attr)] = iter
|
||||||
|
|
||||||
def button_press(self,obj):
|
def button_press(self,obj):
|
||||||
store,iter = self.refmodel.selection.get_selected()
|
store,iter = self.refmodel.selection.get_selected()
|
||||||
@ -885,6 +895,10 @@ class GlobalMediaProperties:
|
|||||||
self.attr_type.set_label('')
|
self.attr_type.set_label('')
|
||||||
self.attr_value.set_text('')
|
self.attr_value.set_text('')
|
||||||
|
|
||||||
|
def attr_callback(self,attr):
|
||||||
|
self.redraw_attr_list()
|
||||||
|
self.atree.select_iter(self.amap[str(attr)])
|
||||||
|
|
||||||
def on_update_attr_clicked(self,obj):
|
def on_update_attr_clicked(self,obj):
|
||||||
import AttrEdit
|
import AttrEdit
|
||||||
|
|
||||||
@ -892,7 +906,8 @@ class GlobalMediaProperties:
|
|||||||
if iter:
|
if iter:
|
||||||
attr = self.atree.get_object(iter)
|
attr = self.atree.get_object(iter)
|
||||||
AttrEdit.AttributeEditor(self,attr,"Media Object",
|
AttrEdit.AttributeEditor(self,attr,"Media Object",
|
||||||
Plugins.get_image_attributes())
|
Plugins.get_image_attributes(),
|
||||||
|
self.attr_callback)
|
||||||
|
|
||||||
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):
|
||||||
@ -902,7 +917,8 @@ class GlobalMediaProperties:
|
|||||||
def on_add_attr_clicked(self,obj):
|
def on_add_attr_clicked(self,obj):
|
||||||
import AttrEdit
|
import AttrEdit
|
||||||
AttrEdit.AttributeEditor(self,None,"Media Object",
|
AttrEdit.AttributeEditor(self,None,"Media Object",
|
||||||
Plugins.get_image_attributes())
|
Plugins.get_image_attributes(),
|
||||||
|
self.attr_callback)
|
||||||
|
|
||||||
class DeleteMediaQuery:
|
class DeleteMediaQuery:
|
||||||
|
|
||||||
|
@ -34,6 +34,7 @@ class ListModel:
|
|||||||
|
|
||||||
self.tree.set_rules_hint(gtk.TRUE)
|
self.tree.set_rules_hint(gtk.TRUE)
|
||||||
self.model = None
|
self.model = None
|
||||||
|
self.selection = None
|
||||||
self.mode = mode
|
self.mode = mode
|
||||||
self.new_model()
|
self.new_model()
|
||||||
self.data_index = l
|
self.data_index = l
|
||||||
@ -80,7 +81,10 @@ class ListModel:
|
|||||||
def new_model(self):
|
def new_model(self):
|
||||||
if self.model:
|
if self.model:
|
||||||
self.cid = self.model.get_sort_column_id()
|
self.cid = self.model.get_sort_column_id()
|
||||||
|
del self.model
|
||||||
|
del self.selection
|
||||||
self.count = 0
|
self.count = 0
|
||||||
|
|
||||||
self.model = gtk.ListStore(*self.mylist)
|
self.model = gtk.ListStore(*self.mylist)
|
||||||
self.selection = self.tree.get_selection()
|
self.selection = self.tree.get_selection()
|
||||||
self.selection.set_mode(self.mode)
|
self.selection.set_mode(self.mode)
|
||||||
@ -164,6 +168,9 @@ class ListModel:
|
|||||||
|
|
||||||
def select_row(self,row):
|
def select_row(self,row):
|
||||||
self.selection.select_path((row))
|
self.selection.select_path((row))
|
||||||
|
|
||||||
|
def select_iter(self,iter):
|
||||||
|
self.selection.select_iter(iter)
|
||||||
|
|
||||||
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)
|
||||||
|
@ -339,18 +339,26 @@ class Marriage:
|
|||||||
self.family.setEventList(self.elist)
|
self.family.setEventList(self.elist)
|
||||||
self.family.setAttributeList(self.alist)
|
self.family.setAttributeList(self.alist)
|
||||||
|
|
||||||
|
def attr_edit_callback(self,attr):
|
||||||
|
self.redraw_attr_list()
|
||||||
|
self.atree.select_iter(self.amap[str(attr)])
|
||||||
|
|
||||||
def redraw_attr_list(self):
|
def redraw_attr_list(self):
|
||||||
self.atree.clear()
|
self.atree.clear()
|
||||||
|
self.amap = {}
|
||||||
for attr in self.alist:
|
for attr in self.alist:
|
||||||
d = [const.display_fattr(attr.getType()),attr.getValue()]
|
d = [const.display_fattr(attr.getType()),attr.getValue()]
|
||||||
self.atree.add(d,attr)
|
iter = self.atree.add(d,attr)
|
||||||
|
self.amap[str(attr)] = iter
|
||||||
if self.alist:
|
if self.alist:
|
||||||
self.atree.select_row(0)
|
self.atree.select_row(0)
|
||||||
|
|
||||||
def redraw_event_list(self):
|
def redraw_event_list(self):
|
||||||
self.etree.clear()
|
self.etree.clear()
|
||||||
|
self.emap = {}
|
||||||
for data in self.elist:
|
for data in self.elist:
|
||||||
self.etree.add([data.getName(),data.getQuoteDate(),data.getPlaceName()],data)
|
iter = self.etree.add([data.getName(),data.getQuoteDate(),data.getPlaceName()],data)
|
||||||
|
self.emap[str(data)] = iter
|
||||||
if self.elist:
|
if self.elist:
|
||||||
self.etree.select_row(0)
|
self.etree.select_row(0)
|
||||||
|
|
||||||
@ -502,11 +510,19 @@ class Marriage:
|
|||||||
Utils.modified()
|
Utils.modified()
|
||||||
self.update_fv(self.family)
|
self.update_fv(self.family)
|
||||||
|
|
||||||
|
def event_edit_callback(self,event):
|
||||||
|
"""Birth and death events may not be in the map"""
|
||||||
|
self.redraw_event_list()
|
||||||
|
try:
|
||||||
|
self.etree.select_iter(self.emap[str(event)])
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
def on_add_clicked(self,obj):
|
def on_add_clicked(self,obj):
|
||||||
import EventEdit
|
import EventEdit
|
||||||
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,None,None,0,self.cb,
|
const.save_pevent,None,None,0,self.event_edit_callback,
|
||||||
const.defaultMarriageEvent)
|
const.defaultMarriageEvent)
|
||||||
|
|
||||||
def on_event_update_clicked(self,obj):
|
def on_event_update_clicked(self,obj):
|
||||||
@ -517,7 +533,7 @@ class Marriage:
|
|||||||
event = self.etree.get_object(iter)
|
event = self.etree.get_object(iter)
|
||||||
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.event_edit_callback)
|
||||||
|
|
||||||
def on_delete_clicked(self,obj):
|
def on_delete_clicked(self,obj):
|
||||||
if Utils.delete_selected(obj,self.elist):
|
if Utils.delete_selected(obj,self.elist):
|
||||||
@ -577,7 +593,8 @@ class Marriage:
|
|||||||
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,
|
||||||
|
self.attr_edit_callback)
|
||||||
|
|
||||||
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):
|
||||||
@ -595,7 +612,8 @@ class Marriage:
|
|||||||
name = father.getPrimaryName().getName()
|
name = father.getPrimaryName().getName()
|
||||||
else:
|
else:
|
||||||
name = mother.getPrimaryName().getName()
|
name = mother.getPrimaryName().getName()
|
||||||
AttrEdit.AttributeEditor(self,None,name,const.familyAttributes)
|
AttrEdit.AttributeEditor(self,None,name,const.familyAttributes,
|
||||||
|
self.attr_edit_callback)
|
||||||
|
|
||||||
def move_element(self,list,src,dest):
|
def move_element(self,list,src,dest):
|
||||||
if src == -1:
|
if src == -1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user