* src/DisplayModels.py: Support for event view.

* src/EventEdit.py: Commit event on OK.
* src/GrampsDbBase.py: Event column order and event cursor.
* src/GrampsInMemDB.py: Event cursor.
* src/gramps.glade: Event View, rework buttons.
* src/gramps_main.py: Event View support.
* src/EventView.py: Add to CVS.
* src/Makefile.am: Ship EventView.


svn: r4797
This commit is contained in:
Alex Roitman 2005-06-07 05:08:50 +00:00
parent 0d9a076141
commit f2cf13f469
9 changed files with 904 additions and 158 deletions

View File

@ -10,6 +10,15 @@
* src/edit_person.glade: Add select button to the event tab.
* src/gramps.glade: Add new editor for both events and refs.
* src/DisplayModels.py: Support for event view.
* src/EventEdit.py: Commit event on OK.
* src/GrampsDbBase.py: Event column order and event cursor.
* src/GrampsInMemDB.py: Event cursor.
* src/gramps.glade: Event View, rework buttons.
* src/gramps_main.py: Event View support.
* src/EventView.py: Add to CVS.
* src/Makefile.am: Ship EventView.
2005-06-05 Alex Roitman <shura@gramps-project.org>
* src/DateHandler.py: Fix typo caught in gramps20 branch.

View File

@ -489,6 +489,75 @@ class MediaModel(BaseModel):
return unicode(time.strftime(_date_format,time.localtime(data[8])),
_codeset)
#-------------------------------------------------------------------------
#
# EventModel
#
#-------------------------------------------------------------------------
class EventModel(BaseModel):
def __init__(self,db,scol=0,order=gtk.SORT_ASCENDING):
self.gen_cursor = db.get_event_cursor
self.map = db.event_map
self.fmap = [
self.column_description,
self.column_id,
self.column_type,
self.column_change,
self.column_date,
self.column_place,
self.column_cause,
self.column_handle,
]
self.smap = [
self.column_description,
self.column_id,
self.column_type,
self.sort_change,
self.column_date,
self.column_place,
self.column_cause,
self.column_handle,
]
BaseModel.__init__(self,db,scol,order)
def on_get_n_columns(self):
return len(self.fmap)+1
def column_description(self,data):
return unicode(data[4])
def column_cause(self,data):
return unicode(data[6])
def column_place(self,data):
if data[5]:
return unicode(self.db.get_place_from_handle(data[5]).get_title())
else:
return u''
def column_type(self,data):
return unicode(data[2][1])
def column_id(self,data):
return unicode(data[1])
def column_date(self,data):
if data[3]:
return unicode(DateHandler.displayer.display(data[3]))
return u''
def column_handle(self,data):
return unicode(data[0])
def sort_change(self,data):
return time.localtime(data[11])
def column_change(self,data):
return unicode(time.strftime(_date_format,time.localtime(data[11])),
_codeset)
#-------------------------------------------------------------------------
#

View File

