* src/Editors/_EditLdsOrd.py (EditLdsOrd): Formatting.

* src/GrampsWidgets.py (MonitoredMenu): Factor out commong code.


svn: r6280
This commit is contained in:
Alex Roitman 2006-04-06 21:28:19 +00:00
parent bc96c75e39
commit 1d24bc8f13
3 changed files with 49 additions and 46 deletions

View File

@ -1,3 +1,7 @@
2006-04-06 Alex Roitman <shura@gramps-project.org>
* src/Editors/_EditLdsOrd.py (EditLdsOrd): Formatting.
* src/GrampsWidgets.py (MonitoredMenu): Factor out commong code.
2006-04-06 Don Allingham <don@gramps-project.org>
* src/RecentFiles.py: check for a files' existence before adding
to the list.

View File

@ -70,39 +70,42 @@ class EditLdsOrd(EditSecondary):
"""
_data_map = {
RelLib.LdsOrd.BAPTISM : [(_("<No Status>"), RelLib.LdsOrd.STATUS_NONE),
(_("Child"), RelLib.LdsOrd.STATUS_CHILD),
(_("Cleared"), RelLib.LdsOrd.STATUS_CLEARED),
(_("Completed"), RelLib.LdsOrd.STATUS_COMPLETED),
(_("Infant"), RelLib.LdsOrd.STATUS_INFANT),
(_("Pre-1970"), RelLib.LdsOrd.STATUS_PRE_1970),
(_("Qualified"), RelLib.LdsOrd.STATUS_QUALIFIED),
(_("Stillborn"), RelLib.LdsOrd.STATUS_STILLBORN),
(_("Submitted"), RelLib.LdsOrd.STATUS_SUBMITTED),
(_("Uncleared"), RelLib.LdsOrd.STATUS_UNCLEARED),
],
RelLib.LdsOrd.ENDOWMENT: [(_("<No Status>"), RelLib.LdsOrd.STATUS_NONE),
(_("Child"), RelLib.LdsOrd.STATUS_CHILD),
(_("Cleared"), RelLib.LdsOrd.STATUS_CLEARED),
(_("Completed"), RelLib.LdsOrd.STATUS_COMPLETED),
(_("Infant"), RelLib.LdsOrd.STATUS_INFANT),
(_("Pre-1970"), RelLib.LdsOrd.STATUS_PRE_1970),
(_("Qualified"), RelLib.LdsOrd.STATUS_QUALIFIED),
(_("Stillborn"), RelLib.LdsOrd.STATUS_STILLBORN),
(_("Submitted"), RelLib.LdsOrd.STATUS_SUBMITTED),
(_("Uncleared"), RelLib.LdsOrd.STATUS_UNCLEARED),
],
RelLib.LdsOrd.SEAL_TO_PARENTS:[(_("<No Status>"), RelLib.LdsOrd.STATUS_NONE),
(_("BIC"), RelLib.LdsOrd.STATUS_BIC),
(_("Cleared"), RelLib.LdsOrd.STATUS_CLEARED),
(_("Completed"), RelLib.LdsOrd.STATUS_COMPLETED),
(_("DNS"), RelLib.LdsOrd.STATUS_DNS),
(_("Pre-1970"), RelLib.LdsOrd.STATUS_PRE_1970),
(_("Qualified"), RelLib.LdsOrd.STATUS_QUALIFIED),
(_("Stillborn"), RelLib.LdsOrd.STATUS_STILLBORN),
(_("Submitted"), RelLib.LdsOrd.STATUS_SUBMITTED),
(_("Uncleared"), RelLib.LdsOrd.STATUS_UNCLEARED),
],
RelLib.LdsOrd.BAPTISM : [
(_("<No Status>"), RelLib.LdsOrd.STATUS_NONE),
(_("Child"), RelLib.LdsOrd.STATUS_CHILD),
(_("Cleared"), RelLib.LdsOrd.STATUS_CLEARED),
(_("Completed"), RelLib.LdsOrd.STATUS_COMPLETED),
(_("Infant"), RelLib.LdsOrd.STATUS_INFANT),
(_("Pre-1970"), RelLib.LdsOrd.STATUS_PRE_1970),
(_("Qualified"), RelLib.LdsOrd.STATUS_QUALIFIED),
(_("Stillborn"), RelLib.LdsOrd.STATUS_STILLBORN),
(_("Submitted"), RelLib.LdsOrd.STATUS_SUBMITTED),
(_("Uncleared"), RelLib.LdsOrd.STATUS_UNCLEARED),
],
RelLib.LdsOrd.ENDOWMENT: [
(_("<No Status>"), RelLib.LdsOrd.STATUS_NONE),
(_("Child"), RelLib.LdsOrd.STATUS_CHILD),
(_("Cleared"), RelLib.LdsOrd.STATUS_CLEARED),
(_("Completed"), RelLib.LdsOrd.STATUS_COMPLETED),
(_("Infant"), RelLib.LdsOrd.STATUS_INFANT),
(_("Pre-1970"), RelLib.LdsOrd.STATUS_PRE_1970),
(_("Qualified"), RelLib.LdsOrd.STATUS_QUALIFIED),
(_("Stillborn"), RelLib.LdsOrd.STATUS_STILLBORN),
(_("Submitted"), RelLib.LdsOrd.STATUS_SUBMITTED),
(_("Uncleared"), RelLib.LdsOrd.STATUS_UNCLEARED),
],
RelLib.LdsOrd.SEAL_TO_PARENTS:[
(_("<No Status>"), RelLib.LdsOrd.STATUS_NONE),
(_("BIC"), RelLib.LdsOrd.STATUS_BIC),
(_("Cleared"), RelLib.LdsOrd.STATUS_CLEARED),
(_("Completed"), RelLib.LdsOrd.STATUS_COMPLETED),
(_("DNS"), RelLib.LdsOrd.STATUS_DNS),
(_("Pre-1970"), RelLib.LdsOrd.STATUS_PRE_1970),
(_("Qualified"), RelLib.LdsOrd.STATUS_QUALIFIED),
(_("Stillborn"), RelLib.LdsOrd.STATUS_STILLBORN),
(_("Submitted"), RelLib.LdsOrd.STATUS_SUBMITTED),
(_("Uncleared"), RelLib.LdsOrd.STATUS_UNCLEARED),
],
}
def __init__(self, state, uistate, track, attrib, callback):

View File

@ -345,23 +345,15 @@ class MonitoredType:
class MonitoredMenu:
def __init__(self, obj, set_val, get_val, mapping, readonly=False, changed=None):
def __init__(self, obj, set_val, get_val, mapping,
readonly=False, changed=None):
self.set_val = set_val
self.get_val = get_val
self.changed = changed
self.obj = obj
self.model = gtk.ListStore(str, int)
self.data = {}
index = 0
for t, v in mapping:
self.model.append(row=[t, v])
self.data[v] = index
index += 1
self.obj.set_model(self.model)
self.obj.set_active(self.data[get_val()])
self.change_menu(mapping)
self.obj.connect('changed', self.on_change)
self.obj.set_sensitive(not readonly)
@ -369,11 +361,15 @@ class MonitoredMenu:
self.obj.set_active(value)
def change_menu(self, mapping):
self.data = {}
self.model = gtk.ListStore(str, int)
index = 0
for t, v in mapping:
self.model.append(row=[t, v])
self.data[v] = index
index += 1
self.obj.set_model(self.model)
self.obj.set_active(0)
self.obj.set_active(self.data.get(self.get_val(),0))
def on_change(self, obj):
self.set_val(self.model.get_value(obj.get_active_iter(), 1))