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>
* src/DisplayTabs/_WebEmbedList.py: new icon

View File

@ -256,6 +256,7 @@ class DisplayState(GrampsDb.GrampsDBCallback):
}
def __init__(self, window, status, progress, warnbtn, uimanager, dbstate):
self.dbstate = dbstate
self.uimanager = uimanager
self.window = window
@ -274,6 +275,29 @@ class DisplayState(GrampsDb.GrampsDBCallback):
self.log = logging.getLogger()
self.log.setLevel(logging.WARN)
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):
self.phistory.clear()
@ -306,7 +330,7 @@ class DisplayState(GrampsDb.GrampsDBCallback):
pname = NameDisplay.displayer.display(person)
name = "[%s] %s" % (person.get_gramps_id(),pname)
else:
name = "" #self.display_relationship()
name = self.display_relationship()
self.status.push(self.status_id,name)
while gtk.events_pending():

View File

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