@ -80,10 +80,12 @@ def get_place(field,pmap,db):
#-------------------------------------------------------------------------
class EventEditor:
def __init__(self,parent,name,etypes,event,def_placename,
read_only, cb, def_event=None, noedit=False):
def __init__(self,event,db,parent,parent_window):
#read_only, cb, def_event=None, noedit=False):
self.parent = parent
self.db = self.parent.db
self.db = db
read_only = self.db.readonly
noedit = self.db.readonly
if event:
if self.parent.child_windows.has_key(event.get_handle()):
self.parent.child_windows[event.get_handle()].present(None)
@ -94,7 +96,6 @@ class EventEditor:
self.win_key = self
self.event = event
self.child_windows = {}
self.callback = cb
self.path = self.db.get_save_path()
self.plist = []
self.pmap = {}
@ -115,10 +116,10 @@ class EventEditor:
self.window = self.top.get_widget("event_edit")
title_label = self.top.get_widget('title')
if name == ", ":
#if name == ", ":
etitle = _('Event Editor')
else:
etitle = _('Event Editor for %s') % name
#else:
# etitle = _('Event Editor for %s') % name
Utils.set_titles(self.window,title_label, etitle,
_('Event Editor'))
@ -188,10 +189,10 @@ class EventEditor:
AutoComp.fill_entry(self.place_field,self.pmap.keys())
if event != None:
# self.event_menu.child.set_text(transname)
if def_placename:
self.place_field.set_text(def_placename)
else:
# self.event_menu.child.set_text(transname)
# if def_placename:
# self.place_field.set_text(def_placename)
# else:
place_handle = event.get_place_handle()
if not place_handle:
place_name = u""
@ -345,9 +346,12 @@ class EventEditor:
self.update_event(event_data,self.date,eplace_obj,edesc,enote,eformat,
epriv,ecause)
if self.parent.lists_changed:
trans = self.db.transaction_begin()
self.db.commit_event(self.event,trans)
self.db.transaction_commit(trans,_("Edit Event"))
self.close(obj)
if self.callback:
self.callback(self.event)
def update_event(self,the_type,date,place,desc,note,format,priv,cause):
if place:

282
gramps2/src/EventView.py Normal file
View File

