lds status type to a constant

svn: r6268
This commit is contained in:
Don Allingham 2006-04-05 04:16:16 +00:00
parent a031cd0806
commit 050c4e3f08
7 changed files with 208 additions and 35 deletions

View File

@ -1,3 +1,11 @@
2006-04-04 Don Allingham <don@gramps-project.org>
* src/RelLib/_LdsOrd.py: lds status changes
* src/Editors/_EditLdsOrd.py: lds status changes
* src/DisplayTabs.py: lds status changes
* src/GrampsWidgets.py: lds status changes
* src/glade/gramps.glade: lds status changes
* src/lds.py: lds status changes
2006-04-04 Alex Roitman <shura@gramps-project.org>
* README, INSTALL: update.

View File

@ -1190,12 +1190,13 @@ class AddrEmbedList(EmbeddedList):
class LdsEmbedList(EmbeddedList):
_HANDLE_COL = 5
_DND_TYPE = DdTargets.ADDRESS
# _DND_TYPE = DdTargets.ADDRESS
_column_names = [
(_('Type'), 0, 150),
(_('Date'), 1, 150),
(_('Temple'), 2, 225),
(_('Status'), 3, 75),
(_('Temple'), 2, 200),
(_('Place'), 3, 100),
]
@ -1208,7 +1209,7 @@ class LdsEmbedList(EmbeddedList):
return self.data
def column_order(self):
return ((1,0),(1,1),(1,2),(1,3))
return ((1,0),(1,1),(1,2),(1,3),(1,4))
def add_button_clicked(self,obj):
lds = RelLib.LdsOrd()
@ -1930,14 +1931,17 @@ class LdsModel(gtk.ListStore):
self.db = db
for lds_ord in lds_list:
self.append(row=[
lds.ord_type[lds_ord.get_type()],
DateHandler.get_date(lds_ord),
lds_ord.get_status(),
lds_ord.get_temple(),
self.column_place(lds_ord),
lds_ord,
])
if not lds_ord:
print "BARF"
else:
self.append(row=[
lds.ord_type[lds_ord.get_type()],
DateHandler.get_date(lds_ord),
lds.ord_status[lds_ord.get_status()],
lds.temple_to_abrev[lds_ord.get_temple()],
self.column_place(lds_ord),
lds_ord,
])
def column_place(self, lds_ord):
if lds_ord:

View File

