fixed add button in object selector.

svn: r5898
This commit is contained in:
Richard Taylor 2006-02-08 15:29:46 +00:00
parent 80a0ab047d
commit 18f908c9bd
4 changed files with 24 additions and 16 deletions

View File

@ -1,3 +1,8 @@
2006-02-08 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/ObjectSelector/_FilterFrameBase.py,
src/ObjectSelector/_ObjectSelectorWindow.py,
src/ObjectSelector/_PersonFrame.py: fixed add button in object selector.
2006-02-08 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/EditFamily.py, src/Models/_FastFilterModel.py,
src/Models/_FastModel.py, src/ObjectSelector/_FilterFrameBase.py,

View File

@ -66,7 +66,8 @@ class FilterFrameBase(gtk.Frame):
clear_button = gtk.Button(stock=gtk.STOCK_CLEAR)
clear_button.connect('clicked',self.on_clear)
button_box = gtk.HBox()
button_box = gtk.HButtonBox()
button_box.set_layout(gtk.BUTTONBOX_SPREAD)
button_box.pack_start(apply_button,False,False)
button_box.pack_start(clear_button,False,False)

View File

@ -42,7 +42,7 @@ class _ObjectTypeWidgets(object):
def __init__(self):
self.frame = None
self.sel_label = None
self.selected_id = None
self.selected_obj = None
self.new_button = None
def show(self):
@ -55,8 +55,8 @@ class _ObjectTypeWidgets(object):
self.sel_label.hide_all()
self.new_button.hide()
def set_selected_id(self,id):
self.selected_id = id
def set_selected_obj(self,obj):
self.selected_obj = obj
OBJECT_LIST = [ObjectTypes.PERSON, ObjectTypes.FAMILY,
ObjectTypes.SOURCE, ObjectTypes.EVENT,
@ -217,12 +217,12 @@ class ObjectSelectorWindow(gtk.Window,ManagedWindow):
# connect signals
self._object_frames[object_type].frame.connect(
'selection-changed',
lambda widget,text,handle,label: label.set_text(text),
lambda widget,text,selected_object,label: label.set_text(text),
self._object_frames[object_type].sel_label)
self._object_frames[object_type].frame.connect(
'selection-changed',
lambda widget,text,handle,current_object: current_object.set_selected_id(handle),
lambda widget,text,selected_object,current_object: current_object.set_selected_obj(selected_object),
self._object_frames[object_type])
self._object_frames[object_type].frame.connect(
@ -310,13 +310,16 @@ class ObjectSelectorWindow(gtk.Window,ManagedWindow):
self._current_object_type = selected_object_type
# Set the add button sensitivity
if self._object_frames[selected_object_type].selected_id:
if self._object_frames[selected_object_type].selected_obj:
self._add_button.set_sensitive(True)
else:
self._add_button.set_sensitive(False)
def on_add(self,widget=None,object=None):
if object is None:
self.emit('add-object',self._object_frames[self._current_object_type].selected_obj)
else:
self.emit('add-object',object)
def on_selection_changed(self,widget,text,handle):

View File

@ -46,7 +46,7 @@ class PersonFrame(ObjectFrameBase):
'selection-changed' : (gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
(gobject.TYPE_STRING,
gobject.TYPE_STRING)),
gobject.TYPE_PYOBJECT)),
'add-object': (gobject.SIGNAL_RUN_LAST,
gobject.TYPE_NONE,
@ -74,16 +74,15 @@ class PersonFrame(ObjectFrameBase):
(person,rowref) = model.get_value(iter,0)
if len(rowref) > 1 or model.is_list():
if person:
self.emit('selection-changed', "%s [%s]" % (
display_name(person),
self.emit('selection-changed', "%s [%s]" % (display_name(person),
person.get_gramps_id()),
person.get_handle())
person)
else:
self.emit('selection-changed',"No Selection","")
self.emit('selection-changed',"No Selection",None)
else:
self.emit('selection-changed',"No Selection","")
self.emit('selection-changed',"No Selection",None)
else:
self.emit('selection-changed',"No Selection","")
self.emit('selection-changed',"No Selection",None)
self._tree_frame.get_selection().connect('changed',handle_selection)