* src/GrampsDbBase.py: handle new column

* src/PeopleModel.py: add cause of death field
* src/PeopleView.py: add cause of death field
* src/gramps.glade: add scratchpad button
* src/gramps_main.py: add scratchpad button press callback
* src/plugins/ScratchPad.py: call alternate dialog
* src/plugins/scratchpad.glade: provide alternate dialog based
on gtk.Dialog that implements the help button.


svn: r4213
This commit is contained in:
Don Allingham 2005-03-19 23:44:01 +00:00
parent 31ce5db97d
commit 11dd72bb27
8 changed files with 2495 additions and 17 deletions

View File

@ -1,3 +1,13 @@
2005-03-19 Don Allingham <don@gramps-project.org>
* src/GrampsDbBase.py: handle new column
* src/PeopleModel.py: add cause of death field
* src/PeopleView.py: add cause of death field
* src/gramps.glade: add scratchpad button
* src/gramps_main.py: add scratchpad button press callback
* src/plugins/ScratchPad.py: call alternate dialog
* src/plugins/scratchpad.glade: provide alternate dialog based
on gtk.Dialog that implements the help button.
2005-03-19 Alex Roitman <shura@gramps-project.org> 2005-03-19 Alex Roitman <shura@gramps-project.org>
* src/gramps.glade: Add date LED buttons for LDS dates. * src/gramps.glade: Add date LED buttons for LDS dates.
* src/EditPerson.py (draw_lds): Add date LED buttons for LDS dates; * src/EditPerson.py (draw_lds): Add date LED buttons for LDS dates;

View File

@ -1187,7 +1187,7 @@ class GrampsDbBase:
Returns the Person display common information stored in the Returns the Person display common information stored in the
database's metadata. database's metadata.
""" """
default = [(1,1),(1,2),(1,3),(0,4),(1,5),(0,6),(0,7),(0,8)] default = [(1,1),(1,2),(1,3),(0,4),(1,5),(0,6),(0,7),(0,8),(0,9,)]
if self.metadata == None: if self.metadata == None:
return default return default
else: else:

View File

@ -279,6 +279,12 @@ class PeopleModel(gtk.GenericTreeModel):
return self.db.get_event_from_handle(data[_DEATH_COL]).get_date() return self.db.get_event_from_handle(data[_DEATH_COL]).get_date()
else: else:
return u"" return u""
def column_cause_of_death(self,data,node):
if data[_DEATH_COL]:
return self.db.get_event_from_handle(data[_DEATH_COL]).get_cause()
else:
return u""
def column_birth_place(self,data,node): def column_birth_place(self,data,node):
if data[_BIRTH_COL]: if data[_BIRTH_COL]:
@ -313,20 +319,21 @@ _GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
# (unless this is declared after the PeopleModel class, an error is thrown) # (unless this is declared after the PeopleModel class, an error is thrown)
COLUMN_DEFS = [ COLUMN_DEFS = [
# data column (method) header column (method) column data type # data column (method) header column (method) column data type
(PeopleModel.column_name, PeopleModel.column_header, gobject.TYPE_STRING), (PeopleModel.column_name, PeopleModel.column_header, str),
(PeopleModel.column_id, None, gobject.TYPE_STRING), (PeopleModel.column_id, None, str),
(PeopleModel.column_gender, None, gobject.TYPE_STRING), (PeopleModel.column_gender, None, str),
(PeopleModel.column_birth_day, None, gobject.TYPE_STRING), (PeopleModel.column_birth_day, None, str),
(PeopleModel.column_birth_place,None, gobject.TYPE_STRING), (PeopleModel.column_birth_place,None, str),
(PeopleModel.column_death_day, None, gobject.TYPE_STRING), (PeopleModel.column_death_day, None, str),
(PeopleModel.column_death_place,None, gobject.TYPE_STRING), (PeopleModel.column_death_place,None, str),
(PeopleModel.column_spouse, None, gobject.TYPE_STRING), (PeopleModel.column_spouse, None, str),
(PeopleModel.column_change, None, gobject.TYPE_STRING), (PeopleModel.column_change, None, str),
(PeopleModel.column_cause_of_death, None, str),
# the order of the above columns must match PeopleView.column_names # the order of the above columns must match PeopleView.column_names
# these columns are hidden, and must always be last in the list # these columns are hidden, and must always be last in the list
(PeopleModel.column_sort_name, None, gobject.TYPE_STRING), (PeopleModel.column_sort_name, None, str),
(PeopleModel.column_int_id, None, gobject.TYPE_STRING), (PeopleModel.column_int_id, None, str),
] ]
# dynamic calculation of column indices, for use by various Views # dynamic calculation of column indices, for use by various Views

View File