@ -0,0 +1,282 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2005 Donald N. Allingham
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
#
#-------------------------------------------------------------------------
import gtk
import gtk.gdk
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import RelLib
import EventEdit
import DisplayModels
import const
import Utils
from QuestionDialog import QuestionDialog, ErrorDialog
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
column_names = [
_('Description'),
_('ID'),
_('Type'),
_('Date'),
_('Place'),
_('Cause'),
]
_HANDLE_COL = 7
#-------------------------------------------------------------------------
#
# EventView
#
#-------------------------------------------------------------------------
class EventView:
def __init__(self,parent,db,glade):
self.parent = parent
self.parent.connect('database-changed',self.change_db)
self.glade = glade
self.list = glade.get_widget("event_list")
self.list.connect('button-press-event',self.button_press)
self.list.connect('key-press-event',self.key_press)
self.selection = self.list.get_selection()
self.selection.set_mode(gtk.SELECTION_MULTIPLE)
self.renderer = gtk.CellRendererText()
self.model = DisplayModels.EventModel(self.parent.db,0)
self.sort_col = 0
self.list.set_model(self.model)
self.list.set_headers_clickable(True)
self.topWindow = self.glade.get_widget("gramps")
self.columns = []
self.change_db(db)
def column_clicked(self,obj,data):
if self.sort_col != data:
order = gtk.SORT_ASCENDING
else:
if (self.columns[data].get_sort_order() == gtk.SORT_DESCENDING
or self.columns[data].get_sort_indicator() == False):
order = gtk.SORT_ASCENDING
else:
order = gtk.SORT_DESCENDING
self.sort_col = data
handle = self.first_selected()
self.model = DisplayModels.EventModel(self.parent.db,
self.sort_col,order)
self.list.set_model(self.model)
colmap = self.parent.db.get_repository_column_order()
if handle:
path = self.model.on_get_path(handle)
self.selection.select_path(path)
self.list.scroll_to_cell(path,None,1,0.5,0)
for i in range(0,len(self.columns)):
self.columns[i].set_sort_indicator(i==colmap[data][1]-1)
self.columns[self.sort_col].set_sort_order(order)
def build_columns(self):
for column in self.columns:
self.list.remove_column(column)
column = gtk.TreeViewColumn(_('Type'), self.renderer,text=0)
column.set_resizable(True)
column.set_min_width(225)
column.set_clickable(True)
column.connect('clicked',self.column_clicked,0)
self.list.append_column(column)
self.columns = [column]
index = 1
for pair in self.parent.db.get_event_column_order():
if not pair[0]:
continue
print pair
name = column_names[pair[1]]
column = gtk.TreeViewColumn(name, self.renderer, text=pair[1])
column.connect('clicked',self.column_clicked,index)
column.set_resizable(True)
column.set_min_width(75)
column.set_clickable(True)
self.columns.append(column)
self.list.append_column(column)
index += 1
def change_db(self,db):
db.connect('event-add', self.event_add)
db.connect('event-update', self.event_update)
db.connect('event-delete', self.event_delete)
db.connect('event-rebuild',self.build_tree)
self.build_columns()
self.build_tree()
def build_tree(self):
self.list.set_model(None)
self.model = DisplayModels.EventModel(self.parent.db,self.sort_col)
self.list.set_model(self.model)
self.selection = self.list.get_selection()
self.selection.set_mode(gtk.SELECTION_MULTIPLE)
def button_press(self,obj,event):
if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:
mlist = []
self.selection.selected_foreach(self.blist,mlist)
handle = mlist[0]
the_event = self.parent.db.get_event_from_handle(handle)
EventEdit.EventEditor(the_event,self.parent.db,self.parent,
self.topWindow)
return True
elif event.type == gtk.gdk.BUTTON_PRESS and event.button == 3:
self.build_context_menu(event)
return True
return False
def key_press(self,obj,event):
if event.keyval == gtk.gdk.keyval_from_name("Return") \
and not event.state:
self.on_edit_clicked(obj)
return True
return False
def build_context_menu(self,event):
"""Builds the menu with editing operations on the repository's list"""
mlist = []
self.selection.selected_foreach(self.blist,mlist)
if mlist:
sel_sensitivity = 1
else:
sel_sensitivity = 0
entries = [
(gtk.STOCK_ADD, self.on_add_clicked,1),
(gtk.STOCK_REMOVE, self.on_delete_clicked,sel_sensitivity),
(_("Edit"), self.on_edit_clicked,sel_sensitivity),
]
menu = gtk.Menu()
menu.set_title(_('Event Menu'))
for stock_id,callback,sensitivity in entries:
item = gtk.ImageMenuItem(stock_id)
if callback:
item.connect("activate",callback)
item.set_sensitive(sensitivity)
item.show()
menu.append(item)
menu.popup(None,None,None,event.button,event.time)
def on_add_clicked(self,obj):
EventEdit.EventEditor(RelLib.Event(),self.parent.db,self.parent,
self.topWindow)
def on_delete_clicked(self,obj):
mlist = []
self.selection.selected_foreach(self.blist,mlist)
for event_handle in mlist:
person_list = [ handle for handle in
self.parent.db.get_person_handles(False)
if self.parent.db.get_person_from_handle(handle).has_handle_reference('Event',event_handle) ]
family_list = [ handle for handle in
self.parent.db.get_family_handles()
if self.parent.db.get_family_from_handle(handle).has_handle_reference('Event',event_handle) ]
event = self.parent.db.get_event_from_handle(event_handle)
ans = EventEdit.DelReposQuery(event,self.parent.db,
person_list+family_list)
if len(person_list+family_list) > 0:
msg = _('This event is currently being used. Deleting it '
'will remove it from the database and from all '
'people and families that reference it.')
else:
msg = _('Deleting event will remove it from the database.')
msg = "%s %s" % (msg,Utils.data_recover_msg)
QuestionDialog(_('Delete %s?') % event.get_gramps_id(), msg,
_('_Delete Event'),ans.query_response,
self.topWindow)
def on_edit_clicked(self,obj):
mlist = []
self.selection.selected_foreach(self.blist,mlist)
for handle in mlist:
event = self.parent.db.get_event_from_handle(handle)
EventEdit.EventEditor(event, self.parent.db, self.parent,
self.topWindow)
def event_add(self,handle_list):
for handle in handle_list:
self.model.add_row_by_handle(handle)
def event_update(self,handle_list):
for handle in handle_list:
self.model.update_row_by_handle(handle)
def event_delete(self,handle_list):
for handle in handle_list:
self.model.delete_row_by_handle(handle)
def first_selected(self):
mlist = []
self.selection.selected_foreach(self.blist,mlist)
if mlist:
return mlist[0]
else:
return None
def blist(self,store,path,iter,sel_list):
handle = store.get_value(iter,_HANDLE_COL)
sel_list.append(handle)
## def merge(self):
## mlist = []
## self.selection.selected_foreach(self.blist,mlist)
## if len(mlist) != 2:
## msg = _("Cannot merge repositorys.")
## msg2 = _("Exactly two repositorys must be selected to perform a merge. "
## "A second repository can be selected by holding down the "
## "control key while clicking on the desired repository.")
## ErrorDialog(msg,msg2)
## else:
## import MergeData
## MergeData.MergeRepositorys(self.parent.db,mlist[0],mlist[1],
## self.build_tree)

