2006-05-06 Don Allingham <don@gramps-project.org>

* src/DisplayTabs/_SourceEmbedList.py: fix icon
	* src/DisplayState.py: add relationship calculator option to statusbar



svn: r6566
This commit is contained in:
Don Allingham 2006-05-06 22:49:51 +00:00
parent d12ed55a69
commit ded50afd83
3 changed files with 52 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2006-05-06 Don Allingham <don@gramps-project.org>
* src/DisplayTabs/_SourceEmbedList.py: fix icon
* src/DisplayState.py: add relationship calculator option to statusbar
2006-05-05 Don Allingham <don@gramps-project.org> 2006-05-05 Don Allingham <don@gramps-project.org>
* src/DisplayTabs/_WebEmbedList.py: new icon * src/DisplayTabs/_WebEmbedList.py: new icon

View File

@ -255,7 +255,8 @@ class DisplayState(GrampsDb.GrampsDBCallback):
__signals__ = { __signals__ = {
} }
def __init__(self,window,status,progress,warnbtn,uimanager,dbstate): def __init__(self, window, status, progress, warnbtn, uimanager, dbstate):
self.dbstate = dbstate self.dbstate = dbstate
self.uimanager = uimanager self.uimanager = uimanager
self.window = window self.window = window
@ -274,6 +275,29 @@ class DisplayState(GrampsDb.GrampsDBCallback):
self.log = logging.getLogger() self.log = logging.getLogger()
self.log.setLevel(logging.WARN) self.log.setLevel(logging.WARN)
self.log.addHandler(self.rh) self.log.addHandler(self.rh)
self.dbstate.connect('database-changed', self.db_changed)
def db_changed(self, db):
from PluginUtils import _PluginMgr
self.relationship = _PluginMgr.relationship_class(db)
def display_relationship(self):
default_person = self.dbstate.db.get_default_person()
active = self.dbstate.get_active_person()
if default_person == None or active == None:
return u''
pname = NameDisplay.displayer.display(default_person)
(name,plist) = self.relationship.get_relationship(
default_person,active)
if name:
if plist == None:
return name
return _("%(relationship)s of %(person)s") % {
'relationship' : name, 'person' : pname }
else:
return u""
def clear_history(self): def clear_history(self):
self.phistory.clear() self.phistory.clear()
@ -306,7 +330,7 @@ class DisplayState(GrampsDb.GrampsDBCallback):
pname = NameDisplay.displayer.display(person) pname = NameDisplay.displayer.display(person)
name = "[%s] %s" % (person.get_gramps_id(),pname) name = "[%s] %s" % (person.get_gramps_id(),pname)
else: else:
name = "" #self.display_relationship() name = self.display_relationship()
self.status.push(self.status_id,name) self.status.push(self.status_id,name)
while gtk.events_pending(): while gtk.events_pending():

View File

@ -69,7 +69,7 @@ class SourceEmbedList(EmbeddedList):
_('Sources'), SourceRefModel, True) _('Sources'), SourceRefModel, True)
def get_icon_name(self): def get_icon_name(self):
return 'gramps-event' return 'gramps-source'
def get_data(self): def get_data(self):
return self.obj return self.obj
@ -83,24 +83,39 @@ class SourceEmbedList(EmbeddedList):
try: try:
from Editors import EditSourceRef from Editors import EditSourceRef
EditSourceRef(self.dbstate, self.uistate, self.track, EditSourceRef(
src, sref, self.add_callback) self.dbstate,
self.uistate,
self.track,
src,
sref,
self.add_callback)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass
def share_button_clicked(self, obj): def share_button_clicked(self, obj):
import SelectSource import SelectSource
sel = SelectSource.SelectSource(self.dbstate,self.uistate,self.track, sel = SelectSource.SelectSource(
self.dbstate,
self.uistate,
self.track,
_("Select source")) _("Select source"))
src = sel.run() src = sel.run()
if src: if src:
try: try:
from Editors import EditSourceRef from Editors import EditSourceRef
ref = RelLib.SourceRef() ref = RelLib.SourceRef()
EditSourceRef(self.dbstate, self.uistate, self.track, EditSourceRef(self.dbstate,
src, ref, self.add_callback) self.uistate,
self.track,
src,
ref,
self.add_callback)
except Errors.WindowActiveError: except Errors.WindowActiveError:
pass pass