@ -56,6 +56,7 @@ column_names = [
_('Death Place'), _('Death Place'),
_('Spouse'), _('Spouse'),
_('Last Change'), _('Last Change'),
_('Cause of Death'),
] ]
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -354,6 +354,7 @@ class Gramps:
"on_abandon_activate" : self.exit_and_undo, "on_abandon_activate" : self.exit_and_undo,
"on_column_order_activate": self.column_order, "on_column_order_activate": self.column_order,
"on_back_clicked" : self.back_clicked, "on_back_clicked" : self.back_clicked,
"on_scratchpad_clicked" : self.scratchpad_clicked,
# FIXME: uncomment when fixed # FIXME: uncomment when fixed
#"on_back_pressed" : self.back_pressed, #"on_back_pressed" : self.back_pressed,
"on_fwd_clicked" : self.fwd_clicked, "on_fwd_clicked" : self.fwd_clicked,
@ -718,6 +719,10 @@ class Gramps:
self.remove_item.set_sensitive(val) self.remove_item.set_sensitive(val)
self.edit_item.set_sensitive(val) self.edit_item.set_sensitive(val)
def scratchpad_clicked(self,obj):
import ScratchPad
ScratchPad.ScratchPadWindow(self.db, self)
def back_clicked(self,obj,step=1): def back_clicked(self,obj,step=1):
if self.hindex > 0: if self.hindex > 0:
try: try:
@ -1387,7 +1392,7 @@ class Gramps:
child = self.db.get_person_from_handle(child_handle) child = self.db.get_person_from_handle(child_handle)
child.remove_parent_family_handle(family.get_handle()) child.remove_parent_family_handle(family.get_handle())
self.db.commit_person(child,trans) self.db.commit_person(child,trans)
self.db.delete_family(family.get_handle(),trans) self.db.remove_family(family.get_handle(),trans)
else: else:
family.set_father_handle(None) family.set_father_handle(None)
else: else:
@ -1396,7 +1401,7 @@ class Gramps:
child = self.db.get_person_from_handle(child_handle) child = self.db.get_person_from_handle(child_handle)
child.remove_parent_family_handle(family) child.remove_parent_family_handle(family)
self.db.commit_person(child,trans) self.db.commit_person(child,trans)
self.db.delete_family(family,trans) self.db.remove_family(family,trans)
else: else:
family.set_mother_handle(None) family.set_mother_handle(None)
self.db.commit_family(family,trans) self.db.commit_family(family,trans)

View File

@ -129,8 +129,8 @@ class ScratchPadWindow:
base = os.path.dirname(__file__) base = os.path.dirname(__file__)
self.glade_file = "%s/%s" % (base,"scratchpad.glade") self.glade_file = "%s/%s" % (base,"scratchpad.glade")
self.top = gtk.glade.XML(self.glade_file,"scratchPad","gramps") self.top = gtk.glade.XML(self.glade_file,"scratch_pad","gramps")
self.window = self.top.get_widget("scratchPad") self.window = self.top.get_widget("scratch_pad")
self.window.set_icon(self.parent.topWindow.get_icon()) self.window.set_icon(self.parent.topWindow.get_icon())
self.object_list = self.top.get_widget('objectlist') self.object_list = self.top.get_widget('objectlist')

View File

@ -19,6 +19,7 @@
<property name="skip_pager_hint">False</property> <property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<signal name="delete_event" handler="on_scratchPad_delete_event" object="ScratchPad" last_modification_time="Fri, 11 Mar 2005 11:35:07 GMT"/> <signal name="delete_event" handler="on_scratchPad_delete_event" object="ScratchPad" last_modification_time="Fri, 11 Mar 2005 11:35:07 GMT"/>
<child> <child>
@ -44,6 +45,9 @@
<property name="rules_hint">False</property> <property name="rules_hint">False</property>
<property name="reorderable">False</property> <property name="reorderable">False</property>
<property name="enable_search">True</property> <property name="enable_search">True</property>
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
<signal name="delete_event" handler="on_objectlist_delete_event" object="ScratchPad" last_modification_time="Wed, 09 Mar 2005 13:48:09 GMT"/> <signal name="delete_event" handler="on_objectlist_delete_event" object="ScratchPad" last_modification_time="Wed, 09 Mar 2005 13:48:09 GMT"/>
</widget> </widget>
</child> </child>
@ -58,7 +62,7 @@
<child> <child>
<widget class="GtkHButtonBox" id="hbuttonbox37"> <widget class="GtkHButtonBox" id="hbuttonbox37">
<property name="visible">True</property> <property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property> <property name="layout_style">GTK_BUTTONBOX_END</property>
<property name="spacing">0</property> <property name="spacing">0</property>
<child> <child>
@ -110,4 +114,131 @@
</child> </child>
</widget> </widget>
<widget class="GtkDialog" id="scratch_pad">
<property name="visible">True</property>
<property name="title" translatable="yes">Scratch Pad</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
<property name="default_width">500</property>
<property name="default_height">300</property>
<property name="resizable">True</property>
<property name="destroy_with_parent">False</property>
<property name="decorated">True</property>
<property name="skip_taskbar_hint">False</property>
<property name="skip_pager_hint">False</property>
<property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
<property name="focus_on_map">True</property>
<property name="has_separator">True</property>
<child internal-child="vbox">
<widget class="GtkVBox" id="dialog-vbox1">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">0</property>
<child internal-child="action_area">
<widget class="GtkHButtonBox" id="dialog-action_area1">
<property name="visible">True</property>
<property name="layout_style">GTK_BUTTONBOX_END</property>
<child>
<widget class="GtkButton" id="helpbutton1">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-help</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-11</property>
<signal name="clicked" handler="on_help_clicked" last_modification_time="Sat, 19 Mar 2005 22:47:16 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="btn_clear_all">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Clear _All</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_clear_all_clicked" last_modification_time="Sat, 19 Mar 2005 22:46:57 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="btn_clear">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-clear</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_clear_clicked" last_modification_time="Sat, 19 Mar 2005 22:46:29 GMT"/>
</widget>
</child>
<child>
<widget class="GtkButton" id="btn_close">
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
<property name="label">gtk-close</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
<property name="response_id">-7</property>
<signal name="clicked" handler="on_close_scratchpad" last_modification_time="Sat, 19 Mar 2005 22:42:52 GMT"/>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">GTK_PACK_END</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow86">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child>
<widget class="GtkTreeView" id="objectlist">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
<property name="fixed_height_mode">False</property>
<property name="hover_selection">False</property>
<property name="hover_expand">False</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</widget>
</child>
</widget>
</glade-interface> </glade-interface>