@ -67,6 +67,43 @@ class EditLdsOrd(EditSecondary):
"""
Displays a dialog that allows the user to edit an attribute.
"""
_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),
],
}
def __init__(self, state, uistate, track, attrib, callback):
"""
Displays the dialog box.
@ -90,6 +127,11 @@ class EditLdsOrd(EditSecondary):
self.define_ok_button(self.top.get_widget('ok'),self.save)
def _setup_fields(self):
self.parents_label = self.top.get_widget('parents_label')
self.parents = self.top.get_widget('parents')
self.parents_select = self.top.get_widget('parents_select')
self.priv = PrivacyButton(
self.top.get_widget("private"),
self.obj)
@ -113,7 +155,8 @@ class EditLdsOrd(EditSecondary):
[(_('Baptism'),RelLib.LdsOrd.BAPTISM),
(_('Endowment'),RelLib.LdsOrd.ENDOWMENT),
(_('Sealed to Parents'),RelLib.LdsOrd.SEAL_TO_PARENTS)],
self.db.readonly)
self.db.readonly,
changed=self.ord_type_changed)
temple_list = []
for val in lds.temple_codes.keys():
@ -126,6 +169,28 @@ class EditLdsOrd(EditSecondary):
temple_list,
self.db.readonly)
self.status_menu = MonitoredMenu(
self.top.get_widget('status'),
self.obj.set_status,
self.obj.get_status,
self._data_map[self.obj.get_type()],
self.db.readonly)
def ord_type_changed(self):
if self.obj.get_type() == RelLib.LdsOrd.BAPTISM:
self.parents.hide()
self.parents_label.hide()
self.parents_select.hide()
elif self.obj.get_type() == RelLib.LdsOrd.ENDOWMENT:
self.parents.hide()
self.parents_label.hide()
self.parents_select.hide()
elif self.obj.get_type() == RelLib.LdsOrd.SEAL_TO_PARENTS:
self.parents.show()
self.parents_label.show()
self.parents_select.show()
self.status_menu.change_menu(self._data_map[self.obj.get_type()])
def _create_tabbed_pages(self):
notebook = gtk.Notebook()
self.srcref_list = self._add_tab(

View File

@ -345,24 +345,42 @@ class MonitoredType:
class MonitoredMenu:
def __init__(self,obj,set_val,get_val,mapping,readonly=False):
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(get_val())
self.obj.set_active(self.data[get_val()])
self.obj.connect('changed',self.on_change)
self.obj.set_sensitive(not readonly)
def force(self,value):
self.obj.set_active(value)
def change_menu(self, mapping):
self.model = gtk.ListStore(str,int)
for t,v in mapping:
self.model.append(row=[t,v])
self.obj.set_model(self.model)
self.obj.set_active(0)
def on_change(self, obj):
print "ON CHANGE"
self.set_val(self.model.get_value(obj.get_active_iter(),1))
if self.changed:
print "CALL"
self.changed()
class MonitoredStrMenu:

View File

@ -52,6 +52,21 @@ class LdsOrd(SourceNote,DateBase,PlaceBase,PrivacyBase):
ENDOWMENT = 1
SEAL_TO_PARENTS = 2
SEAL_TO_SPOUSE = 3
STATUS_NONE = 0
STATUS_BIC = 1
STATUS_CANCELED = 2
STATUS_CHILD = 3
STATUS_CLEARED = 4
STATUS_COMPLETED = 5
STATUS_DNS = 6
STATUS_INFANT = 7
STATUS_PRE_1970 = 8
STATUS_QUALIFIED = 9
STATUS_DNS_CAN = 10
STATUS_STILLBORN = 11
STATUS_SUBMITTED = 12
STATUS_UNCLEARED = 13
def __init__(self,source=None):
"""Creates a LDS Ordinance instance"""

View File

@ -15401,7 +15401,7 @@ You should select parents before adding any new information. If you select paren
<widget class="GtkTable" id="table72">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">5</property>
<property name="n_rows">6</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -15429,8 +15429,8 @@ You should select parents before adding any new information. If you select paren
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -15458,8 +15458,8 @@ You should select parents before adding any new information. If you select paren
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -15481,8 +15481,8 @@ You should select parents before adding any new information. If you select paren
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
@ -15502,8 +15502,8 @@ You should select parents before adding any new information. If you select paren
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
@ -15532,8 +15532,8 @@ You should select parents before adding any new information. If you select paren
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options"></property>
<property name="y_options"></property>
</packing>
@ -15559,8 +15559,8 @@ You should select parents before adding any new information. If you select paren
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options"></property>
<property name="y_options">fill</property>
</packing>
@ -15660,7 +15660,7 @@ You should select parents before adding any new information. If you select paren
<child>
<widget class="GtkLabel" id="parents_label">
<property name="label" translatable="yes">Parents:</property>
<property name="label" translatable="yes">Family:</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@ -15678,8 +15678,8 @@ You should select parents before adding any new information. If you select paren
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -15705,15 +15705,15 @@ You should select parents before adding any new information. If you select paren
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkButton" id="parent_select">
<widget class="GtkButton" id="parents_select">
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
@ -15733,12 +15733,58 @@ You should select parents before adding any new information. If you select paren
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label647">
<property name="visible">True</property>
<property name="label" translatable="yes">_Status:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">1</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="status">
<property name="visible">True</property>
<property name="items" translatable="yes">
</property>
<property name="add_tearoffs">False</property>
<property name="focus_on_click">True</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>

View File

@ -191,6 +191,23 @@ ord_type = {
3 : _('Sealed to Spouse'),
}
ord_status = [
_("<No Status>"),
_("BIC"),
_("Canceled"),
_("Child"),
_("Cleared"),
_("Completed"),
_("DNS"),
_("Infant"),
_("Pre-1970"),
_("Qualified"),
_("DNS/CAN"),
_("Stillborn"),
_("Submitted"),
_("Uncleared"),
]
status = {
"BIC" : 1, "CANCELED" : 1, "CHILD" : 1,
"CLEARED" : 2, "COMPLETED" : 3, "DNS" : 4,