2006-04-18 Don Allingham <don@gramps-project.org>
* src/Editors/_EditFamily.py: button messages * src/DisplayTabs.py: remove property button stuff svn: r6357
This commit is contained in:
parent
300debc524
commit
249b1ba53d
@ -1,3 +1,7 @@
|
||||
2006-04-18 Don Allingham <don@gramps-project.org>
|
||||
* src/Editors/_EditFamily.py: button messages
|
||||
* src/DisplayTabs.py: remove property button stuff
|
||||
|
||||
2006-04-18 Alex Roitman <shura@gramps-project.org>
|
||||
* src/DisplayTabs.py (BackRefList.create_buttons): Allow an
|
||||
additional argument to keep the caller happy.
|
||||
|
@ -121,7 +121,6 @@ class GrampsTab(gtk.HBox):
|
||||
|
||||
# build the interface
|
||||
self.share_btn = None
|
||||
self.prop_btn = None
|
||||
self.build_interface()
|
||||
|
||||
def get_selected(self):
|
||||
@ -208,11 +207,9 @@ class ButtonTab(GrampsTab):
|
||||
'del' : _('Remove'),
|
||||
'edit' : _('Edit'),
|
||||
'share' : _('Share'),
|
||||
'prop' : _('Properties'),
|
||||
}
|
||||
|
||||
def __init__(self, dbstate, uistate, track, name, share_button=False,
|
||||
prop_button=False):
|
||||
def __init__(self, dbstate, uistate, track, name, share_button=False):
|
||||
"""
|
||||
Similar to the base class, except after Build
|
||||
@param dbstate: The database state. Contains a reference to
|
||||
@ -231,9 +228,9 @@ class ButtonTab(GrampsTab):
|
||||
"""
|
||||
GrampsTab.__init__(self,dbstate, uistate, track, name)
|
||||
self.tooltips = gtk.Tooltips()
|
||||
self.create_buttons(share_button, prop_button)
|
||||
self.create_buttons(share_button)
|
||||
|
||||
def create_buttons(self, share_button=False, prop_button=False):
|
||||
def create_buttons(self, share_button=False):
|
||||
"""
|
||||
Creates a button box consisting of three buttons, one for Add,
|
||||
one for Edit, and one for Delete. This button box is then appended
|
||||
@ -253,13 +250,6 @@ class ButtonTab(GrampsTab):
|
||||
else:
|
||||
self.share_btn = None
|
||||
|
||||
if prop_button:
|
||||
self.prop_btn = SimpleButton(gtk.STOCK_PROPERTIES,
|
||||
self.prop_button_clicked)
|
||||
self.tooltips.set_tip(self.prop_btn, self._MSG['prop'])
|
||||
else:
|
||||
self.prop_btn = None
|
||||
|
||||
vbox = gtk.VBox()
|
||||
vbox.set_spacing(6)
|
||||
vbox.pack_start(self.add_btn, False)
|
||||
@ -267,8 +257,6 @@ class ButtonTab(GrampsTab):
|
||||
vbox.pack_start(self.share_btn, False)
|
||||
vbox.pack_start(self.edit_btn, False)
|
||||
vbox.pack_start(self.del_btn, False)
|
||||
if prop_button:
|
||||
vbox.pack_start(self.prop_btn, False)
|
||||
vbox.show_all()
|
||||
self.pack_start(vbox, False)
|
||||
|
||||
@ -294,13 +282,6 @@ class ButtonTab(GrampsTab):
|
||||
"""
|
||||
print "Uncaught Share clicked"
|
||||
|
||||
def prop_button_clicked(self, obj):
|
||||
"""
|
||||
Function called with the Add button is clicked. This function
|
||||
should be overridden by the derived class.
|
||||
"""
|
||||
print "Uncaught Properties clicked"
|
||||
|
||||
def del_button_clicked(self, obj):
|
||||
"""
|
||||
Function called with the Delete button is clicked. This function
|
||||
@ -325,13 +306,9 @@ class ButtonTab(GrampsTab):
|
||||
if self.get_selected():
|
||||
self.edit_btn.set_sensitive(True)
|
||||
self.del_btn.set_sensitive(True)
|
||||
if self.prop_btn:
|
||||
self.prop_btn.set_sensitive(True)
|
||||
else:
|
||||
self.edit_btn.set_sensitive(False)
|
||||
self.del_btn.set_sensitive(False)
|
||||
if self.prop_btn:
|
||||
self.prop_btn.set_sensitive(False)
|
||||
|
||||
class EmbeddedList(ButtonTab):
|
||||
"""
|
||||
@ -345,13 +322,13 @@ class EmbeddedList(ButtonTab):
|
||||
_DND_EXTRA = None
|
||||
|
||||
def __init__(self, dbstate, uistate, track, name, build_model,
|
||||
share=False, properties=False):
|
||||
share=False):
|
||||
"""
|
||||
Creates a new list, using the passed build_model to
|
||||
populate the list.
|
||||
"""
|
||||
ButtonTab.__init__(self, dbstate, uistate, track, name, share,
|
||||
properties)
|
||||
ButtonTab.__init__(self, dbstate, uistate, track, name, share)
|
||||
|
||||
|
||||
self.changed = False
|
||||
self.build_model = build_model
|
||||
@ -396,10 +373,6 @@ class EmbeddedList(ButtonTab):
|
||||
(True, gtk.STOCK_REMOVE, self.del_button_clicked),
|
||||
]
|
||||
|
||||
if self.prop_btn:
|
||||
itemlist.append((True, gtk.STOCK_PROPERTIES,
|
||||
self.prop_button_clicked))
|
||||
|
||||
menu = gtk.Menu()
|
||||
for (image, title, func) in itemlist:
|
||||
if image:
|
||||
@ -829,7 +802,7 @@ class BackRefList(EmbeddedList):
|
||||
def is_empty(self):
|
||||
return self.model.empty
|
||||
|
||||
def create_buttons(self, share=False, prop_button=False):
|
||||
def create_buttons(self, share=False):
|
||||
self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked)
|
||||
|
||||
vbox = gtk.VBox()
|
||||
@ -1722,6 +1695,13 @@ class SourceEmbedList(EmbeddedList):
|
||||
_DND_TYPE = DdTargets.SOURCEREF
|
||||
_DND_EXTRA = DdTargets.SOURCE_LINK
|
||||
|
||||
_MSG = {
|
||||
'add' : _('Create and add a new source'),
|
||||
'del' : _('Remove the existing source'),
|
||||
'edit' : _('Edit the selected source'),
|
||||
'share' : _('Add an existing source'),
|
||||
}
|
||||
|
||||
_column_names = [
|
||||
(_('ID'), 0, 75),
|
||||
(_('Title'), 1, 200),
|
||||
|
@ -90,6 +90,13 @@ class ChildEmbedList(EmbeddedList):
|
||||
_HANDLE_COL = 10
|
||||
_DND_TYPE = DdTargets.PERSON_LINK
|
||||
|
||||
_MSG = {
|
||||
'add' : _('Create a new person and add the child to the family'),
|
||||
'del' : _('Remove the child from the family'),
|
||||
'edit' : _('Edit the child/family relationship'),
|
||||
'share' : _('Add an existing person as a child of the family'),
|
||||
}
|
||||
|
||||
_column_names = [
|
||||
(_('#'),0) ,
|
||||
(_('ID'),1) ,
|
||||
@ -109,7 +116,7 @@ class ChildEmbedList(EmbeddedList):
|
||||
"""
|
||||
self.family = family
|
||||
EmbeddedList.__init__(self, dbstate, uistate, track,
|
||||
_('Children'), ChildModel, True, True)
|
||||
_('Children'), ChildModel, True)
|
||||
|
||||
def find_index(self,obj):
|
||||
"""
|
||||
@ -205,17 +212,6 @@ class ChildEmbedList(EmbeddedList):
|
||||
self.family.add_child_ref(ref)
|
||||
self.rebuild()
|
||||
|
||||
def prop_button_clicked(self,obj):
|
||||
handle = self.get_selected()
|
||||
if handle:
|
||||
from Editors import EditChildRef
|
||||
|
||||
for ref in self.family.get_child_ref_list():
|
||||
if ref.ref == handle:
|
||||
EditChildRef(self.dbstate, self.uistate, self.track,
|
||||
ref, self.child_ref_edited)
|
||||
break
|
||||
|
||||
def child_ref_edited(self, person):
|
||||
self.rebuild()
|
||||
|
||||
@ -237,43 +233,6 @@ class ChildEmbedList(EmbeddedList):
|
||||
self.family.add_child_ref(ref)
|
||||
self.rebuild()
|
||||
|
||||
# def add_button_clicked(self,obj):
|
||||
# # we could workout the death years of the parents here and
|
||||
# # set a suitable filter_spec on the PersonSelector
|
||||
# # we might also be able to set a filter that only includes
|
||||
# # people that are not already listed as children in another
|
||||
# # family.
|
||||
# selector = PersonSelector(self.dbstate,self.uistate,self.track)
|
||||
|
||||
# # this need the window handle of the main EditFamily window
|
||||
# # to make the PersonSelector transient to it. I am not sure
|
||||
# # want the best way is to get that handle from here.
|
||||
# #selector.set_transient_for(self.window)
|
||||
|
||||
# # Connect this to the method used to add a new child.
|
||||
# #selector.connect('add-object',self.on_add_child)
|
||||
|
||||
# selector.connect('add-object',self.on_change_child)
|
||||
|
||||
# def on_change_child(self, selector_window, obj):
|
||||
# if obj.__class__ == RelLib.Person:
|
||||
# try:
|
||||
# person = obj
|
||||
# self.family.add_child_handle(person.get_handle())
|
||||
# self.rebuild()
|
||||
# except:
|
||||
# log.warn(
|
||||
# "Failed to update child: \n"
|
||||
# "obj returned from selector was: %s\n"
|
||||
# % (repr(obj),))
|
||||
# raise
|
||||
# else:
|
||||
# log.warn(
|
||||
# "Object selector returned obj.__class__ = %s, it should "
|
||||
# "have been of type %s." % (obj.__class__.__name__,
|
||||
# RelLib.Person.__name__))
|
||||
# selector_window.close()
|
||||
|
||||
def run(self,skip):
|
||||
SelectPerson(self.dbstate.db, "Select Child",
|
||||
skip=[ x for x in skip if x])
|
||||
@ -287,12 +246,13 @@ class ChildEmbedList(EmbeddedList):
|
||||
def edit_button_clicked(self,obj):
|
||||
handle = self.get_selected()
|
||||
if handle:
|
||||
from _EditPerson import EditPerson
|
||||
try:
|
||||
person = self.dbstate.db.get_person_from_handle(handle)
|
||||
EditPerson(self.dbstate,self.uistate,self.track,person)
|
||||
except Errors.WindowActiveError:
|
||||
pass
|
||||
from Editors import EditChildRef
|
||||
|
||||
for ref in self.family.get_child_ref_list():
|
||||
if ref.ref == handle:
|
||||
EditChildRef(self.dbstate, self.uistate, self.track,
|
||||
ref, self.child_ref_edited)
|
||||
break
|
||||
|
||||
def north_american(self):
|
||||
father_handle = self.family.get_father_handle()
|
||||
|
Loading…
Reference in New Issue
Block a user