diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 4f66e9e25..34f324f30 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,11 @@ +2006-04-04 Don Allingham + * 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 * README, INSTALL: update. diff --git a/gramps2/src/DisplayTabs.py b/gramps2/src/DisplayTabs.py index 300b7f0b9..02c928a02 100644 --- a/gramps2/src/DisplayTabs.py +++ b/gramps2/src/DisplayTabs.py @@ -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: diff --git a/gramps2/src/Editors/_EditLdsOrd.py b/gramps2/src/Editors/_EditLdsOrd.py index 4b95fe839..7db9300d5 100644 --- a/gramps2/src/Editors/_EditLdsOrd.py +++ b/gramps2/src/Editors/_EditLdsOrd.py @@ -67,6 +67,43 @@ class EditLdsOrd(EditSecondary): """ Displays a dialog that allows the user to edit an attribute. """ + + _data_map = { + RelLib.LdsOrd.BAPTISM : [(_(""), 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: [(_(""), 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:[(_(""), 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( diff --git a/gramps2/src/GrampsWidgets.py b/gramps2/src/GrampsWidgets.py index 3fc65489b..2b4d2de71 100644 --- a/gramps2/src/GrampsWidgets.py +++ b/gramps2/src/GrampsWidgets.py @@ -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: diff --git a/gramps2/src/RelLib/_LdsOrd.py b/gramps2/src/RelLib/_LdsOrd.py index dcc9bf2f0..08a9c48f9 100644 --- a/gramps2/src/RelLib/_LdsOrd.py +++ b/gramps2/src/RelLib/_LdsOrd.py @@ -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""" diff --git a/gramps2/src/glade/gramps.glade b/gramps2/src/glade/gramps.glade index cc2ba58e2..edc1cebf7 100644 --- a/gramps2/src/glade/gramps.glade +++ b/gramps2/src/glade/gramps.glade @@ -15401,7 +15401,7 @@ You should select parents before adding any new information. If you select paren 12 True - 5 + 6 3 False 6 @@ -15429,8 +15429,8 @@ You should select parents before adding any new information. If you select paren 0 1 - 2 - 3 + 3 + 4 fill @@ -15458,8 +15458,8 @@ You should select parents before adding any new information. If you select paren 0 1 - 3 - 4 + 4 + 5 fill @@ -15481,8 +15481,8 @@ You should select parents before adding any new information. If you select paren 1 2 - 2 - 3 + 3 + 4 @@ -15502,8 +15502,8 @@ You should select parents before adding any new information. If you select paren 1 2 - 3 - 4 + 4 + 5 @@ -15532,8 +15532,8 @@ You should select parents before adding any new information. If you select paren 2 3 - 3 - 4 + 4 + 5 @@ -15559,8 +15559,8 @@ You should select parents before adding any new information. If you select paren 2 3 - 2 - 3 + 3 + 4 fill @@ -15660,7 +15660,7 @@ You should select parents before adding any new information. If you select paren - Parents: + Family: False False GTK_JUSTIFY_LEFT @@ -15678,8 +15678,8 @@ You should select parents before adding any new information. If you select paren 0 1 - 4 - 5 + 5 + 6 fill @@ -15705,15 +15705,15 @@ You should select parents before adding any new information. If you select paren 1 2 - 4 - 5 + 5 + 6 fill - + True GTK_RELIEF_NONE True @@ -15733,12 +15733,58 @@ You should select parents before adding any new information. If you select paren 2 3 - 4 - 5 + 5 + 6 fill + + + + True + _Status: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + + + False + True + + + 1 + 2 + 2 + 3 + fill + fill + + 0 diff --git a/gramps2/src/lds.py b/gramps2/src/lds.py index 45d898748..b78454756 100644 --- a/gramps2/src/lds.py +++ b/gramps2/src/lds.py @@ -191,6 +191,23 @@ ord_type = { 3 : _('Sealed to Spouse'), } +ord_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,