From 378f986dac174d26b27c634a6bec8b5acc9e44a0 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 29 Jul 2001 06:06:16 +0000 Subject: [PATCH] Improved Edit Person window, support for private records and confidence levels svn: r264 --- src/EditPerson.glade | 3719 ++++++++++++++++++++++++++++++++---------- src/EditPerson.py | 857 ++++++++-- src/GrampsParser.py | 22 +- src/RelLib.py | 191 ++- src/WriteXML.py | 83 +- src/const.py | 13 + src/gramps_main.py | 15 +- 7 files changed, 3809 insertions(+), 1091 deletions(-) diff --git a/src/EditPerson.glade b/src/EditPerson.glade index b7da4789c..afc9c2f7f 100644 --- a/src/EditPerson.glade +++ b/src/EditPerson.glade @@ -1093,225 +1093,234 @@ 0 - GtkTable - table10 - 3 - 3 - False - 0 - 0 + GtkFrame + name_frame + 5 + + 0 + GTK_SHADOW_ETCHED_IN - 0 + 5 False True - GtkLabel - label121 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 1 - 2 + GtkTable + table10 + 4 + 2 + False + 0 + 0 + + + GtkLabel + label121 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label120 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label129 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + alt_given + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - False - - + + 1 + 2 + 0 + 1 + 3 + 3 + True + False + False + False + True + False + + - - GtkLabel - label120 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 0 - 1 + + GtkLabel + alt_last + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - False - - + + 1 + 2 + 1 + 2 + 3 + 3 + False + False + False + False + True + False + + - - GtkEntry - alt_last - True - True - True - 0 - - - 1 - 2 - 1 - 2 - 5 - 5 - True - False - False - False - True - False - - - - - GtkEntry - alt_given - True - True - True - 0 - - - 1 - 2 - 0 - 1 - 5 - 5 - True - False - False - False - True - False - - - - - GtkEntry - alt_suffix - True - True - True - 0 - - - 1 - 2 - 2 - 3 - 5 - 5 - True - False - False - False - True - False - - - - - GtkLabel - label129 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 2 - 3 + + GtkLabel + alt_suffix + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - False - - + + 1 + 2 + 2 + 3 + 3 + 3 + False + False + False + False + True + False + + - - GtkButton - name_source - Edit source information for the highlighted name - True - - clicked - on_showsource_clicked - nameList - Sat, 16 Jun 2001 02:32:54 GMT - - - GTK_RELIEF_NORMAL - - 2 - 3 - 0 - 1 + + GtkLabel + label168 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 5 - 0 - False - False - False - False - True - False - - + 3 + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + - - GtkButton - name_note - Edit note information for the highlighted name - True - - clicked - on_event_note_clicked - nameList - Sat, 16 Jun 2001 02:34:02 GMT - - - GTK_RELIEF_NORMAL - - 2 - 3 - 1 - 2 - 5 + + GtkLabel + name_details + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 0 - False - False - False - False - True - False - + + 1 + 2 + 3 + 4 + 3 + 3 + False + False + False + False + True + False + + @@ -1412,7 +1421,7 @@ nameList Mon, 18 Dec 2000 22:36:30 GMT - + GTK_RELIEF_NORMAL @@ -1785,8 +1794,8 @@ 30 85 27 - 2 - 2 + 7 + 0 0 False @@ -1875,187 +1884,130 @@ - GtkTable - table12 - 2 - 3 - False - 0 - 0 + GtkFrame + attr_type + 5 + + 0 + GTK_SHADOW_ETCHED_IN - 0 + 5 False - True + False - GtkLabel - label132 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 8 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label133 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 8 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkCombo - attribute - False - True - False - True - False - - - 1 - 2 - 0 - 1 - 3 - 3 - True - False - False - False - True - False - + GtkTable + table24 + 2 + 2 + False + 0 + 0 - GtkEntry - GtkCombo:entry - attr_type - True - True - True - 0 - - - - - - GtkEntry - attr_value - True - True - True - 0 - - - 1 - 2 - 1 - 2 - 3 + GtkLabel + label196 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 3 - True - False - False - False - True - False - - + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + - - GtkButton - attr_source - Edit source information for the highlighted attribute - True - - clicked - on_showsource_clicked - attr_list - Thu, 11 Jan 2001 04:08:33 GMT - - - GTK_RELIEF_NORMAL - - 2 - 3 - 0 - 1 - 5 + + GtkLabel + attr_value + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 0 - False - False - False - False - True - False - - + + 1 + 2 + 0 + 1 + 3 + 3 + True + False + False + False + True + False + + - - GtkButton - attr_note - Edit note information for the highlighted attribute - True - - clicked - on_event_note_clicked - attr_list - Tue, 29 May 2001 15:26:54 GMT - - - GTK_RELIEF_NORMAL - - 2 - 3 - 1 - 2 + + GtkLabel + label201 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 5 + 3 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + attr_details + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 0 - False - False - False - False - True - False - + + 1 + 2 + 1 + 2 + 3 + 3 + False + False + False + False + True + False + + @@ -2135,8 +2087,8 @@ 30 85 27 - 2 - 2 + 7 + 0 0 False @@ -2171,7 +2123,7 @@ attr_list Tue, 01 May 2001 17:26:20 GMT - + GTK_RELIEF_NORMAL @@ -2214,375 +2166,390 @@ 0 - GtkTable - table20 - 4 - 5 - False - 0 - 0 + GtkFrame + address_label + 5 + + 0 + GTK_SHADOW_ETCHED_IN - 0 + 5 False - True + False - GtkLabel - label142 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 8 - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - - + GtkTable + table20 + 5 + 4 + False + 0 + 0 - - GtkLabel - label143 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 8 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label141 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 8 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label140 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 8 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - country - True - True - True - 0 - - - 1 - 2 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - city - True - True - True - 0 - - - 1 - 2 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkLabel - label148 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 2 - 3 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label149 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 2 - 3 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - address_start - True - True - True - 0 - - - 1 - 4 - 0 - 1 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - street - True - True - True - 0 - - - 1 - 4 - 1 - 2 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - state - True - True - True - 0 - - - 3 - 4 - 2 - 3 - 0 - 0 - True - False - False - False - True - False - - - - - GtkEntry - postal - True - True - True - 0 - - - 3 - 4 - 3 - 4 - 0 - 0 - True - False - False - False - True - False - - - - - GtkButton - addr_source - Edit source information for the highlighted address - True - - clicked - on_showsource_clicked - address_list - Thu, 11 Jan 2001 04:08:33 GMT - - - GTK_RELIEF_NORMAL - - 4 - 5 - 0 - 1 + + GtkLabel + label142 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 5 0 - False - False - True - False - False - False - - + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + - - GtkButton - addr_note - Edit note information for the highlighted address - True - - clicked - on_event_note_clicked - address_list - Tue, 29 May 2001 15:27:27 GMT - - - GTK_RELIEF_NORMAL - - 4 - 5 - 1 - 2 + + GtkLabel + label143 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 5 0 - False - False - False - False - True - False - + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label141 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label140 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label148 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 2 + 3 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label149 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 2 + 3 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + street + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 + + 1 + 4 + 1 + 2 + 3 + 3 + True + False + False + False + True + False + + + + + GtkLabel + address_start + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 + + 1 + 4 + 0 + 1 + 3 + 3 + True + False + False + False + True + False + + + + + GtkLabel + city + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 2 + 3 + 3 + 3 + True + False + False + False + True + False + + + + + GtkLabel + postal + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 3 + 3 + + 3 + 4 + 3 + 4 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + state + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 3 + 3 + + 3 + 4 + 2 + 3 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + label193 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + addr_details + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 3 + 3 + + 1 + 4 + 4 + 5 + 3 + 3 + False + False + False + False + True + False + + + + + GtkLabel + country + + GTK_JUSTIFY_LEFT + False + 0 + 0.5 + 3 + 3 + + 1 + 2 + 3 + 4 + 3 + 3 + False + False + False + False + True + False + + @@ -2673,8 +2640,8 @@ 30 85 27 - 2 - 2 + 7 + 0 0 False @@ -2709,7 +2676,7 @@ address_list Tue, 01 May 2001 14:13:02 GMT - + GTK_RELIEF_NORMAL @@ -2830,7 +2797,7 @@ 7 0 - 5 + 0 False True @@ -2902,145 +2869,161 @@ 0 - GtkTable - table11 - 2 - 3 - False - 0 - 0 + GtkFrame + frame10 + 5 + + 0 + GTK_SHADOW_ETCHED_IN - 10 + 5 False - True + False - GtkLabel - label127 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 0 - 1 + GtkTable + table25 + 2 + 2 + False + 0 + 0 + + + GtkLabel + label203 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label204 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 0 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + url_des + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 0 0 - False - False - False - False - True - False - - + + 1 + 2 + 1 + 2 + 3 + 3 + False + False + False + False + True + False + + - - GtkEntry - web_description - True - True - True - 0 - - - 1 - 2 - 1 - 2 - 5 - 5 - True - False - False - False - True - False - - + + GtkHBox + hbox29 + False + 0 + + 1 + 2 + 0 + 1 + 3 + 3 + True + False + False + False + True + True + - - GtkEntry - web_url - True - True - True - 0 - - - 1 - 2 - 0 - 1 - 5 - 5 - True - False - False - False - True - False - - + + GtkLabel + url_addr + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + True + True + + - - GtkLabel - label128 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 5 - - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkButton - browse - True - - clicked - on_browse_clicked - web_url - Tue, 24 Apr 2001 14:16:09 GMT - - - GTK_RELIEF_NORMAL - - 2 - 3 - 0 - 1 - 10 - 0 - False - False - False - False - False - False - + + GtkButton + browse + True + + clicked + on_browse_clicked + web_url + Tue, 24 Apr 2001 14:16:09 GMT + + + GTK_RELIEF_NORMAL + + 5 + False + False + + + @@ -3141,7 +3124,7 @@ web_list Tue, 24 Apr 2001 13:49:14 GMT - + GTK_RELIEF_NORMAL @@ -3378,7 +3361,7 @@ GtkTable table21 - 6 + 7 2 False 0 @@ -3659,8 +3642,8 @@ 1 2 - 5 - 6 + 6 + 7 3 3 False @@ -3693,8 +3676,8 @@ 0 1 - 5 - 6 + 6 + 7 0 0 False @@ -3762,6 +3745,1998 @@ + + + GtkLabel + label178 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 5 + 6 + 0 + 0 + False + False + False + False + True + False + + + + + GtkHBox + hbox24 + False + 0 + + 1 + 2 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + + + + GtkOptionMenu + conf + True + Very Low +Low +Normal +High +Very High + + 0 + + 3 + True + True + + + + + GtkCheckButton + priv + True + + False + True + + 5 + False + False + + + + + + + + + + GtkDialog + attr_edit + Gramps - Attribute Editor + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + True + False + + + GtkVBox + Dialog:vbox + vbox30 + False + 0 + + + GtkHBox + Dialog:action_area + hbox22 + 10 + True + 5 + + 0 + False + True + GTK_PACK_END + + + + GtkHButtonBox + hbuttonbox19 + GTK_BUTTONBOX_END + 30 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + button115 + True + True + + clicked + on_attr_edit_ok_clicked + attr_edit + Sat, 28 Jul 2001 16:26:27 GMT + + GNOME_STOCK_BUTTON_OK + GTK_RELIEF_NORMAL + + + + GtkButton + button116 + True + True + + clicked + destroy_passed_object + attr_edit + Thu, 26 Jul 2001 19:16:49 GMT + + GNOME_STOCK_BUTTON_CANCEL + GTK_RELIEF_NORMAL + + + + + + GtkVBox + vbox31 + False + 0 + + 0 + True + True + + + + GtkLabel + attrTitle + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 10 + + 0 + False + False + + + + + GtkHSeparator + hseparator2 + + 0 + False + True + + + + + GtkTable + table22 + 5 + 2 + False + 0 + 0 + + 0 + True + True + + + + GtkLabel + label171 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label172 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label175 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkCombo + attr_menu + False + True + False + True + False + + + 1 + 2 + 0 + 1 + 3 + 3 + True + False + False + False + True + False + + + + GtkEntry + GtkCombo:entry + attr_type + True + True + True + 0 + + + + + + GtkEntry + attr_value + True + True + True + 0 + + + 1 + 2 + 1 + 2 + 3 + 3 + True + False + False + False + True + False + + + + + GtkScrolledWindow + scrolledwindow22 + 400 + 150 + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 1 + 2 + 4 + 5 + 3 + 3 + False + True + False + False + True + True + + + + GtkText + attr_note + True + True + + + + + + GtkLabel + label176 + + GTK_JUSTIFY_CENTER + False + 1 + 0 + 5 + 8 + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + + + + + GtkHBox + hbox23 + False + 0 + + 1 + 2 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + + + GtkEntry + attr_source + True + False + True + 0 + + + 3 + True + True + + + + + GtkButton + button117 + 3 + Edit source information for the highlighted event + True + + clicked + on_source_clicked + attr_edit + Fri, 27 Jul 2001 01:05:33 GMT + + + GTK_RELIEF_NORMAL + + 3 + False + False + + + + + + GtkLabel + label177 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + + + + GtkHBox + hbox25 + False + 0 + + 1 + 2 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + GtkOptionMenu + conf + True + Very Low +Low +Normal +High +Very High + + 0 + + 3 + True + True + + + + + GtkCheckButton + priv + True + + False + True + + 5 + False + False + + + + + + + + + + GtkDialog + name_edit + Gramps - Alternate Name Editor + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + True + False + + + GtkVBox + Dialog:vbox + vbox32 + False + 0 + + + GtkHBox + Dialog:action_area + hbox26 + 10 + True + 5 + + 0 + False + True + GTK_PACK_END + + + + GtkHButtonBox + hbuttonbox20 + GTK_BUTTONBOX_END + 30 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + button118 + True + True + + clicked + on_name_edit_ok_clicked + name_edit + Sat, 28 Jul 2001 21:08:16 GMT + + GNOME_STOCK_BUTTON_OK + GTK_RELIEF_NORMAL + + + + GtkButton + button119 + True + True + + clicked + destroy_passed_object + name_edit + Thu, 26 Jul 2001 19:16:49 GMT + + GNOME_STOCK_BUTTON_CANCEL + GTK_RELIEF_NORMAL + + + + + + GtkVBox + vbox33 + False + 0 + + 0 + True + True + + + + GtkLabel + altTitle + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 10 + + 0 + False + False + + + + + GtkHSeparator + hseparator3 + + 0 + False + True + + + + + GtkTable + table23 + 6 + 2 + False + 0 + 0 + + 0 + True + True + + + + GtkLabel + label180 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label181 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label182 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + alt_last + True + True + True + 0 + + + 1 + 2 + 1 + 2 + 3 + 3 + True + False + False + False + True + False + + + + + GtkScrolledWindow + scrolledwindow23 + 400 + 150 + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 1 + 2 + 5 + 6 + 3 + 3 + False + True + False + False + True + True + + + + GtkText + alt_note + True + True + + + + + + GtkLabel + label183 + + GTK_JUSTIFY_CENTER + False + 1 + 0 + 5 + 8 + + 0 + 1 + 5 + 6 + 0 + 0 + False + False + False + False + True + True + + + + + GtkHBox + hbox27 + False + 0 + + 1 + 2 + 3 + 4 + 0 + 0 + False + False + False + False + True + True + + + + GtkEntry + alt_source + True + False + True + 0 + + + 3 + True + True + + + + + GtkButton + button120 + 3 + Edit source information for the highlighted event + True + + clicked + on_source_clicked + name_edit + Fri, 27 Jul 2001 01:05:33 GMT + + + GTK_RELIEF_NORMAL + + 3 + False + False + + + + + + GtkLabel + label184 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + False + + + + + GtkHBox + hbox28 + False + 0 + + 1 + 2 + 4 + 5 + 0 + 0 + False + False + False + False + True + True + + + + GtkOptionMenu + conf + True + Very Low +Low +Normal +High +Very High + + 2 + + 3 + True + True + + + + + GtkCheckButton + priv + True + + False + True + + 5 + False + False + + + + + + GtkLabel + label186 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + alt_suffix + True + True + True + 0 + + + 1 + 2 + 2 + 3 + 3 + 3 + True + False + False + False + True + False + + + + + GtkCombo + alt_surname_list + False + True + False + True + False + + + 1 + 2 + 0 + 1 + 3 + 3 + True + False + False + False + True + False + + + + GtkEntry + GtkCombo:entry + alt_given + True + True + True + 0 + + + + + + + + + + GtkDialog + addr_edit + Gramps - Address Editor + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + True + False + + + GtkVBox + Dialog:vbox + vbox34 + False + 0 + + + GtkHBox + Dialog:action_area + hbox30 + 10 + True + 5 + + 0 + False + True + GTK_PACK_END + + + + GtkHButtonBox + hbuttonbox21 + GTK_BUTTONBOX_END + 30 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + button121 + True + True + + clicked + on_addr_edit_ok_clicked + addr_edit + Sat, 28 Jul 2001 22:35:30 GMT + + GNOME_STOCK_BUTTON_OK + GTK_RELIEF_NORMAL + + + + GtkButton + button122 + True + True + + clicked + destroy_passed_object + addr_edit + Thu, 26 Jul 2001 19:16:49 GMT + + GNOME_STOCK_BUTTON_CANCEL + GTK_RELIEF_NORMAL + + + + + + GtkVBox + vbox35 + False + 0 + + 0 + True + True + + + + GtkLabel + addrTitle + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 10 + + 0 + False + False + + + + + GtkHSeparator + hseparator4 + + 0 + False + True + + + + + GtkTable + table26 + 9 + 2 + False + 0 + 0 + + 0 + True + True + + + + GtkLabel + label209 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label210 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label211 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 6 + 7 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + street + True + True + True + 0 + + + 1 + 2 + 1 + 2 + 3 + 3 + True + False + False + False + True + False + + + + + GtkScrolledWindow + scrolledwindow24 + 400 + 150 + GTK_POLICY_NEVER + GTK_POLICY_ALWAYS + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 1 + 2 + 8 + 9 + 3 + 3 + False + True + False + False + True + True + + + + GtkText + addr_note + True + True + + + + + + GtkLabel + label212 + + GTK_JUSTIFY_CENTER + False + 1 + 0 + 5 + 8 + + 0 + 1 + 8 + 9 + 0 + 0 + False + False + False + False + True + True + + + + + GtkHBox + hbox31 + False + 0 + + 1 + 2 + 6 + 7 + 0 + 0 + False + False + False + False + True + True + + + + GtkEntry + addr_source + True + False + True + 0 + + + 3 + True + True + + + + + GtkButton + button123 + 3 + Edit source information for the highlighted event + True + + clicked + on_source_clicked + addr_edit + Fri, 27 Jul 2001 01:05:33 GMT + + + GTK_RELIEF_NORMAL + + 3 + False + False + + + + + + GtkLabel + label213 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 0 + 0 + + 0 + 1 + 7 + 8 + 0 + 0 + False + False + False + False + True + False + + + + + GtkHBox + hbox32 + False + 0 + + 1 + 2 + 7 + 8 + 0 + 0 + False + False + False + False + True + True + + + + GtkOptionMenu + conf + True + Very Low +Low +Normal +High +Very High + + 2 + + 3 + True + True + + + + + GtkCheckButton + priv + True + + False + True + + 5 + False + False + + + + + + GtkLabel + label214 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + city + True + True + True + 0 + + + 1 + 2 + 2 + 3 + 3 + 3 + True + False + False + False + True + False + + + + + GtkEntry + address_start + True + True + True + 0 + + + 1 + 2 + 0 + 1 + 3 + 3 + True + False + False + False + True + False + + + + + GtkLabel + label215 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 3 + 4 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label216 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 4 + 5 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label217 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 5 + 6 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + state + True + True + True + 0 + + + 1 + 2 + 3 + 4 + 3 + 3 + True + False + False + False + True + False + + + + + GtkEntry + country + True + True + True + 0 + + + 1 + 2 + 4 + 5 + 3 + 3 + True + False + False + False + True + False + + + + + GtkEntry + postal + True + True + True + 0 + + + 1 + 2 + 5 + 6 + 3 + 3 + True + False + False + False + True + False + + + + + + + + + GtkDialog + url_edit + Gramps - Internet Address Editor + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + True + False + + + GtkVBox + Dialog:vbox + vbox36 + False + 0 + + + GtkHBox + Dialog:action_area + hbox33 + 10 + True + 5 + + 0 + False + True + GTK_PACK_END + + + + GtkHButtonBox + hbuttonbox22 + GTK_BUTTONBOX_END + 30 + 85 + 27 + 7 + 0 + + 0 + True + True + + + + GtkButton + button124 + True + True + + clicked + on_url_edit_ok_clicked + url_edit + Sun, 29 Jul 2001 05:41:34 GMT + + GNOME_STOCK_BUTTON_OK + GTK_RELIEF_NORMAL + + + + GtkButton + button125 + True + True + + clicked + destroy_passed_object + url_edit + Thu, 26 Jul 2001 19:16:49 GMT + + GNOME_STOCK_BUTTON_CANCEL + GTK_RELIEF_NORMAL + + + + + + GtkVBox + vbox37 + False + 0 + + 0 + False + True + + + + GtkLabel + urlTitle + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 10 + + 0 + False + False + + + + + GtkHSeparator + hseparator5 + + 0 + False + True + + + + + GtkTable + table27 + 3 + 2 + False + 0 + 0 + + 0 + False + True + + + + GtkLabel + label219 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label220 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 8 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkEntry + url_des + True + True + True + 0 + + + 1 + 2 + 1 + 2 + 3 + 3 + True + False + False + False + True + False + + + + + GtkHBox + hbox35 + False + 0 + + 1 + 2 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + + + GtkCheckButton + priv + True + + False + True + + 5 + False + False + + + + + + GtkEntry + url_addr + 400 + True + True + True + 0 + + + 1 + 2 + 0 + 1 + 3 + 3 + True + False + False + False + True + False + + diff --git a/src/EditPerson.py b/src/EditPerson.py index 398a4fc8e..26a42e8e6 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -74,14 +74,17 @@ class EditPerson: # window. # #--------------------------------------------------------------------- - def __init__(self,person,db,surname_list,callback): + def __init__(self,person,db,callback): self.person = person self.db = db - self.surname_list = surname_list self.callback = callback self.path = db.getSavePath() self.not_loaded = 1 self.events_changed = 0 + self.urls_changed = 0 + self.addr_changed = 0 + self.names_changed = 0 + self.attr_changed = 0 self.top_window = libglade.GladeXML(const.editPersonFile, "editPerson") @@ -92,17 +95,20 @@ class EditPerson: self.event_date_field = self.get_widget("eventDate") self.event_descr_field = self.get_widget("eventDescription") self.event_details_field = self.get_widget("event_details") + self.attr_details_field = self.get_widget("attr_details") + self.name_details_field = self.get_widget("name_details") + self.addr_details_field = self.get_widget("addr_details") self.photo_list = self.get_widget("photolist") self.attr_list = self.get_widget("attr_list") self.attr_type = self.get_widget("attr_type") self.attr_value = self.get_widget("attr_value") self.web_list = self.get_widget("web_list") - self.web_url = self.get_widget("web_url") - self.web_description = self.get_widget("web_description") + self.web_url = self.get_widget("url_addr") + self.web_description = self.get_widget("url_des") self.web_browse = self.get_widget("browse") + self.address_label = self.get_widget("address_label") self.address_list = self.get_widget("address_list") self.address_start = self.get_widget("address_start") - self.address_stop = self.get_widget("address_stop") self.address_street = self.get_widget("street") self.address_city = self.get_widget("city") self.address_state = self.get_widget("state") @@ -111,6 +117,7 @@ class EditPerson: self.event_list = self.get_widget("eventList") self.edit_person = self.get_widget("editPerson") self.name_list = self.get_widget("nameList") + self.name_frame = self.get_widget("name_frame") self.alt_given_field = self.get_widget("alt_given") self.alt_last_field = self.get_widget("alt_last") self.alt_suffix_field = self.get_widget("alt_suffix") @@ -133,6 +140,10 @@ class EditPerson: self.name_source = self.get_widget("name_source") self.elist = person.getEventList()[:] + self.nlist = person.getAlternateNames()[:] + self.alist = person.getAttributeList()[:] + self.ulist = person.getUrlList()[:] + self.plist = person.getAddressList()[:] self.selectedIcon = -1 @@ -175,13 +186,9 @@ class EditPerson: "on_apply_person_clicked" : on_apply_person_clicked }) - if len(self.surname_list) > 0: - self.surname_list.sort() - self.get_widget("lastNameList").set_popdown_strings(self.surname_list) - - attr_names = self.get_widget("attribute") - attr_names.set_popdown_strings(const.personalAttributes) - attr_names.entry.set_text("") + if len(const.surnames) > 0: + const.surnames.sort() + self.get_widget("lastNameList").set_popdown_strings(const.surnames) name = person.getPrimaryName() birth = person.getBirth() @@ -195,7 +202,6 @@ class EditPerson: if len(const.places) > 0: self.get_widget("dp_combo").set_popdown_strings(const.places) self.get_widget("bp_combo").set_popdown_strings(const.places) -# self.get_widget("eventPlace_combo").set_popdown_strings(const.places) if Config.display_attr: self.get_widget("user_label").set_text(Config.attr_name) @@ -279,13 +285,15 @@ class EditPerson: self.name_list.clear() self.name_index = 0 - for name in self.person.getAlternateNames(): + for name in self.nlist: attr = "" if Config.show_detail: if name.getNote() != "": attr = "N" if name.getSourceRef().getBase(): attr = attr + "S" + if name.getPrivacy(): + attr = attr + "P" self.name_list.append([name.getName(),attr]) self.name_list.set_row_data(self.name_index,name) self.name_index = self.name_index + 1 @@ -299,11 +307,6 @@ class EditPerson: current_row = current_row - 1 self.name_list.select_row(current_row,0) self.name_list.moveto(current_row,0) - self.name_note.set_sensitive(1) - self.name_source.set_sensitive(1) - else: - self.name_note.set_sensitive(0) - self.name_source.set_sensitive(0) self.name_list.set_data(INDEX,current_row) self.name_list.thaw() @@ -317,7 +320,7 @@ class EditPerson: self.web_list.clear() self.web_index = 0 - for url in self.person.getUrlList(): + for url in self.ulist: self.web_list.append([url.get_path(),url.get_description()]) self.web_list.set_row_data(self.web_index,url) self.web_index = self.web_index + 1 @@ -344,13 +347,15 @@ class EditPerson: self.attr_list.clear() self.attr_index = 0 - for attr in self.person.getAttributeList(): + for attr in self.alist: detail = "" if Config.show_detail: if attr.getNote() != "": detail = "N" if attr.getSourceRef().getBase(): detail = detail + "S" + if attr.getPrivacy(): + attr = attr + "P" self.attr_list.append([const.display_pattr(attr.getType()),\ attr.getValue(),detail]) self.attr_list.set_row_data(self.attr_index,attr) @@ -365,11 +370,6 @@ class EditPerson: current_row = current_row - 1 self.attr_list.select_row(current_row,0) self.attr_list.moveto(current_row,0) - self.attr_note.set_sensitive(1) - self.attr_source.set_sensitive(1) - else: - self.attr_note.set_sensitive(0) - self.attr_source.set_sensitive(0) self.attr_list.set_data(INDEX,current_row) self.attr_list.thaw() @@ -383,13 +383,15 @@ class EditPerson: self.address_list.clear() self.address_index = 0 - for address in self.person.getAddressList(): + for address in self.plist: detail = "" if Config.show_detail: if address.getNote() != "": detail = "N" if address.getSourceRef().getBase(): detail = detail + "S" + if address.getPrivacy(): + detail = detail + "P" location = address.getCity() + " " + address.getState() + " " + \ address.getCountry() self.address_list.append([address.getDate(),location,detail]) @@ -405,11 +407,6 @@ class EditPerson: current_row = current_row - 1 self.address_list.select_row(current_row,0) self.address_list.moveto(current_row,0) - self.addr_note.set_sensitive(1) - self.addr_source.set_sensitive(1) - else: - self.addr_note.set_sensitive(0) - self.addr_source.set_sensitive(0) self.address_list.set_data(INDEX,current_row) self.address_list.thaw() @@ -431,6 +428,8 @@ class EditPerson: attr = "N" if event.getSourceRef().getBase(): attr = attr + "S" + if event.getPrivacy(): + attr = attr + "P" self.event_list.append([const.display_pevent(event.getName()),\ event.getQuoteDate(), event.getPlace(),attr]) self.event_list.set_row_data(self.event_index,event) @@ -495,6 +494,38 @@ class EditPerson: def update_events(self): self.person.setEventList(self.elist) + #------------------------------------------------------------------------- + # + # + # + #------------------------------------------------------------------------- + def update_names(self): + self.person.setAlternateNames(self.nlist) + + #------------------------------------------------------------------------- + # + # + # + #------------------------------------------------------------------------- + def update_urls(self): + self.person.setUrlList(self.ulist) + + #------------------------------------------------------------------------- + # + # + # + #------------------------------------------------------------------------- + def update_attributes(self): + self.person.setAttributeList(self.alist) + + #------------------------------------------------------------------------- + # + # + # + #------------------------------------------------------------------------- + def update_addresses(self): + self.person.setAddressList(self.plist) + #------------------------------------------------------------------------- # # on_name_list_select_row - sets the row object attached to the passed @@ -508,10 +539,27 @@ def on_name_list_select_row(obj,row,b,c): epo = obj.get_data(EDITPERSON) name = obj.get_row_data(row) + epo.name_frame.set_label(name.getName()) epo.alt_given_field.set_text(name.getFirstName()) epo.alt_last_field.set_text(name.getSurname()) epo.alt_suffix_field.set_text(name.getSuffix()) + if name.getNote() != "": + details = "%s" % _("Note") + else: + details = "" + if name.getSourceRef().getBase() != None: + if details == "": + details = _("Source") + else: + details = "%s, %s" % (details,_("Source")) + if name.getPrivacy() == 1: + if details == "": + details = _("Private") + else: + details = "%s, %s" % (details,_("Private")) + epo.name_details_field.set_text(details) + #------------------------------------------------------------------------- # # on_name_list_select_row - sets the row object attached to the passed @@ -541,9 +589,25 @@ def on_attr_list_select_row(obj,row,b,c): epo = obj.get_data(EDITPERSON) attr = obj.get_row_data(row) - epo.attr_type.set_text(const.display_pattr(attr.getType())) + epo.attr_type.set_label(const.display_pattr(attr.getType())) epo.attr_value.set_text(attr.getValue()) + if attr.getNote() != "": + details = "%s" % _("Note") + else: + details = "" + if attr.getSourceRef().getBase() != None: + if details == "": + details = _("Source") + else: + details = "%s, %s" % (details,_("Source")) + if attr.getPrivacy() == 1: + if details == "": + details = _("Private") + else: + details = "%s, %s" % (details,_("Private")) + epo.attr_details_field.set_text(details) + #------------------------------------------------------------------------- # # on_name_list_select_row - sets the row object attached to the passed @@ -555,14 +619,32 @@ def on_address_list_select_row(obj,row,b,c): obj.set_data(INDEX,row) epo = obj.get_data(EDITPERSON) - address = obj.get_row_data(row) + addr = obj.get_row_data(row) - epo.address_start.set_text(address.getDate()) - epo.address_street.set_text(address.getStreet()) - epo.address_city.set_text(address.getCity()) - epo.address_state.set_text(address.getState()) - epo.address_country.set_text(address.getCountry()) - epo.address_postal.set_text(address.getPostal()) + epo.address_label.set_label("%s %s %s" % \ + (addr.getCity(),addr.getState(),addr.getCountry())) + epo.address_start.set_text(addr.getDate()) + epo.address_street.set_text(addr.getStreet()) + epo.address_city.set_text(addr.getCity()) + epo.address_state.set_text(addr.getState()) + epo.address_country.set_text(addr.getCountry()) + epo.address_postal.set_text(addr.getPostal()) + + if addr.getNote() != "": + details = "%s" % _("Note") + else: + details = "" + if addr.getSourceRef().getBase() != None: + if details == "": + details = _("Source") + else: + details = "%s, %s" % (details,_("Source")) + if addr.getPrivacy() == 1: + if details == "": + details = _("Private") + else: + details = "%s, %s" % (details,_("Private")) + epo.addr_details_field.set_text(details) #------------------------------------------------------------------------- # @@ -574,13 +656,7 @@ def on_aka_update_clicked(obj): if row < 0: return - epo = obj.get_data(EDITPERSON) - name = obj.get_row_data(row) - name.setFirstName(epo.alt_given_field.get_text()) - name.setSurname(epo.alt_last_field.get_text()) - name.setSuffix(epo.alt_suffix_field.get_text()) - - epo.redraw_name_list() + NameEditor(obj.get_data(EDITPERSON),obj.get_row_data(row)) #------------------------------------------------------------------------- # @@ -592,14 +668,7 @@ def on_update_url_clicked(obj): if row < 0: return - epo = obj.get_data(EDITPERSON) - path = epo.web_url.get_text() - - url = obj.get_row_data(row) - url.set_path(path) - url.set_description(epo.web_description.get_text()) - - epo.redraw_url_list() + UrlEditor(obj.get_data(EDITPERSON),obj.get_row_data(row)) #------------------------------------------------------------------------- # @@ -611,12 +680,7 @@ def on_update_attr_clicked(obj): if row < 0: return - epo = obj.get_data(EDITPERSON) - attr = obj.get_row_data(row) - attr.setType(const.save_pattr(epo.attr_type.get_text())) - attr.setValue(epo.attr_value.get_text()) - - epo.redraw_attr_list() + AttributeEditor(obj.get_data(EDITPERSON),obj.get_row_data(row)) #------------------------------------------------------------------------- # @@ -627,18 +691,7 @@ def on_update_address_clicked(obj): row = obj.get_data(INDEX) if row < 0: return - - epo = obj.get_data(EDITPERSON) - - address = obj.get_row_data(row) - address.setDate(epo.address_start.get_text()) - address.setStreet(epo.address_street.get_text()) - address.setCity(epo.address_city.get_text()) - address.setState(epo.address_state.get_text()) - address.setCountry(epo.address_country.get_text()) - address.setPostal(epo.address_postal.get_text()) - utils.modified() - epo.redraw_address_list() + AddressEditor(obj.get_data(EDITPERSON),obj.get_row_data(row)) #------------------------------------------------------------------------- # @@ -647,14 +700,13 @@ def on_update_address_clicked(obj): #------------------------------------------------------------------------- def on_aka_delete_clicked(obj): row = obj.get_data(INDEX) + epo = obj.get_data(EDITPERSON) if row < 0: return - epo = obj.get_data(EDITPERSON) - list = epo.person.getAlternateNames() - del list[row] + del epo.nlist[row] - if row > len(list)-1: + if row > len(epo.nlist)-1: obj.set_data(INDEX,row-1) epo.redraw_name_list() @@ -671,10 +723,9 @@ def on_delete_url_clicked(obj): return epo = obj.get_data(EDITPERSON) - list = epo.person.getUrlList() - del list[row] + del epo.ulist[row] - if row > len(list)-1: + if row > len(epo.ulist)-1: obj.set_data(INDEX,row-1) epo.redraw_url_list() @@ -691,13 +742,13 @@ def on_delete_attr_clicked(obj): return epo = obj.get_data(EDITPERSON) - list = epo.person.getAttributeList() - del list[row] + del epo.alist[row] - if row > len(list)-1: + if row > len(epo.alist)-1: obj.set_data(INDEX,row-1) epo.redraw_attr_list() + epo.attr_changed = 1 utils.modified() #------------------------------------------------------------------------- @@ -710,16 +761,20 @@ def on_delete_address_clicked(obj): if row < 0: return - epo = obj.get_data(EDITPERSON) - list = epo.person.getAddressList() - del list[row] + row = obj.get_data(INDEX) + if row < 0: + return - if row > len(list)-1: + epo = obj.get_data(EDITPERSON) + del epo.plist[row] + + if row > len(epo.plist)-1: obj.set_data(INDEX,row-1) epo.redraw_address_list() + epo.addr_changed = 1 utils.modified() - + #------------------------------------------------------------------------- # # @@ -727,15 +782,7 @@ def on_delete_address_clicked(obj): #------------------------------------------------------------------------- def on_add_aka_clicked(obj): epo = obj.get_data(EDITPERSON) - - name = Name() - name.setFirstName(epo.alt_given_field.get_text()) - name.setSurname(epo.alt_last_field.get_text()) - name.setSuffix(epo.alt_suffix_field.get_text()) - - epo.person.addAlternateName(name) - epo.redraw_name_list() - utils.modified() + NameEditor(epo,None) #------------------------------------------------------------------------- # @@ -744,16 +791,7 @@ def on_add_aka_clicked(obj): #------------------------------------------------------------------------- def on_add_url_clicked(obj): epo = obj.get_data(EDITPERSON) - - url = Url() - path = epo.web_url.get_text() - - url.set_path(path) - url.set_description(epo.web_description.get_text()) - - epo.person.addUrl(url) - epo.redraw_url_list() - utils.modified() + UrlEditor(epo,None) #------------------------------------------------------------------------- # @@ -761,21 +799,7 @@ def on_add_url_clicked(obj): # #------------------------------------------------------------------------- def on_add_attr_clicked(obj): - epo = obj.get_data(EDITPERSON) - - attr = Attribute() - name = epo.attr_type.get_text() - attr.setType(const.save_pattr(name)) - attr.setValue(epo.attr_value.get_text()) - - if name not in const.personalAttributes: - const.personalAttributes.append(name) - menu = epo.get_widget("attribute") - menu.set_popdown_strings(const.personalAttributes) - - epo.person.addAttribute(attr) - epo.redraw_attr_list() - utils.modified() + AttributeEditor(obj.get_data(EDITPERSON),None) #------------------------------------------------------------------------- # @@ -783,19 +807,7 @@ def on_add_attr_clicked(obj): # #------------------------------------------------------------------------- def on_add_address_clicked(obj): - epo = obj.get_data(EDITPERSON) - - address = Address() - address.setDate(epo.address_start.get_text()) - address.setStreet(epo.address_street.get_text()) - address.setCity(epo.address_city.get_text()) - address.setState(epo.address_state.get_text()) - address.setCountry(epo.address_country.get_text()) - address.setPostal(epo.address_postal.get_text()) - - epo.person.addAddress(address) - epo.redraw_address_list() - utils.modified() + AddressEditor(obj.get_data(EDITPERSON),None) #------------------------------------------------------------------------- # @@ -870,14 +882,19 @@ def on_event_select_row(obj,row,b,c): epo.event_descr_field.set_text(event.getDescription()) if event.getNote() != "": - details = _("Note") + details = "%s" % _("Note") else: details = "" if event.getSourceRef().getBase() != None: if details == "": details = _("Source") else: - details = "%s, %s" % (_("Note"),_("Source")) + details = "%s, %s" % (details,_("Source")) + if event.getPrivacy() == 1: + if details == "": + details = _("Private") + else: + details = "%s, %s" % (details,_("Private")) epo.event_details_field.set_text(details) #------------------------------------------------------------------------- @@ -949,7 +966,7 @@ def on_primary_photo_clicked(obj): # actually changed. # #------------------------------------------------------------------------- -def update_event(event,name,date,place,desc,note): +def update_event(event,name,date,place,desc,note,priv,conf): changed = 0 if event.getPlace() != place: event.setPlace(place) @@ -971,8 +988,165 @@ def update_event(event,name,date,place,desc,note): event.setDate(date) changed = 1 + if event.getPrivacy() != priv: + event.setPrivacy(priv) + changed = 1 + + if event.getConfidence() != conf: + event.setConfidence(conf) + changed = 1 + return changed - + +#------------------------------------------------------------------------- +# +# update_address +# +# Updates the specified event with the specified date. Compares against +# the previous value, so the that modified flag is not set if nothing has +# actually changed. +# +#------------------------------------------------------------------------- +def update_address(addr,date,street,city,state,country,postal,note,priv,conf): + changed = 0 + + d = Date() + d.set(date) + if addr.getDate() != d.getDate(): + addr.setDate(date) + changed = 1 + + if addr.getState() != state: + addr.setState(state) + changed = 1 + + if addr.getCountry() != country: + addr.setCountry(country) + changed = 1 + + if addr.getCity() != city: + addr.setCity(city) + changed = 1 + + if addr.getPostal() != postal: + addr.setPostal(postal) + changed = 1 + + if addr.getNote() != note: + addr.setNote(note) + changed = 1 + + if addr.getPrivacy() != priv: + addr.setPrivacy(priv) + changed = 1 + + if addr.getConfidence() != conf: + addr.setConfidence(conf) + changed = 1 + + return changed + +#------------------------------------------------------------------------- +# +# update_attrib +# +# Updates the specified event with the specified date. Compares against +# the previous value, so the that modified flag is not set if nothing has +# actually changed. +# +#------------------------------------------------------------------------- +def update_attrib(attr,type,value,note,priv,conf): + changed = 0 + + if attr.getType() != const.save_pattr(type): + attr.setType(const.save_pattr(type)) + changed = 1 + + if attr.getValue() != value: + attr.setValue(value) + changed = 1 + + if attr.getNote() != note: + attr.setNote(note) + changed = 1 + + if attr.getPrivacy() != priv: + attr.setPrivacy(priv) + changed = 1 + + if attr.getConfidence() != conf: + attr.setConfidence(conf) + changed = 1 + + return changed + +#------------------------------------------------------------------------- +# +# update_attrib +# +# Updates the specified event with the specified date. Compares against +# the previous value, so the that modified flag is not set if nothing has +# actually changed. +# +#------------------------------------------------------------------------- +def update_url(url,des,addr,priv): + changed = 0 + + if url.get_path() != addr: + url.set_path(addr) + changed = 1 + + if url.get_description() != des: + url.set_description(des) + changed = 1 + + if url.getPrivacy() != priv: + url.setPrivacy(priv) + changed = 1 + + return changed + +#------------------------------------------------------------------------- +# +# update_name +# +# Updates the specified name. Compares against +# the previous value, so the that modified flag is not set if nothing has +# actually changed. +# +#------------------------------------------------------------------------- +def update_name(name,first,last,suffix,note,priv,conf): + changed = 0 + + if name.getFirstName() != first: + name.setFirstName(first) + changed = 1 + + if name.getSurname() != last: + name.setSurname(last) + if last not in const.surnames: + const.surnames.append(last) + const.surnames.sort() + changed = 1 + + if name.getSuffix() != suffix: + name.setSuffix(suffix) + changed = 1 + + if name.getNote() != note: + name.setNote(note) + changed = 1 + + if name.getPrivacy() != priv: + name.setPrivacy(priv) + changed = 1 + + if name.getConfidence() != conf: + name.setConfidence(conf) + changed = 1 + + return changed + #------------------------------------------------------------------------- # # @@ -1033,9 +1207,9 @@ def on_apply_person_clicked(obj): if surname != name.getSurname(): name.setSurname(surname) - if surname not in epo.surname_list: - epo.surname_list.append(surname) - epo.surname_list.sort() + if surname not in const.surnames: + const.surnames.append(surname) + const.surnames.sort() utils.modified() if given != name.getFirstName(): @@ -1114,6 +1288,22 @@ def on_apply_person_clicked(obj): epo.update_events() if epo.events_changed: utils.modified() + + epo.update_names() + if epo.names_changed: + utils.modified() + + epo.update_urls() + if epo.urls_changed: + utils.modified() + + epo.update_attributes() + if epo.attr_changed: + utils.modified() + + epo.update_addresses() + if epo.addr_changed: + utils.modified() utils.destroy_passed_object(obj) epo.callback(epo) @@ -1444,16 +1634,34 @@ class EventEditor: self.note_field = self.top.get_widget("eventNote") self.event_menu = self.top.get_widget("personalEvents") self.source_field = self.top.get_widget("event_source") - + self.conf_menu = self.top.get_widget("conf") + self.priv = self.top.get_widget("priv") + name = parent.person.getPrimaryName().getName() self.top.get_widget("eventTitle").set_text(_("Event Editor for %s") % name) self.event_menu.set_popdown_strings(const.personalEvents) + + myMenu = GtkMenu() + index = 0 + for name in const.confidence: + item = GtkMenuItem(name) + item.set_data("a",index) + item.show() + myMenu.append(item) + index = index + 1 + + self.conf_menu.set_menu(myMenu) + if event != None: self.name_field.set_text(event.getName()) self.place_field.set_text(event.getPlace()) self.date_field.set_text(event.getDate()) self.descr_field.set_text(event.getDescription()) + self.conf_menu.set_history(event.getConfidence()) + + self.priv.set_active(event.getPrivacy()) + srcref_base = self.event.getSourceRef().getBase() if srcref_base: self.source_field.set_text(srcref_base.getTitle()) @@ -1463,12 +1671,14 @@ class EventEditor: self.note_field.set_point(0) self.note_field.insert_defaults(event.getNote()) self.note_field.set_word_wrap(1) + else: + self.conf_menu.set_history(2) self.window.set_data("o",self) self.top.signal_autoconnect({ "destroy_passed_object" : utils.destroy_passed_object, "on_event_edit_ok_clicked" : on_event_edit_ok_clicked, - "on_source_clicked" : on_source_clicked + "on_source_clicked" : on_edit_source_clicked }) #------------------------------------------------------------------------- @@ -1476,7 +1686,7 @@ class EventEditor: # # #------------------------------------------------------------------------- -def on_source_clicked(obj): +def on_edit_source_clicked(obj): ee = obj.get_data("o") Sources.SourceEditor(ee.event,ee.parent.db,ee.source_field) @@ -1494,14 +1704,369 @@ def on_event_edit_ok_clicked(obj): eplace = ee.place_field.get_text() enote = ee.note_field.get_chars(0,-1) edesc = ee.descr_field.get_text() + epriv = ee.priv.get_active() + econf = ee.conf_menu.get_menu().get_active().get_data("a") if event == None: event = Event() ee.parent.elist.append(event) - if update_event(event,ename,edate,eplace,edesc,enote): + if update_event(event,ename,edate,eplace,edesc,enote,epriv,econf): ee.parent.events_changed = 1 ee.parent.redraw_event_list() utils.destroy_passed_object(obj) + +#------------------------------------------------------------------------- +# +# AttributeEditor class +# +#------------------------------------------------------------------------- +class AttributeEditor: + + def __init__(self,parent,attrib): + self.parent = parent + self.attrib = attrib + self.top = libglade.GladeXML(const.editPersonFile, "attr_edit") + self.window = self.top.get_widget("attr_edit") + self.type_field = self.top.get_widget("attr_type") + self.value_field = self.top.get_widget("attr_value") + self.note_field = self.top.get_widget("attr_note") + self.attrib_menu = self.top.get_widget("attr_menu") + self.source_field = self.top.get_widget("attr_source") + self.conf_menu = self.top.get_widget("conf") + self.priv = self.top.get_widget("priv") + + name = parent.person.getPrimaryName().getName() + + self.top.get_widget("attrTitle").set_text(_("Attribute Editor for %s") % name) + self.attrib_menu.set_popdown_strings(const.personalAttributes) + + myMenu = GtkMenu() + index = 0 + for name in const.confidence: + item = GtkMenuItem(name) + item.set_data("a",index) + item.show() + myMenu.append(item) + index = index + 1 + self.conf_menu.set_menu(myMenu) + + if attrib != None: + self.type_field.set_text(attrib.getType()) + self.value_field.set_text(attrib.getValue()) + srcref_base = self.attrib.getSourceRef().getBase() + if srcref_base: + self.source_field.set_text(srcref_base.getTitle()) + else: + self.source_field.set_text("") + + self.conf_menu.set_history(attrib.getConfidence()) + + self.priv.set_active(attrib.getPrivacy()) + + self.note_field.set_point(0) + self.note_field.insert_defaults(attrib.getNote()) + self.note_field.set_word_wrap(1) + else: + self.conf_menu.set_history(2) + + self.window.set_data("o",self) + self.top.signal_autoconnect({ + "destroy_passed_object" : utils.destroy_passed_object, + "on_attr_edit_ok_clicked" : on_attrib_edit_ok_clicked, + "on_source_clicked" : on_attrib_source_clicked + }) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_attrib_source_clicked(obj): + ee = obj.get_data("o") + Sources.SourceEditor(ee.attrib,ee.parent.db,ee.source_field) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_attrib_edit_ok_clicked(obj): + ee = obj.get_data("o") + attrib = ee.attrib + + type = ee.type_field.get_text() + value = ee.value_field.get_text() + note = ee.note_field.get_chars(0,-1) + priv = ee.priv.get_active() + conf = ee.conf_menu.get_menu().get_active().get_data("a") + + if attrib == None: + attrib = Attribute() + ee.parent.alist.append(attrib) + + if update_attrib(attrib,type,value,note,priv,conf): + ee.parent.attr_changed = 1 + + ee.parent.redraw_attr_list() + utils.destroy_passed_object(obj) + +#------------------------------------------------------------------------- +# +# NameEditor class +# +#------------------------------------------------------------------------- +class NameEditor: + + def __init__(self,parent,name): + self.parent = parent + self.name = name + self.top = libglade.GladeXML(const.editPersonFile, "name_edit") + self.window = self.top.get_widget("name_edit") + self.given_field = self.top.get_widget("alt_given") + self.surname_field = self.top.get_widget("alt_last") + self.suffix_field = self.top.get_widget("alt_suffix") + self.note_field = self.top.get_widget("alt_note") + self.source_field = self.top.get_widget("alt_source") + self.top.get_widget("alt_surname_list").set_popdown_strings(const.surnames) + self.conf_menu = self.top.get_widget("conf") + self.priv = self.top.get_widget("priv") + + full_name = parent.person.getPrimaryName().getName() + + self.top.get_widget("altTitle").set_text( + _("Alternate Name Editor for %s") % full_name) + + myMenu = GtkMenu() + index = 0 + for val in const.confidence: + item = GtkMenuItem(val) + item.set_data("a",index) + item.show() + myMenu.append(item) + index = index + 1 + + self.conf_menu.set_menu(myMenu) + + if name != None: + self.given_field.set_text(name.getFirstName()) + self.surname_field.set_text(name.getSurname()) + self.suffix_field.set_text(name.getSuffix()) + srcref_base = self.name.getSourceRef().getBase() + if srcref_base: + self.source_field.set_text(srcref_base.getTitle()) + else: + self.source_field.set_text("") + + self.conf_menu.set_history(name.getConfidence()) + + self.priv.set_active(name.getPrivacy()) + + self.note_field.set_point(0) + self.note_field.insert_defaults(name.getNote()) + self.note_field.set_word_wrap(1) + else: + self.conf_menu.set_history(2) + + self.window.set_data("o",self) + self.top.signal_autoconnect({ + "destroy_passed_object" : utils.destroy_passed_object, + "on_name_edit_ok_clicked" : on_name_edit_ok_clicked, + "on_source_clicked" : on_name_source_clicked + }) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_name_source_clicked(obj): + ee = obj.get_data("o") + Sources.SourceEditor(ee.name,ee.parent.db,ee.source_field) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_name_edit_ok_clicked(obj): + ee = obj.get_data("o") + name = ee.name + + first = ee.given_field.get_text() + last = ee.surname_field.get_text() + suffix = ee.suffix_field.get_text() + note = ee.note_field.get_chars(0,-1) + priv = ee.priv.get_active() + conf = ee.conf_menu.get_menu().get_active().get_data("a") + + if name == None: + name = Name() + ee.parent.nlist.append(name) + + if update_name(name,first,last,suffix,note,priv,conf): + ee.parent.name_changed = 1 + + ee.parent.redraw_name_list() + utils.destroy_passed_object(obj) + + +#------------------------------------------------------------------------- +# +# AddressEditor class +# +#------------------------------------------------------------------------- +class AddressEditor: + + def __init__(self,parent,addr): + self.parent = parent + self.addr = addr + self.top = libglade.GladeXML(const.editPersonFile, "addr_edit") + self.window = self.top.get_widget("addr_edit") + self.address_start = self.top.get_widget("address_start") + self.street = self.top.get_widget("street") + self.city = self.top.get_widget("city") + self.state = self.top.get_widget("state") + self.country = self.top.get_widget("country") + self.postal = self.top.get_widget("postal") + self.note_field = self.top.get_widget("addr_note") + self.source_field = self.top.get_widget("addr_source") + self.conf_menu = self.top.get_widget("conf") + self.priv = self.top.get_widget("priv") + + name = parent.person.getPrimaryName().getName() + text = _("Address Name Editor for %s") % name + self.top.get_widget("addrTitle").set_text(text) + + myMenu = GtkMenu() + index = 0 + for val in const.confidence: + item = GtkMenuItem(val) + item.set_data("a",index) + item.show() + myMenu.append(item) + index = index + 1 + + self.conf_menu.set_menu(myMenu) + + if addr != None: + self.given_field.set_text(addr.getFirstAddr()) + self.suraddr_field.set_text(addr.getSuraddr()) + self.suffix_field.set_text(addr.getSuffix()) + srcref_base = self.addr.getSourceRef().getBase() + if srcref_base: + self.source_field.set_text(srcref_base.getTitle()) + else: + self.source_field.set_text("") + + self.conf_menu.set_history(addr.getConfidence()) + + self.priv.set_active(addr.getPrivacy()) + + self.note_field.set_point(0) + self.note_field.insert_defaults(addr.getNote()) + self.note_field.set_word_wrap(1) + else: + self.conf_menu.set_history(2) + + self.window.set_data("o",self) + self.top.signal_autoconnect({ + "destroy_passed_object" : utils.destroy_passed_object, + "on_addr_edit_ok_clicked" : on_addr_edit_ok_clicked, + "on_source_clicked" : on_addr_source_clicked + }) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_addr_source_clicked(obj): + ee = obj.get_data("o") + Sources.SourceEditor(ee.addr,ee.parent.db,ee.source_field) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_addr_edit_ok_clicked(obj): + ee = obj.get_data("o") + addr = ee.addr + + date = ee.address_start.get_text() + street = ee.street.get_text() + city = ee.city.get_text() + state = ee.state.get_text() + country = ee.country.get_text() + postal = ee.postal.get_text() + note = ee.note_field.get_chars(0,-1) + priv = ee.priv.get_active() + conf = ee.conf_menu.get_menu().get_active().get_data("a") + + if addr == None: + addr = Address() + ee.parent.plist.append(addr) + + if update_address(addr,date,street,city,state,country,postal,note,priv,conf): + ee.parent.addr_changed = 1 + + ee.parent.redraw_address_list() + utils.destroy_passed_object(obj) + +#------------------------------------------------------------------------- +# +# UrlEditor class +# +#------------------------------------------------------------------------- +class UrlEditor: + + def __init__(self,parent,url): + self.parent = parent + self.url = url + self.top = libglade.GladeXML(const.editPersonFile, "url_edit") + self.window = self.top.get_widget("url_edit") + self.des = self.top.get_widget("url_des") + self.addr = self.top.get_widget("url_addr") + self.priv = self.top.get_widget("priv") + + name = parent.person.getPrimaryName().getName() + + self.top.get_widget("urlTitle").set_text(_("Internet Address Editor for %s") % name) + + if url != None: + self.des.set_text(url.get_description()) + self.addr.set_text(url.get_path()) + self.priv.set_active(url.getPrivacy()) + + self.window.set_data("o",self) + self.top.signal_autoconnect({ + "destroy_passed_object" : utils.destroy_passed_object, + "on_url_edit_ok_clicked" : on_url_edit_ok_clicked + }) + +#------------------------------------------------------------------------- +# +# +# +#------------------------------------------------------------------------- +def on_url_edit_ok_clicked(obj): + ee = obj.get_data("o") + url = ee.url + + des = ee.des.get_text() + addr = ee.addr.get_text() + priv = ee.priv.get_active() + + if url == None: + url = Url() + ee.parent.ulist.append(url) + + if update_url(url,des,addr,priv): + ee.parent.urls_changed = 1 + + ee.parent.redraw_url_list() + utils.destroy_passed_object(obj) + diff --git a/src/GrampsParser.py b/src/GrampsParser.py index 453c64314..75090f337 100644 --- a/src/GrampsParser.py +++ b/src/GrampsParser.py @@ -150,6 +150,10 @@ class GrampsParser(handler.ContentHandler): def start_event(self,attrs): self.event = Event() self.event_type = u2l(string.capwords(attrs["type"])) + if attrs.has_key("conf"): + self.event.confidence = string.atoi(attrs["conf"]) + if attrs.has_key("priv"): + self.event.private = string.atoi(attrs["priv"]) #--------------------------------------------------------------------- # @@ -158,6 +162,10 @@ class GrampsParser(handler.ContentHandler): #--------------------------------------------------------------------- def start_attribute(self,attrs): self.attribute = Attribute() + if attrs.has_key("conf"): + self.attribute.confidence = string.atoi(attrs["conf"]) + if attrs.has_key("priv"): + self.attribute.privacy = string.atoi(attrs["priv"]) if attrs.has_key('type'): self.in_old_attr = 1 self.attribute.setType(u2l(string.capwords(attrs["type"]))) @@ -176,6 +184,10 @@ class GrampsParser(handler.ContentHandler): def start_address(self,attrs): self.address = Address() self.person.addAddress(self.address) + if attrs.has_key("conf"): + self.address.confidence = string.atoi(attrs["conf"]) + if attrs.has_key("priv"): + self.address.private = string.atoi(attrs["priv"]) #--------------------------------------------------------------------- # @@ -245,7 +257,11 @@ class GrampsParser(handler.ContentHandler): desc = "" try: - url = Url(u2l(attrs["href"]),desc) + url = Url() + url.set_path(u2l(attrs["href"])) + url.set_description(desc) + if attrs.has_key("priv"): + url.setPrivacy(string.atoi(attrs['priv'])) self.person.addUrl(url) except KeyError: return @@ -295,6 +311,10 @@ class GrampsParser(handler.ContentHandler): #--------------------------------------------------------------------- def start_name(self,attrs): self.name = Name() + if attrs.has_key("conf"): + self.name.confidence = string.atoi(attrs["conf"]) + if attrs.has_key("priv"): + self.name.private = string.atoi(attrs["priv"]) #--------------------------------------------------------------------- # diff --git a/src/RelLib.py b/src/RelLib.py index ba5703e67..4a7b2a27b 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -81,11 +81,39 @@ class Photo: # #------------------------------------------------------------------------- class Attribute: - def __init__(self): - self.type = "" - self.value = "" - self.source_ref = SourceRef() - self.note = Note() + def __init__(self,source=None): + if source: + self.type = source.type + self.value = source.value + if source.source_ref: + self.source_ref = SourceRef(source.source_ref) + else: + self.source_ref = None + if source.note: + self.note = Note(source.note) + else: + self.note = None + self.confidence = 2 + self.private = 0 + else: + self.type = "" + self.value = "" + self.source_ref = None + self.note = Note() + self.confidence = 2 + self.private = 0 + + def setPrivacy(self,val): + self.private = val + + def getPrivacy(self): + return self.private + + def setConfidence(self,val): + self.confidence = val + + def getConfidence(self): + return self.confidence def setNote(self,text): self.note.set(text) @@ -103,6 +131,8 @@ class Attribute: self.source_ref = id def getSourceRef(self) : + if not self.source_ref: + self.source_ref = SourceRef() return self.source_ref def setType(self,val): @@ -123,27 +153,66 @@ class Attribute: # #------------------------------------------------------------------------- class Address: - def __init__(self): - self.street = "" - self.city = "" - self.state = "" - self.country = "" - self.postal = "" - self.date = Date() - self.note = Note() - self.source_ref = SourceRef() + def __init__(self,source=None): + if source: + self.street = source.street + self.city = source.city + self.state = source.state + self.country = source.country + self.postal = source.postal + self.date = Date(source.date) + if source.source_ref: + self.source_ref = SourceRef(source.source_ref) + else: + self.source_ref = None + if source.note: + self.note = Note(source.note) + else: + self.note = None + self.confidence = source.confidence + self.private = source.private + else: + self.street = "" + self.city = "" + self.state = "" + self.country = "" + self.postal = "" + self.date = Date() + self.note = None + self.source_ref = None + self.confidence = 2 + self.private = 0 + + def setPrivacy(self,val): + self.private = val + + def getPrivacy(self): + return self.private + + def setConfidence(self,val): + self.confidence = val + + def getConfidence(self): + return self.confidence def setSourceRef(self,id) : self.source_ref = id def getSourceRef(self) : + if not self.source_ref: + self.source_ref = SourceRef() return self.source_ref def setNote(self,text): + if self.note == None: + self.note = Note() self.note.set(text) def getNote(self): - return self.note.get() + if self.note == None: + return "" + else: + return self.note.get() def setNoteObj(self,obj): self.note = obj @@ -197,13 +266,43 @@ class Address: #------------------------------------------------------------------------- class Name: - def __init__(self): - self.FirstName = "" - self.Surname = "" - self.Suffix = "" - self.Title = "" - self.source_ref = None - self.note = None + def __init__(self,source=None): + if source: + self.FirstName = source.FirstName + self.Surname = source.Surname + self.Suffix = source.Suffix + self.Title = source.Title + if source.source_ref: + self.source_ref = SourceRef(source.source_ref) + else: + self.source_ref = None + if source.note: + self.note = Note(source.note) + else: + self.note = None + self.private = 0 + self.confidence = 2 + else: + self.FirstName = "" + self.Surname = "" + self.Suffix = "" + self.Title = "" + self.source_ref = None + self.note = None + self.private = 0 + self.confidence = 2 + + def setPrivacy(self,val): + self.private = val + + def getPrivacy(self): + return self.private + + def setConfidence(self,val): + self.confidence = val + + def getConfidence(self): + return self.confidence def setName(self,first,last,suffix): self.FirstName = first @@ -280,9 +379,21 @@ class Name: #------------------------------------------------------------------------- class Url: - def __init__(self,path="",desc=""): - self.path = path - self.desc = desc + def __init__(self,source=None): + if source: + self.path = source.path + self.desc = source.desc + self.private = source.private + else: + self.path = "" + self.desc = "" + self.private = 0 + + def setPrivacy(self,val): + self.private = val + + def getPrivacy(self): + return self.private def set_path(self,path): self.path = path @@ -342,12 +453,18 @@ class Person: def getAlternateNames(self): return self.alternateNames + def setAlternateNames(self,list): + self.alternateNames = list + def addAlternateName(self,name): self.alternateNames.append(name) def getUrlList(self): return self.urls + def setUrlList(self,list): + self.urls = list + def addUrl(self,url): self.urls.append(url) @@ -430,6 +547,9 @@ class Person: def getAddressList(self) : return self.addressList + def setAddressList(self,list) : + self.addressList = list + def addAttribute(self,attribute) : self.attributeList.append(attribute) @@ -444,6 +564,9 @@ class Person: def getAttributeList(self) : return self.attributeList + def setAttributeList(self,list) : + self.attributeList = list + def getAltFamilyList(self) : return self.AltFamilyList @@ -506,7 +629,9 @@ class Event: if source.note: self.note = Note(source.note) else: - self.source_ref = None + self.note = None + self.confidence = source.confidence + self.private = source.private else: self.place = "" self.date = Date() @@ -514,6 +639,20 @@ class Event: self.name = "" self.source_ref = None self.note = None + self.confidence = 2 + self.private = 0 + + def setPrivacy(self,val): + self.private = val + + def getPrivacy(self): + return self.private + + def setConfidence(self,val): + self.confidence = val + + def getConfidence(self): + return self.confidence def set(self,name,date,place,description): self.name = name diff --git a/src/WriteXML.py b/src/WriteXML.py index 453df86c7..81dfb0147 100644 --- a/src/WriteXML.py +++ b/src/WriteXML.py @@ -59,9 +59,12 @@ def fix(line): # # #------------------------------------------------------------------------- -def writeNote(g,val,note): +def writeNote(g,val,note,indent=0): if not note: return + if indent != 0: + g.write(" " * indent) + g.write("<" + val + ">") g.write(fix(note)) g.write("\n") @@ -87,18 +90,20 @@ def dump_my_event(g,name,event): date = event.getSaveDate() place = event.getPlace() description = event.getDescription() - if not name and not date and not place and not description: + if (not name or name == "Birth" or name == "Death") and \ + not date and not place and not description: return - g.write("\n") - write_line(g,"date",date) - write_line(g,"place",place) - write_line(g,"description",description) + g.write(' \n' % \ + (fix(name),event.getConfidence(),event.getPrivacy())) + write_line(g,"date",date,3) + write_line(g,"place",place,3) + write_line(g,"description",description,3) if event.getNote() != "": - writeNote(g,"note",event.getNote()) + writeNote(g,"note",event.getNote(),3) dump_source_ref(g,event.getSourceRef()) - g.write("\n") + g.write(" \n") #------------------------------------------------------------------------- # @@ -139,7 +144,7 @@ def write_ref(g,label,person): #------------------------------------------------------------------------- def write_id(g,label,person): if person: - g.write('<%s id="%s">\n' % (label,person.getId())) + g.write(' <%s id="%s">\n' % (label,person.getId())) #------------------------------------------------------------------------- # @@ -159,9 +164,9 @@ def write_family_id(g,family): # # #------------------------------------------------------------------------- -def write_line(g,label,value): +def write_line(g,label,value,indent=1): if value: - g.write('<%s>%s\n' % (label,fix(value),label)) + g.write('%s<%s>%s\n' % (' '*indent,label,fix(value),label)) #------------------------------------------------------------------------- # @@ -169,16 +174,17 @@ def write_line(g,label,value): # #------------------------------------------------------------------------- def dump_name(g,label,name): - g.write('<%s>\n' % label) - write_line(g,"first",name.getFirstName()) - write_line(g,"last",name.getSurname()) - write_line(g,"suffix",name.getSuffix()) - write_line(g,"title",name.getTitle()) + g.write(' <%s conf="%s" priv="%s">\n' % \ + (label,name.getConfidence(),name.getPrivacy())) + write_line(g,"first",name.getFirstName(),3) + write_line(g,"last",name.getSurname(),3) + write_line(g,"suffix",name.getSuffix(),3) + write_line(g,"title",name.getTitle(),3) if name.getNote() != "": writeNote(g,"note",name.getNote()) dump_source_ref(g,name.getSourceRef()) - g.write('\n' % label) + g.write(' \n' % label) #------------------------------------------------------------------------- # @@ -209,27 +215,27 @@ def exportData(database, filename, callback): g.write("\n") g.write("\n") - g.write("
\n") - g.write("\n") + g.write(" \n" % len(database.getFamilyMap().values())) - g.write("\n") - write_line(g,"resname",owner.getName()) - write_line(g,"resaddr",owner.getAddress()) - write_line(g,"rescity",owner.getCity()) - write_line(g,"resstate",owner.getState()) - write_line(g,"rescountry",owner.getCountry()) - write_line(g,"respostal",owner.getPostalCode()) - write_line(g,"resphone",owner.getPhone()) - write_line(g,"resemail",owner.getEmail()) - g.write("\n") - g.write("
\n") + g.write(" \n") + write_line(g,"resname",owner.getName(),3) + write_line(g,"resaddr",owner.getAddress(),3) + write_line(g,"rescity",owner.getCity(),3) + write_line(g,"resstate",owner.getState(),3) + write_line(g,"rescountry",owner.getCountry(),3) + write_line(g,"respostal",owner.getPostalCode(),3) + write_line(g,"resphone",owner.getPhone(),3) + write_line(g,"resemail",owner.getEmail(),3) + g.write(" \n") + g.write(" \n") - g.write("\n") total = len(personList) + len(familyList) @@ -243,9 +249,9 @@ def exportData(database, filename, callback): write_id(g,"person",person) if person.getGender() == Person.male: - write_line(g,"gender","M") + write_line(g,"gender","M",2) else: - write_line(g,"gender","F") + write_line(g,"gender","F",2) dump_name(g,"name",person.getPrimaryName()) for name in person.getAlternateNames(): dump_name(g,"aka",name) @@ -272,7 +278,8 @@ def exportData(database, filename, callback): if len(person.getAddressList()) > 0: g.write("\n") for address in person.getAddressList(): - g.write('
\n') + g.write('
\n' % \ + (address.getConfidence(), address.getPrivacy())) write_line(g,"date",address.getDateObj().getSaveDate()) write_line(g,"street",address.getStreet()) write_line(g,"city",address.getCity()) @@ -289,7 +296,9 @@ def exportData(database, filename, callback): g.write("\n") for attr in person.getAttributeList(): if attr.getSourceRef() or attr.getNote(): - g.write('\n') + g.write('\n' % \ + (attr.getConfidence(),attr.getPrivacy())) + write_line(g,"attr_type",attr.getType()) write_line(g,"attr_value",attr.getValue()) dump_source_ref(g,attr.getSourceRef()) @@ -304,7 +313,7 @@ def exportData(database, filename, callback): if len(person.getUrlList()) > 0: g.write("\n") for url in person.getUrlList(): - g.write('\n') diff --git a/src/const.py b/src/const.py index a34aa13ce..bd06c6d0c 100644 --- a/src/const.py +++ b/src/const.py @@ -112,6 +112,18 @@ childRelations = { _("Unknown") : "Unknown", } +#------------------------------------------------------------------------- +# +# Confidence +# +#------------------------------------------------------------------------- +confidence = [ _("Very Low"), + _("Low"), + _("Normal"), + _("High"), + _("Very High") + ] + #------------------------------------------------------------------------- # # Family event string mappings @@ -453,3 +465,4 @@ marriageEvents = initialize_marriage_event_list() familyAttributes = initialize_family_attribute_list() familyRelations = initialize_family_relation_list() places = [] +surnames = [] diff --git a/src/gramps_main.py b/src/gramps_main.py index f51e6f842..69e94266a 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -94,8 +94,6 @@ bookmarks = None id2col = {} -surnameList = [] - topWindow = None statusbar = None gtop = None @@ -817,8 +815,8 @@ def read_file(filename): for person in database.getPersonMap().values(): lastname = person.getPrimaryName().getSurname() - if lastname and lastname not in surnameList: - surnameList.append(lastname) + if lastname and lastname not in const.surnames: + const.surnames.append(lastname) full_update() statusbar.set_progress(0.0) @@ -1736,11 +1734,9 @@ def update_after_edit(person): #------------------------------------------------------------------------- def load_person(person): if person == None: - EditPerson.EditPerson(Person(),database,surnameList,\ - new_after_edit) + EditPerson.EditPerson(Person(),database,new_after_edit) else: - EditPerson.EditPerson(person,database,surnameList,\ - update_after_edit) + EditPerson.EditPerson(person,database,update_after_edit) #------------------------------------------------------------------------- # @@ -2175,7 +2171,8 @@ def apply_filter(): name = name_tuple[0] if datacomp(person): - id2col[person] = i + if not alt: + id2col[person] = i if person.getGender(): gender = const.male else: