@@ -116,6 +116,7 @@ class CombinedView(NavigationView):
116
116
('preferences.relation-shade' , True ),
117
117
('preferences.releditbtn' , True ),
118
118
('preferences.show-tags' , True ),
119
+ ('preferences.vertical-details' , True ),
119
120
)
120
121
121
122
def __init__ (self , pdata , dbstate , uistate , nav_group = 0 ):
@@ -142,6 +143,7 @@ def __init__(self, pdata, dbstate, uistate, nav_group=0):
142
143
self .show_siblings = self ._config .get ('preferences.family-siblings' )
143
144
self .show_details = self ._config .get ('preferences.family-details' )
144
145
self .show_tags = self ._config .get ('preferences.show-tags' )
146
+ self .vertical = self ._config .get ('preferences.vertical-details' )
145
147
self .use_shade = self ._config .get ('preferences.relation-shade' )
146
148
self .theme = self ._config .get ('preferences.relation-display-theme' )
147
149
self .toolbar_visible = config .get ('interface.toolbar-on' )
@@ -186,6 +188,7 @@ def config_update(self, client, cnxn_id, entry, data):
186
188
self .show_siblings = self ._config .get ('preferences.family-siblings' )
187
189
self .show_details = self ._config .get ('preferences.family-details' )
188
190
self .show_tags = self ._config .get ('preferences.show-tags' )
191
+ self .vertical = self ._config .get ('preferences.vertical-details' )
189
192
self .redraw ()
190
193
191
194
def build_tree (self ):
@@ -861,6 +864,49 @@ def drag_data_get(widget, context, sel_data, info, time):
861
864
sel_data .set (dnd_type .atom_drag_type , 8 , pickle .dumps (data ))
862
865
return drag_data_get
863
866
867
+ def info_box (self , handle ):
868
+ if self .vertical :
869
+ box = Gtk .Box (orientation = Gtk .Orientation .VERTICAL )
870
+ else :
871
+ box = Gtk .Box ()
872
+ box .set_spacing (6 )
873
+
874
+ person = self .dbstate .db .get_person_from_handle (handle )
875
+ if not person :
876
+ return box
877
+
878
+ birth = get_birth_or_fallback (self .dbstate .db , person )
879
+ label1 = widgets .MarkupLabel (self .format_box (birth , EventType .BIRTH ))
880
+ box .pack_start (label1 , False , False , 0 )
881
+
882
+ death = get_death_or_fallback (self .dbstate .db , person )
883
+ label2 = widgets .MarkupLabel (self .format_box (death , EventType .DEATH ))
884
+ box .pack_start (label2 , False , False , 0 )
885
+
886
+ return box
887
+
888
+ def format_box (self , event , main_type ):
889
+ if event :
890
+ dobj = event .get_date_object ()
891
+ pname = place_displayer .display_event (self .dbstate .db , event )
892
+ value = {
893
+ 'abbrev' : event .type .get_abbreviation (),
894
+ 'date' : displayer .display (dobj ),
895
+ 'place' : pname
896
+ }
897
+ else :
898
+ return ''
899
+
900
+ if pname and not dobj .is_empty ():
901
+ info = _ ('%(abbrev)s %(date)s in %(place)s' ) % value
902
+ else :
903
+ info = _ ('%(abbrev)s %(date)s%(place)s' ) % value
904
+
905
+ if event .type != main_type :
906
+ return '<i>%s</i>' % escape (info )
907
+ else :
908
+ return escape (info )
909
+
864
910
def info_string (self , handle ):
865
911
person = self .dbstate .db .get_person_from_handle (handle )
866
912
if not person :
@@ -1488,9 +1534,9 @@ def write_participant(self, person, attrs):
1488
1534
hbox .set_spacing (6 )
1489
1535
hbox .pack_start (link_label , False , False , 0 )
1490
1536
if self .show_details :
1491
- value = self .info_string (handle )
1492
- if value :
1493
- hbox .pack_start (widgets . MarkupLabel ( value ) , False , False , 0 )
1537
+ box = self .info_box (handle )
1538
+ if box :
1539
+ hbox .pack_start (box , False , False , 0 )
1494
1540
if button is not None :
1495
1541
hbox .pack_start (button , False , False , 0 )
1496
1542
if self .show_tags :
@@ -1814,9 +1860,9 @@ def write_person(self, title, handle):
1814
1860
hbox .set_spacing (6 )
1815
1861
hbox .pack_start (link_label , False , False , 0 )
1816
1862
if self .show_details :
1817
- value = self .info_string (handle )
1818
- if value :
1819
- hbox .pack_start (widgets . MarkupLabel ( value ) , False , False , 0 )
1863
+ box = self .info_box (handle )
1864
+ if box :
1865
+ hbox .pack_start (box , False , False , 0 )
1820
1866
if button is not None :
1821
1867
hbox .pack_start (button , False , False , 0 )
1822
1868
if self .show_tags :
@@ -1871,9 +1917,9 @@ def write_child(self, handle, index, child_should_be_linked):
1871
1917
person = self .dbstate .db .get_person_from_handle (handle )
1872
1918
hbox .pack_start (link_label , False , False , 0 )
1873
1919
if self .show_details :
1874
- value = self .info_string (handle )
1875
- if value :
1876
- hbox .pack_start (widgets . MarkupLabel ( value ) , False , False , 0 )
1920
+ box = self .info_box (handle )
1921
+ if box :
1922
+ hbox .pack_start (box , False , False , 0 )
1877
1923
if button is not None :
1878
1924
hbox .pack_start (button , False , False , 0 )
1879
1925
if self .show_tags :
@@ -2112,6 +2158,8 @@ def config_connect(self):
2112
2158
self .config_update )
2113
2159
self ._config .connect ("preferences.show-tags" ,
2114
2160
self .config_update )
2161
+ self ._config .connect ("preferences.vertical-details" ,
2162
+ self .config_update )
2115
2163
config .connect ("interface.toolbar-on" ,
2116
2164
self .shade_update )
2117
2165
@@ -2149,12 +2197,15 @@ def content_panel(self, configdialog):
2149
2197
configdialog .add_checkbox (grid ,
2150
2198
_ ('Show Details' ),
2151
2199
0 , 'preferences.family-details' )
2200
+ configdialog .add_checkbox (grid ,
2201
+ _ ('Vertical Details' ),
2202
+ 1 , 'preferences.vertical-details' )
2152
2203
configdialog .add_checkbox (grid ,
2153
2204
_ ('Show Siblings' ),
2154
- 1 , 'preferences.family-siblings' )
2205
+ 2 , 'preferences.family-siblings' )
2155
2206
configdialog .add_checkbox (grid ,
2156
2207
_ ('Show Tags' ),
2157
- 2 , 'preferences.show-tags' )
2208
+ 3 , 'preferences.show-tags' )
2158
2209
2159
2210
return _ ('Content' ), grid
2160
2211
0 commit comments