* src/DisplayTabs.py: fix double click
* src/EditFamily.py: fix double click * src/GrampsWidgets.py: add SimpleButton * src/ToolTips.py: Family tool tip svn: r5754
This commit is contained in:
parent
4e6804cb9e
commit
fdaccccc59
@ -1,3 +1,9 @@
|
|||||||
|
2006-01-14 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/DisplayTabs.py: fix double click
|
||||||
|
* src/EditFamily.py: fix double click
|
||||||
|
* src/GrampsWidgets.py: add SimpleButton
|
||||||
|
* src/ToolTips.py: Family tool tip
|
||||||
|
|
||||||
2006-01-14 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
2006-01-14 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
|
||||||
* src/ObjectSelector/_Constants.py: enums
|
* src/ObjectSelector/_Constants.py: enums
|
||||||
* src/ObjectSelector/_Factories.py: multi object type factories
|
* src/ObjectSelector/_Factories.py: multi object type factories
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
|
import gobject
|
||||||
|
|
||||||
import DateHandler
|
import DateHandler
|
||||||
import NameDisplay
|
import NameDisplay
|
||||||
import RelLib
|
import RelLib
|
||||||
@ -26,6 +28,8 @@ import Utils
|
|||||||
import ToolTips
|
import ToolTips
|
||||||
import GrampsLocale
|
import GrampsLocale
|
||||||
|
|
||||||
|
from GrampsWidgets import SimpleButton
|
||||||
|
|
||||||
_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
|
_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -77,18 +81,10 @@ class EmbeddedList(gtk.HBox):
|
|||||||
self.del_btn.set_sensitive(False)
|
self.del_btn.set_sensitive(False)
|
||||||
|
|
||||||
def create_buttons(self):
|
def create_buttons(self):
|
||||||
self.add_btn = gtk.Button()
|
self.add_btn = SimpleButton(gtk.STOCK_ADD, self.add_button_clicked)
|
||||||
self.add_btn.set_relief(gtk.RELIEF_NONE)
|
self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked)
|
||||||
self.add_btn.add(gtk.image_new_from_stock(gtk.STOCK_ADD,
|
self.del_btn = SimpleButton(gtk.STOCK_REMOVE, self.del_button_clicked)
|
||||||
gtk.ICON_SIZE_BUTTON))
|
|
||||||
self.edit_btn = gtk.Button()
|
|
||||||
self.edit_btn.set_relief(gtk.RELIEF_NONE)
|
|
||||||
self.edit_btn.add(gtk.image_new_from_stock(gtk.STOCK_EDIT,
|
|
||||||
gtk.ICON_SIZE_BUTTON))
|
|
||||||
self.del_btn = gtk.Button()
|
|
||||||
self.del_btn.set_relief(gtk.RELIEF_NONE)
|
|
||||||
self.del_btn.add(gtk.image_new_from_stock(gtk.STOCK_REMOVE,
|
|
||||||
gtk.ICON_SIZE_BUTTON))
|
|
||||||
vbox = gtk.VBox()
|
vbox = gtk.VBox()
|
||||||
vbox.set_spacing(6)
|
vbox.set_spacing(6)
|
||||||
vbox.pack_start(self.add_btn,False)
|
vbox.pack_start(self.add_btn,False)
|
||||||
@ -97,9 +93,11 @@ class EmbeddedList(gtk.HBox):
|
|||||||
vbox.show_all()
|
vbox.show_all()
|
||||||
self.pack_start(vbox,False)
|
self.pack_start(vbox,False)
|
||||||
|
|
||||||
self.add_btn.connect('clicked',self.add_button_clicked)
|
self.tree.connect('button_press_event',self.double_click)
|
||||||
self.del_btn.connect('clicked',self.del_button_clicked)
|
|
||||||
self.edit_btn.connect('clicked',self.edit_button_clicked)
|
def double_click(self, obj, event):
|
||||||
|
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
|
||||||
|
self.edit_button_clicked(obj)
|
||||||
|
|
||||||
def add_button_clicked(self,obj):
|
def add_button_clicked(self,obj):
|
||||||
pass
|
pass
|
||||||
@ -152,10 +150,12 @@ class EmbeddedList(gtk.HBox):
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class EventEmbedList(EmbeddedList):
|
class EventEmbedList(EmbeddedList):
|
||||||
|
|
||||||
|
_HANDLE_COL = 6
|
||||||
|
|
||||||
column_names = [
|
column_names = [
|
||||||
(_('Description'),0),
|
(_('Type'),0),
|
||||||
(_('ID'),1),
|
(_('Description'),1),
|
||||||
(_('Type'),2),
|
(_('ID'),2),
|
||||||
(_('Date'),3),
|
(_('Date'),3),
|
||||||
(_('Place'),4),
|
(_('Place'),4),
|
||||||
(_('Cause'),5),
|
(_('Cause'),5),
|
||||||
@ -185,6 +185,22 @@ class EventEmbedList(EmbeddedList):
|
|||||||
def get_tab_widget(self):
|
def get_tab_widget(self):
|
||||||
return self.label
|
return self.label
|
||||||
|
|
||||||
|
def add_button_clicked(self,obj):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def del_button_clicked(self,obj):
|
||||||
|
ref = self.get_selected()
|
||||||
|
if ref:
|
||||||
|
ref_list = self.obj.get_event_ref_list()
|
||||||
|
ref_list.remove(ref)
|
||||||
|
self.rebuild()
|
||||||
|
|
||||||
|
def edit_button_clicked(self,obj):
|
||||||
|
ref = self.get_selected()
|
||||||
|
if ref:
|
||||||
|
print ref
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# NoteTab
|
# NoteTab
|
||||||
@ -363,17 +379,19 @@ class ChildModel(gtk.ListStore):
|
|||||||
class EventRefModel(gtk.ListStore):
|
class EventRefModel(gtk.ListStore):
|
||||||
|
|
||||||
def __init__(self,event_list,db):
|
def __init__(self,event_list,db):
|
||||||
gtk.ListStore.__init__(self,str,str,str,str,str,str)
|
gtk.ListStore.__init__(self,str,str,str,str,str,str,
|
||||||
|
gobject.TYPE_PYOBJECT)
|
||||||
self.db = db
|
self.db = db
|
||||||
for event_ref in event_list:
|
for event_ref in event_list:
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
self.append(row=[
|
self.append(row=[
|
||||||
|
self.column_type(event),
|
||||||
event.get_description(),
|
event.get_description(),
|
||||||
event.get_gramps_id(),
|
event.get_gramps_id(),
|
||||||
self.column_type(event),
|
|
||||||
self.column_date(event_ref),
|
self.column_date(event_ref),
|
||||||
self.column_place(event_ref),
|
self.column_place(event_ref),
|
||||||
event.get_cause(),
|
event.get_cause(),
|
||||||
|
event_ref
|
||||||
])
|
])
|
||||||
|
|
||||||
def column_type(self,event):
|
def column_type(self,event):
|
||||||
|
@ -240,8 +240,8 @@ class EditFamily(DisplayState.ManagedWindow):
|
|||||||
|
|
||||||
self.child_list = ChildEmbedList(self.dbstate,self.uistate,
|
self.child_list = ChildEmbedList(self.dbstate,self.uistate,
|
||||||
self.track, self.family)
|
self.track, self.family)
|
||||||
self.event_list = DisplayTabs.EventEmbedList(self.dbstate, self.uistate,
|
self.event_list = DisplayTabs.EventEmbedList(self.dbstate,self.uistate,
|
||||||
self.track, self.family)
|
self.track,self.family)
|
||||||
self.attr_list = AttrEmbedList(self.dbstate, self.uistate, self.track,
|
self.attr_list = AttrEmbedList(self.dbstate, self.uistate, self.track,
|
||||||
self.family.get_attribute_list())
|
self.family.get_attribute_list())
|
||||||
self.note_tab = DisplayTabs.NoteTab(self.family.get_note_object())
|
self.note_tab = DisplayTabs.NoteTab(self.family.get_note_object())
|
||||||
|
@ -75,6 +75,15 @@ class IconButton(gtk.EventBox):
|
|||||||
self.add(image)
|
self.add(image)
|
||||||
self.show()
|
self.show()
|
||||||
self.connect('button-press-event',func,handle)
|
self.connect('button-press-event',func,handle)
|
||||||
|
|
||||||
|
class SimpleButton(gtk.Button):
|
||||||
|
|
||||||
|
def __init__(self,image,func):
|
||||||
|
gtk.Button.__init__(self)
|
||||||
|
self.set_relief(gtk.RELIEF_NONE)
|
||||||
|
self.add(gtk.image_new_from_stock(image,gtk.ICON_SIZE_BUTTON))
|
||||||
|
self.connect('clicked',func)
|
||||||
|
self.show()
|
||||||
|
|
||||||
class LinkBox(gtk.HBox):
|
class LinkBox(gtk.HBox):
|
||||||
|
|
||||||
|
@ -208,9 +208,42 @@ class PersonTip:
|
|||||||
|
|
||||||
__call__ = get_tip
|
__call__ = get_tip
|
||||||
|
|
||||||
|
class FamilyTip:
|
||||||
|
def __init__(self,db,obj):
|
||||||
|
self._db = db
|
||||||
|
self._obj = obj
|
||||||
|
|
||||||
|
def get_tip(self):
|
||||||
|
global escape
|
||||||
|
|
||||||
|
fhandle = self._obj.get_father_handle()
|
||||||
|
mhandle = self._obj.get_mother_handle()
|
||||||
|
|
||||||
|
s = "<span size=\"larger\" weight=\"bold\">%s</span>" % _("Family")
|
||||||
|
|
||||||
|
if fhandle:
|
||||||
|
father = self._db.get_person_from_handle(fhandle)
|
||||||
|
s +="\n <span weight=\"bold\">%s:</span> %s" % (
|
||||||
|
_("Father"),escape(father.get_primary_name().get_name()))
|
||||||
|
|
||||||
|
if mhandle:
|
||||||
|
mother = self._db.get_person_from_handle(mhandle)
|
||||||
|
s +="\n <span weight=\"bold\">%s:</span> %s" % (
|
||||||
|
_("Mother"),escape(mother.get_primary_name().get_name()))
|
||||||
|
|
||||||
|
for chandle in self._obj.get_child_handle_list():
|
||||||
|
child = self._db.get_person_from_handle(chandle)
|
||||||
|
s +="\n <span weight=\"bold\">%s:</span> %s" % (
|
||||||
|
_("Child"),escape(child.get_primary_name().get_name()))
|
||||||
|
|
||||||
|
return s
|
||||||
|
|
||||||
|
__call__ = get_tip
|
||||||
|
|
||||||
|
|
||||||
CLASS_MAP = {
|
CLASS_MAP = {
|
||||||
RelLib.Repository : RepositoryTip,
|
RelLib.Repository : RepositoryTip,
|
||||||
RelLib.Person : PersonTip
|
RelLib.Person : PersonTip,
|
||||||
|
RelLib.Family : FamilyTip
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user