* src/DbState.py: change_active_person now emits the signal, change_active_handle is only a wrapper for that.
* src/PageView.py (get_stock): Work around not existing definition of gtk.STOCK_MEDIA_MISSING by using gtk.STOCK_MISSING_IMAGE. * src/PedView.py: Start using new PageView logic. Unfinished. * src/gramps_main.py: Enable PedView svn: r5041
This commit is contained in:
parent
6fb39a605f
commit
21302dbbf4
@ -1,3 +1,11 @@
|
|||||||
|
2005-08-09 Martin Hawlisch <Martin.Hawlisch@gmx.de>
|
||||||
|
* src/DbState.py: change_active_person now emits the signal,
|
||||||
|
change_active_handle is only a wrapper for that.
|
||||||
|
* src/PageView.py (get_stock): Work around not existing definition
|
||||||
|
of gtk.STOCK_MEDIA_MISSING by using gtk.STOCK_MISSING_IMAGE.
|
||||||
|
* src/PedView.py: Start using new PageView logic. Unfinished.
|
||||||
|
* src/gramps_main.py: Enable PedView
|
||||||
|
|
||||||
2005-08-08 Don Allingham <don@gramps-project.org>
|
2005-08-08 Don Allingham <don@gramps-project.org>
|
||||||
* src/DbState.py: Added new class to keep track of database
|
* src/DbState.py: Added new class to keep track of database
|
||||||
status
|
status
|
||||||
|
@ -96,9 +96,13 @@ class DbState(GrampsDBCallback.GrampsDBCallback):
|
|||||||
|
|
||||||
def change_active_person(self,person):
|
def change_active_person(self,person):
|
||||||
self.active = person
|
self.active = person
|
||||||
|
try:
|
||||||
|
self.emit('active-changed',(person.handle,))
|
||||||
|
except:
|
||||||
|
self.emit('active-changed',(None,))
|
||||||
|
|
||||||
def change_active_handle(self,handle):
|
def change_active_handle(self,handle):
|
||||||
self.emit('active-changed',(handle,))
|
self.change_active_person(self.db.get_person_from_handle(handle))
|
||||||
|
|
||||||
def get_active_person(self):
|
def get_active_person(self):
|
||||||
return self.active
|
return self.active
|
||||||
|
@ -34,7 +34,10 @@ class PageView:
|
|||||||
self.ui = ""
|
self.ui = ""
|
||||||
|
|
||||||
def get_stock(self):
|
def get_stock(self):
|
||||||
|
try:
|
||||||
return gtk.STOCK_MEDIA_MISSING
|
return gtk.STOCK_MEDIA_MISSING
|
||||||
|
except AttributeError:
|
||||||
|
return gtk.STOCK_MISSING_IMAGE
|
||||||
|
|
||||||
def get_ui(self):
|
def get_ui(self):
|
||||||
return self.ui
|
return self.ui
|
||||||
|
@ -41,6 +41,7 @@ import gtk.gdk
|
|||||||
# Gramps Modules
|
# Gramps Modules
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
import PageView
|
||||||
import const
|
import const
|
||||||
import GrampsCfg
|
import GrampsCfg
|
||||||
import Relationship
|
import Relationship
|
||||||
@ -70,48 +71,40 @@ _CREM = _('crem.')
|
|||||||
# PedigreeView
|
# PedigreeView
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class PedigreeView:
|
class PedView(PageView.PageView):
|
||||||
def __init__(self,parent,canvas,update,status_bar,edit_person):
|
|
||||||
self.parent = parent
|
|
||||||
|
|
||||||
self.relcalc = Relationship.RelationshipCalculator(self.parent.db)
|
def __init__(self,state):
|
||||||
self.parent.connect('database-changed',self.change_db)
|
PageView.PageView.__init__(self,'Pedigree View',state)
|
||||||
self.parent.connect('active-changed',self.active_changed)
|
self.inactive = False
|
||||||
|
state.connect('database-changed',self.change_db)
|
||||||
|
state.connect('active-changed',self.goto_active_person)
|
||||||
|
self.force_size = 0 # Automatic resize
|
||||||
|
|
||||||
# FIXME: Hack to avoid changing the glade file
|
def build_widget(self):
|
||||||
# Replace canvas by notebook
|
|
||||||
self.parent_container = canvas.get_parent()
|
|
||||||
canvas.destroy()
|
|
||||||
self.notebook = gtk.Notebook()
|
self.notebook = gtk.Notebook()
|
||||||
|
self.notebook.connect("button-press-event", self.on_show_option_menu_cb)
|
||||||
self.notebook.set_show_border(False)
|
self.notebook.set_show_border(False)
|
||||||
self.notebook.set_show_tabs(False)
|
self.notebook.set_show_tabs(False)
|
||||||
self.parent_container.add_with_viewport(self.notebook)
|
|
||||||
# ###
|
|
||||||
|
|
||||||
self.table_2 = gtk.Table(1,1,False)
|
self.table_2 = gtk.Table(1,1,False)
|
||||||
|
self.table_2.connect("button-press-event", self.on_show_option_menu_cb)
|
||||||
self.add_table_to_notebook( self.table_2)
|
self.add_table_to_notebook( self.table_2)
|
||||||
|
|
||||||
self.table_3 = gtk.Table(1,1,False)
|
self.table_3 = gtk.Table(1,1,False)
|
||||||
|
self.table_3.connect("button-press-event", self.on_show_option_menu_cb)
|
||||||
self.add_table_to_notebook( self.table_3)
|
self.add_table_to_notebook( self.table_3)
|
||||||
|
|
||||||
self.table_4 = gtk.Table(1,1,False)
|
self.table_4 = gtk.Table(1,1,False)
|
||||||
|
self.table_4.connect("button-press-event", self.on_show_option_menu_cb)
|
||||||
self.add_table_to_notebook( self.table_4)
|
self.add_table_to_notebook( self.table_4)
|
||||||
|
|
||||||
self.table_5 = gtk.Table(1,1,False)
|
self.table_5 = gtk.Table(1,1,False)
|
||||||
|
self.table_5.connect("button-press-event", self.on_show_option_menu_cb)
|
||||||
self.add_table_to_notebook( self.table_5)
|
self.add_table_to_notebook( self.table_5)
|
||||||
|
|
||||||
self.parent_container.connect("size-allocate", self.size_request_cb)
|
#self.parent_container.connect("size-allocate", self.size_request_cb)
|
||||||
|
|
||||||
self.notebook.show_all()
|
return self.notebook
|
||||||
|
|
||||||
self.update = update
|
|
||||||
self.sb = status_bar
|
|
||||||
self.edit_person = edit_person
|
|
||||||
|
|
||||||
self.change_db(self.parent.db)
|
|
||||||
self.distance = self.relcalc.get_relationship_distance
|
|
||||||
|
|
||||||
self.force_size = 0 # Automatic resize
|
|
||||||
|
|
||||||
def add_table_to_notebook( self, table):
|
def add_table_to_notebook( self, table):
|
||||||
frame = gtk.ScrolledWindow(None,None)
|
frame = gtk.ScrolledWindow(None,None)
|
||||||
@ -123,6 +116,34 @@ class PedigreeView:
|
|||||||
# for PyGtk < 2.4
|
# for PyGtk < 2.4
|
||||||
self.notebook.append_page(frame,gtk.Label(""))
|
self.notebook.append_page(frame,gtk.Label(""))
|
||||||
|
|
||||||
|
def define_actions(self):
|
||||||
|
#self.add_action('Add', gtk.STOCK_ADD, "_Add", callback=self.add)
|
||||||
|
#self.add_action('Edit', gtk.STOCK_EDIT, "_Edit", callback=self.edit)
|
||||||
|
#self.add_action('Remove', gtk.STOCK_REMOVE, "_Remove", callback=self.remove)
|
||||||
|
#self.add_action('Forward',gtk.STOCK_GO_FORWARD,"_Forward", callback=self.fwd_clicked)
|
||||||
|
#self.add_action('Back', gtk.STOCK_GO_BACK, "_Back", callback=self.back_clicked)
|
||||||
|
self.add_action('HomePerson', gtk.STOCK_HOME, "_Home", callback=self.home)
|
||||||
|
#self.add_toggle_action('Filter', None, '_Filter', callback=self.filter_toggle)
|
||||||
|
|
||||||
|
def ui_definition(self):
|
||||||
|
return '''<ui>
|
||||||
|
<menubar name="MenuBar">
|
||||||
|
<menu action="GoMenu">
|
||||||
|
<placeholder name="CommonGo">
|
||||||
|
<menuitem action="HomePerson"/>
|
||||||
|
</placeholder>
|
||||||
|
</menu>
|
||||||
|
</menubar>
|
||||||
|
<toolbar name="ToolBar">
|
||||||
|
<placeholder name="CommonNavigation">
|
||||||
|
<toolitem action="HomePerson"/>
|
||||||
|
</placeholder>
|
||||||
|
</toolbar>
|
||||||
|
</ui>'''
|
||||||
|
|
||||||
|
def get_stock(self):
|
||||||
|
return 'gramps-pedigree'
|
||||||
|
|
||||||
def change_db(self,db):
|
def change_db(self,db):
|
||||||
# Reconnect signals
|
# Reconnect signals
|
||||||
self.db = db
|
self.db = db
|
||||||
@ -130,7 +151,6 @@ class PedigreeView:
|
|||||||
db.connect('person-update', self.person_updated_cb)
|
db.connect('person-update', self.person_updated_cb)
|
||||||
db.connect('person-delete', self.person_updated_cb)
|
db.connect('person-delete', self.person_updated_cb)
|
||||||
db.connect('person-rebuild', self.person_rebuild)
|
db.connect('person-rebuild', self.person_rebuild)
|
||||||
self.relcalc.set_db(db)
|
|
||||||
self.active_person = None
|
self.active_person = None
|
||||||
|
|
||||||
def person_updated_cb(self,handle_list):
|
def person_updated_cb(self,handle_list):
|
||||||
@ -139,7 +159,8 @@ class PedigreeView:
|
|||||||
def person_rebuild(self):
|
def person_rebuild(self):
|
||||||
self.rebuild_trees(self.active_person)
|
self.rebuild_trees(self.active_person)
|
||||||
|
|
||||||
def active_changed(self,handle):
|
def goto_active_person(self,handle):
|
||||||
|
print "PedView.goto_active_person"
|
||||||
if handle:
|
if handle:
|
||||||
self.active_person = self.db.get_person_from_handle(handle)
|
self.active_person = self.db.get_person_from_handle(handle)
|
||||||
self.rebuild_trees(self.active_person)
|
self.rebuild_trees(self.active_person)
|
||||||
@ -147,7 +168,7 @@ class PedigreeView:
|
|||||||
self.rebuild_trees(None)
|
self.rebuild_trees(None)
|
||||||
|
|
||||||
def request_resize(self):
|
def request_resize(self):
|
||||||
self.size_request_cb(self.parent_container,None,None)
|
self.size_request_cb(self.notebook.parent,None,None)
|
||||||
|
|
||||||
def size_request_cb(self, widget, event, data=None):
|
def size_request_cb(self, widget, event, data=None):
|
||||||
if self.force_size == 0:
|
if self.force_size == 0:
|
||||||
@ -227,6 +248,7 @@ class PedigreeView:
|
|||||||
gobject.idle_add(self.request_resize)
|
gobject.idle_add(self.request_resize)
|
||||||
|
|
||||||
def rebuild( self, table_widget, positions, active_person):
|
def rebuild( self, table_widget, positions, active_person):
|
||||||
|
print "PedView.rebuild"
|
||||||
# Build ancestor tree
|
# Build ancestor tree
|
||||||
lst = [None]*31
|
lst = [None]*31
|
||||||
self.find_tree(self.active_person,0,1,lst)
|
self.find_tree(self.active_person,0,1,lst)
|
||||||
@ -354,6 +376,12 @@ class PedigreeView:
|
|||||||
else:
|
else:
|
||||||
area.window.draw_line(gc, alloc.width, alloc.height/2, alloc.width/2, alloc.height)
|
area.window.draw_line(gc, alloc.width, alloc.height/2, alloc.width/2, alloc.height)
|
||||||
|
|
||||||
|
def home(self,obj):
|
||||||
|
print "PedView.home"
|
||||||
|
defperson = self.state.db.get_default_person()
|
||||||
|
if defperson:
|
||||||
|
self.state.change_active_person(defperson)
|
||||||
|
|
||||||
def edit_person_cb(self,obj):
|
def edit_person_cb(self,obj):
|
||||||
person_handle = obj.get_data(_PERSON)
|
person_handle = obj.get_data(_PERSON)
|
||||||
person = self.db.get_person_from_handle(person_handle)
|
person = self.db.get_person_from_handle(person_handle)
|
||||||
@ -362,6 +390,12 @@ class PedigreeView:
|
|||||||
return True
|
return True
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def on_show_option_menu_cb(self,obj,data=None):
|
||||||
|
myMenu = gtk.Menu()
|
||||||
|
self.add_settings_to_menu(myMenu)
|
||||||
|
myMenu.popup(None,None,None,0,0)
|
||||||
|
return(True);
|
||||||
|
|
||||||
def on_show_child_menu(self,obj):
|
def on_show_child_menu(self,obj):
|
||||||
"""User clicked button to move to child of active person"""
|
"""User clicked button to move to child of active person"""
|
||||||
|
|
||||||
@ -403,14 +437,14 @@ class PedigreeView:
|
|||||||
|
|
||||||
person_handle = obj.get_data(_PERSON)
|
person_handle = obj.get_data(_PERSON)
|
||||||
if person_handle:
|
if person_handle:
|
||||||
self.parent.emit("active-changed", (person_handle,))
|
self.state.change_active_handle(person_handle)
|
||||||
return 1
|
return True
|
||||||
return 0
|
return False
|
||||||
|
|
||||||
def change_force_size_cb(self,event,data):
|
def change_force_size_cb(self,event,data):
|
||||||
if data in [0,2,3,4,5]:
|
if data in [0,2,3,4,5]:
|
||||||
self.force_size = data
|
self.force_size = data
|
||||||
self.size_request_cb(self.parent_container,None) # switch to matching size
|
self.size_request_cb(self.notebook.parent,None) # switch to matching size
|
||||||
|
|
||||||
def find_tree(self,person,index,depth,lst,val=0):
|
def find_tree(self,person,index,depth,lst,val=0):
|
||||||
"""Recursively build a list of ancestors"""
|
"""Recursively build a list of ancestors"""
|
||||||
@ -446,14 +480,14 @@ class PedigreeView:
|
|||||||
to the context menu. Used by both build_nav_menu() and
|
to the context menu. Used by both build_nav_menu() and
|
||||||
build_full_nav_menu() methods.
|
build_full_nav_menu() methods.
|
||||||
"""
|
"""
|
||||||
back_sensitivity = self.parent.hindex > 0
|
#back_sensitivity = self.parent.hindex > 0
|
||||||
fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
#fwd_sensitivity = self.parent.hindex + 1 < len(self.parent.history)
|
||||||
entries = [
|
entries = [
|
||||||
(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
|
#(gtk.STOCK_GO_BACK,self.parent.back_clicked,back_sensitivity),
|
||||||
(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
|
#(gtk.STOCK_GO_FORWARD,self.parent.fwd_clicked,fwd_sensitivity),
|
||||||
#FIXME: revert to stock item when German gtk translation is fixed
|
#FIXME: revert to stock item when German gtk translation is fixed
|
||||||
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
#(gtk.STOCK_HOME,self.parent.on_home_clicked,1),
|
||||||
(_("Home"),self.parent.on_home_clicked,1),
|
(_("Home"),self.home,1),
|
||||||
(None,None,0),
|
(None,None,0),
|
||||||
#(_("Set anchor"),self.on_anchor_set,1),
|
#(_("Set anchor"),self.on_anchor_set,1),
|
||||||
#(_("Remove anchor"),self.on_anchor_removed,1),
|
#(_("Remove anchor"),self.on_anchor_removed,1),
|
||||||
@ -813,10 +847,10 @@ def build_detail_string(db,person):
|
|||||||
else:
|
else:
|
||||||
for event_ref in person.get_event_ref_list():
|
for event_ref in person.get_event_ref_list():
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
if event and event.get_name() == "Baptism":
|
if event and event.get_type()[0] == RelLib.Event.BAPTISM:
|
||||||
detail_text += format_event(db, _BAPT, event)
|
detail_text += format_event(db, _BAPT, event)
|
||||||
break
|
break
|
||||||
if event and event.get_name() == "Christening":
|
if event and event.get_type()[0] == RelLib.Event.CHRISTEN:
|
||||||
detail_text += format_event(db, _CHRI, event)
|
detail_text += format_event(db, _CHRI, event)
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -827,10 +861,10 @@ def build_detail_string(db,person):
|
|||||||
else:
|
else:
|
||||||
for event_ref in person.get_event_ref_list():
|
for event_ref in person.get_event_ref_list():
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
if event and event.get_name() == "Burial":
|
if event and event.get_type()[0] == RelLib.Event.BURIAL:
|
||||||
detail_text += format_event(db, _BURI, event)
|
detail_text += format_event(db, _BURI, event)
|
||||||
break
|
break
|
||||||
if event and event.get_name() == "Cremation":
|
if event and event.get_type()[0] == RelLib.Event.CREMATION:
|
||||||
detail_text += format_event(db, _CREM, event)
|
detail_text += format_event(db, _CREM, event)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
import gtk
|
import gtk
|
||||||
import ViewManager
|
import ViewManager
|
||||||
import PersonView
|
import PersonView
|
||||||
|
import PedView
|
||||||
import ArgHandler
|
import ArgHandler
|
||||||
import DisplayTrace
|
import DisplayTrace
|
||||||
import GrampsKeys
|
import GrampsKeys
|
||||||
@ -30,6 +31,7 @@ import GrampsCfg
|
|||||||
import const
|
import const
|
||||||
import Errors
|
import Errors
|
||||||
import PluginMgr
|
import PluginMgr
|
||||||
|
import TipOfDay
|
||||||
|
|
||||||
from GrampsMime import mime_type_is_defined
|
from GrampsMime import mime_type_is_defined
|
||||||
from QuestionDialog import ErrorDialog
|
from QuestionDialog import ErrorDialog
|
||||||
@ -37,13 +39,14 @@ from QuestionDialog import ErrorDialog
|
|||||||
import gnome
|
import gnome
|
||||||
|
|
||||||
|
|
||||||
iconpaths = ["/usr/share/gramps","~/devel/srcx"]
|
iconpaths = [".","/usr/share/gramps","~/devel/srcx"]
|
||||||
|
|
||||||
def register_stock_icons ():
|
def register_stock_icons ():
|
||||||
import os
|
import os
|
||||||
items = {
|
items = {
|
||||||
'people48.png': ('gramps-person', 'Person', gtk.gdk.CONTROL_MASK, 0, ''),
|
'people48.png': ('gramps-person', 'Person', gtk.gdk.CONTROL_MASK, 0, ''),
|
||||||
'family48.png': ('gramps-family', 'Family', gtk.gdk.CONTROL_MASK, 0, ''),
|
'family48.png': ('gramps-family', 'Family', gtk.gdk.CONTROL_MASK, 0, ''),
|
||||||
|
'ped24.png' : ('gramps-pedigree', 'Pedigree', gtk.gdk.CONTROL_MASK, 0, ''),
|
||||||
'repos.png' : ('gramps-repository', 'Repositories', gtk.gdk.CONTROL_MASK, 0, ''),
|
'repos.png' : ('gramps-repository', 'Repositories', gtk.gdk.CONTROL_MASK, 0, ''),
|
||||||
'sources.png' : ('gramps-source', 'Sources', gtk.gdk.CONTROL_MASK, 0, ''),
|
'sources.png' : ('gramps-source', 'Sources', gtk.gdk.CONTROL_MASK, 0, ''),
|
||||||
'events.png' : ('gramps-event', 'Events', gtk.gdk.CONTROL_MASK, 0, ''),
|
'events.png' : ('gramps-event', 'Events', gtk.gdk.CONTROL_MASK, 0, ''),
|
||||||
@ -182,6 +185,7 @@ class Gramps:
|
|||||||
register_stock_icons()
|
register_stock_icons()
|
||||||
a = ViewManager.ViewManager()
|
a = ViewManager.ViewManager()
|
||||||
a.register_view(PersonView.PersonView)
|
a.register_view(PersonView.PersonView)
|
||||||
|
a.register_view(PedView.PedView)
|
||||||
a.init_interface()
|
a.init_interface()
|
||||||
|
|
||||||
if GrampsKeys.get_usetips():
|
if GrampsKeys.get_usetips():
|
||||||
@ -249,8 +253,3 @@ class Gramps:
|
|||||||
self.toolbar.unset_style()
|
self.toolbar.unset_style()
|
||||||
else:
|
else:
|
||||||
self.toolbar.set_style(the_style)
|
self.toolbar.set_style(the_style)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user