View File

@ -69,6 +69,7 @@ PLACE_COL_KEY = 'place_columns'
SOURCE_COL_KEY = 'source_columns'
MEDIA_COL_KEY = 'media_columns'
REPOSITORY_COL_KEY = 'repository_columns'
EVENT_COL_KEY = 'event_columns'
_sigbase = ('person', 'family', 'source', 'event',
'media', 'place', 'repository')
@ -235,6 +236,9 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
def get_family_cursor(self):
assert False, "Needs to be overridden in the derived class"
def get_event_cursor(self):
assert False, "Needs to be overridden in the derived class"
def get_place_cursor(self):
assert False, "Needs to be overridden in the derived class"
@ -1355,6 +1359,14 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
default = [(1,1),(0,5),(0,6),(1,2),(1,3),(0,4)]
return self._get_column_order(MEDIA_COL_KEY,default)
def get_event_column_order(self):
"""
Returns the Event display common information stored in the
database's metadata.
"""
default = [(1,0),(1,1),(1,2),(0,3),(1,4),(1,5),(0,6)]
return self._get_column_order(EVENT_COL_KEY,default)
def get_repository_column_order(self):
"""
Returns the Repository display common information stored in the

View File

@ -104,6 +104,9 @@ class GrampsInMemDB(GrampsDbBase):
def get_family_cursor(self):
return GrampsInMemCursor(self.family_map)
def get_event_cursor(self):
return GrampsInMemCursor(self.event_map)
def get_place_cursor(self):
return GrampsInMemCursor(self.place_map)

View File

@ -120,7 +120,8 @@ gdir_PYTHON = \
RecentFiles.py\
ReportOptions.py\
ReadGrdb.py\
WriteGrdb.py
WriteGrdb.py\
EventView.py
# Could use GNU make's ':=' syntax for nice wildcard use.
# If not using GNU make, then list all files individually

View File

@ -1005,7 +1005,13 @@
<signal name="clicked" handler="on_person_list1_activate" last_modification_time="Thu, 05 Sep 2002 01:03:54 GMT"/>
<child>
<widget class="GtkImage" id="image34">
<widget class="GtkHBox" id="hbox134">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2654">
<property name="visible">True</property>
<property name="pixbuf">people48.png</property>
<property name="xalign">0.5</property>
@ -1013,8 +1019,6 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
@ -1023,10 +1027,10 @@
</child>
<child>
<widget class="GtkLabel" id="side_people_label">
<widget class="GtkLabel" id="label525">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;People&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_underline">True</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@ -1035,7 +1039,15 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -1053,7 +1065,25 @@
<signal name="clicked" handler="on_family_activate" last_modification_time="Tue, 26 Aug 2003 04:14:43 GMT"/>
<child>
<widget class="GtkImage" id="image46">
<widget class="GtkAlignment" id="alignment6">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox135">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2655">
<property name="visible">True</property>
<property name="pixbuf">family48.png</property>
<property name="xalign">0.5</property>
@ -1061,8 +1091,6 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
@ -1071,7 +1099,7 @@
</child>
<child>
<widget class="GtkLabel" id="label318">
<widget class="GtkLabel" id="label526">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Family&lt;/b&gt;</property>
<property name="use_underline">True</property>
@ -1083,7 +1111,17 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -1101,7 +1139,25 @@
<signal name="clicked" handler="on_pedigree1_activate" last_modification_time="Thu, 05 Sep 2002 01:04:23 GMT"/>
<child>
<widget class="GtkImage" id="image33">
<widget class="GtkAlignment" id="alignment7">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox136">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2656">
<property name="visible">True</property>
<property name="pixbuf">gramps.png</property>
<property name="xalign">0.5</property>
@ -1109,8 +1165,6 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
@ -1119,7 +1173,7 @@
</child>
<child>
<widget class="GtkLabel" id="label316">
<widget class="GtkLabel" id="label527">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Pedigree&lt;/b&gt;</property>
<property name="use_underline">True</property>
@ -1131,7 +1185,17 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -1149,7 +1213,25 @@
<signal name="clicked" handler="on_sources_activate" last_modification_time="Sat, 21 Sep 2002 23:57:08 GMT"/>
<child>
<widget class="GtkImage" id="image47">
<widget class="GtkAlignment" id="alignment8">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox137">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2657">
<property name="visible">True</property>
<property name="pixbuf">sources.png</property>
<property name="xalign">0.5</property>
@ -1157,8 +1239,6 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
@ -1167,7 +1247,7 @@
</child>
<child>
<widget class="GtkLabel" id="label319">
<widget class="GtkLabel" id="label528">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Sources&lt;/b&gt;</property>
<property name="use_underline">True</property>
@ -1179,7 +1259,92 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button198">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_repos_activate" last_modification_time="Tue, 07 Jun 2005 01:47:32 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment9">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox138">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2658">
<property name="visible">True</property>
<property name="pixbuf">sources.png</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label529">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Reposi-
tories&lt;/b&gt;</property>
<property name="use_underline">True</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -1197,7 +1362,25 @@
<signal name="clicked" handler="on_places_activate" last_modification_time="Sat, 21 Sep 2002 23:57:32 GMT"/>
<child>
<widget class="GtkImage" id="image48">
<widget class="GtkAlignment" id="alignment10">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox139">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2659">
<property name="visible">True</property>
<property name="pixbuf">place.png</property>
<property name="xalign">0.5</property>
@ -1205,8 +1388,6 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
@ -1215,7 +1396,7 @@
</child>
<child>
<widget class="GtkLabel" id="label320">
<widget class="GtkLabel" id="label530">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Places&lt;/b&gt;</property>
<property name="use_underline">True</property>
@ -1227,7 +1408,17 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -1245,7 +1436,25 @@
<signal name="clicked" handler="on_media_activate" last_modification_time="Sat, 21 Sep 2002 23:57:55 GMT"/>
<child>
<widget class="GtkImage" id="image49">
<widget class="GtkAlignment" id="alignment11">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox140">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2660">
<property name="visible">True</property>
<property name="pixbuf">media.png</property>
<property name="xalign">0.5</property>
@ -1253,8 +1462,6 @@
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
@ -1263,7 +1470,7 @@
</child>
<child>
<widget class="GtkLabel" id="label321">
<widget class="GtkLabel" id="label531">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Media&lt;/b&gt;</property>
<property name="use_underline">True</property>
@ -1275,7 +1482,91 @@
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">views</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkButton" id="button197">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<signal name="clicked" handler="on_events_activate" last_modification_time="Tue, 07 Jun 2005 01:46:40 GMT"/>
<child>
<widget class="GtkAlignment" id="alignment12">
<property name="visible">True</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<property name="top_padding">0</property>
<property name="bottom_padding">0</property>
<property name="left_padding">0</property>
<property name="right_padding">0</property>
<child>
<widget class="GtkHBox" id="hbox141">
<property name="visible">True</property>
<property name="homogeneous">False</property>
<property name="spacing">2</property>
<child>
<widget class="GtkImage" id="image2661">
<property name="visible">True</property>
<property name="pixbuf">media.png</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label532">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Events&lt;/b&gt;</property>
<property name="use_underline">True</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="padding">0</property>
<property name="expand">False</property>
<property name="fill">False</property>
</packing>
</child>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="padding">0</property>
@ -3611,6 +3902,51 @@
<property name="type">tab</property>
</packing>
</child>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow101">
<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="event_list">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">True</property>
<property name="reorderable">False</property>
<property name="enable_search">True</property>
</widget>
</child>
</widget>
<packing>
<property name="tab_expand">False</property>
<property name="tab_fill">True</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="events_top_label">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Events&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_CENTER</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="type">tab</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -58,6 +58,7 @@ import PedView
import MediaView
import PlaceView
import FamilyView
import EventView
import SourceView
import RepositoryView
import PeopleView
@ -102,6 +103,7 @@ SOURCE_VIEW = 4
REPOSITORY_VIEW = 5
PLACE_VIEW = 6
MEDIA_VIEW = 7
EVENT_VIEW = 8
#-------------------------------------------------------------------------
#
@ -383,6 +385,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
self.repository_view = RepositoryView.RepositoryView(self,self.db,self.gtop)
self.media_view = MediaView.MediaView(self,self.db,self.gtop,
self.update_display)
self.event_view = EventView.EventView(self,self.db,self.gtop)
self.add_button = self.gtop.get_widget('addbtn')
self.add_item = self.gtop.get_widget('add_item')
@ -471,6 +474,8 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
"on_gramps_report_bug_activate" : self.report_bug_activate,
"on_gramps_mailing_lists_activate" : self.mailing_lists_activate,
"on_open_example" : self.open_example,
"on_events_activate" : self.on_events_activate,
"on_repos_activate" : self.on_repos_activate,
})
self.filter_btn.set_active(GrampsKeys.get_filter())
@ -597,6 +602,10 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
self.db.set_media_column_order(list)
self.media_view.build_columns()
def set_event_column_order(self,list):
self.db.set_event_column_order(list)
self.event_view.build_columns()
def column_order(self,obj):
import ColumnOrder
@ -621,6 +630,10 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
ColumnOrder.ColumnOrder(self.db.get_media_column_order(),
MediaView.column_names,
self.set_media_column_order)
elif cpage == EVENT_VIEW:
ColumnOrder.ColumnOrder(self.db.get_event_column_order(),
EventView.column_names,
self.set_event_column_order)
def clear_history(self):
self.history = []
@ -860,6 +873,8 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
self.place_view.on_edit_clicked(obj)
elif cpage == MEDIA_VIEW:
self.media_view.on_edit_clicked(obj)
elif cpage == EVENT_VIEW:
self.event_view.on_edit_clicked(obj)
def add_button_clicked(self,obj):
cpage = self.views.get_current_page()
@ -873,6 +888,8 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
self.place_view.on_add_place_clicked(obj)
elif cpage == MEDIA_VIEW:
self.media_view.on_add_clicked(obj)
elif cpage == EVENT_VIEW:
self.event_view.on_add_clicked(obj)
def remove_button_clicked(self,obj):
cpage = self.views.get_current_page()
@ -886,6 +903,8 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
self.place_view.on_delete_clicked(obj)
elif cpage == MEDIA_VIEW:
self.media_view.on_delete_clicked(obj)
elif cpage == EVENT_VIEW:
self.event_view.on_delete_clicked(obj)
def enable_buttons(self,val):
if self.db.readonly:
@ -1675,6 +1694,14 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
"""Switches to the media view"""
self.views.set_current_page(MEDIA_VIEW)
def on_events_activate(self,obj):
"""Switches to the event view"""
self.views.set_current_page(EVENT_VIEW)
def on_repos_activate(self,obj):
"""Switches to the repository view"""
self.views.set_current_page(REPOSITORY_VIEW)
def on_views_switch_page(self,obj,junk,page):
"""Load the appropriate page after a notebook switch"""
if page == PERSON_VIEW:
@ -1697,6 +1724,9 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
elif page == MEDIA_VIEW:
self.enable_buttons(1)
self.merge_button.set_sensitive(0)
elif page == EVENT_VIEW:
self.enable_buttons(1)
self.merge_button.set_sensitive(0)
def on_apply_filter_clicked(self,obj):
self.people_view.apply_filter_clicked()