* src/gramps.glade: move alternate family view tab, assign a

few object names
* src/FamlyView.py: handle alternate family view
* src/preferences.glade: allow user to choose family view
* src/GrampsCfg.py: allow user to choose family view
* src/gramps_main.py: allow user to choose family view


svn: r2047
This commit is contained in:
Don Allingham 2003-08-26 03:45:41 +00:00
parent 808eacaa47
commit eb60bb7782
5 changed files with 762 additions and 638 deletions

View File

@ -64,19 +64,64 @@ class FamilyView:
def __init__(self,parent):
self.parent = parent
self.top = parent.gtop
self.ap_data = self.top.get_widget('ap_data')
self.family = None
self.init_interface()
def set_widgets(self,val):
if (val):
self.parent.views.get_nth_page(1).hide()
self.parent.views.get_nth_page(2).show()
self.ap_data = self.top.get_widget('ap_data2')
self.swap_btn = self.top.get_widget('swap_btn2')
self.ap_parents = self.top.get_widget('ap_parents2')
self.add_spouse_btn = self.top.get_widget('add_spouse2')
self.sp_parents = self.top.get_widget('sp_parents2')
self.spouse_list = self.top.get_widget('sp_list2')
self.select_spouse_btn = self.top.get_widget('select_spouse2')
self.remove_spouse_btn = self.top.get_widget('remove_spouse2')
self.child_list = self.top.get_widget('chlist2')
self.top.get_widget('add_parents2').connect('clicked',self.add_parents_clicked)
self.top.get_widget('del_parents2').connect('clicked',self.del_parents_clicked)
self.top.get_widget('add_spparents2').connect('clicked',self.add_sp_parents)
self.top.get_widget('del_spparents2').connect('clicked',self.del_sp_parents)
self.top.get_widget('fam_back2').connect('clicked',self.child_back)
self.top.get_widget('del_child_btn2').connect('clicked',self.remove_child_clicked)
self.top.get_widget('add_child_btn2').connect('clicked',self.add_child_clicked)
self.top.get_widget('select_child2').connect('clicked',self.select_child_clicked)
self.top.get_widget('ap_parents_btn2').connect('clicked',self.ap_parents_clicked)
self.top.get_widget('sp_parents_btn2').connect('clicked',self.sp_parents_clicked)
else:
self.parent.views.get_nth_page(1).show()
self.parent.views.get_nth_page(2).hide()
self.ap_data = self.top.get_widget('ap_data')
self.swap_btn = self.top.get_widget('swap_spouse_btn')
self.ap_parents = self.top.get_widget('ap_parents')
self.add_spouse_btn = self.top.get_widget('add_spouse')
self.sp_parents = self.top.get_widget('sp_parents')
self.spouse_list = self.top.get_widget('sp_list')
self.select_spouse_btn = self.top.get_widget('select_spouse')
self.remove_spouse_btn = self.top.get_widget('remove_spouse')
self.child_list = self.top.get_widget('chlist')
self.top.get_widget('add_parents').connect('clicked',self.add_parents_clicked)
self.top.get_widget('del_parents').connect('clicked',self.del_parents_clicked)
self.top.get_widget('add_spparents').connect('clicked',self.add_sp_parents)
self.top.get_widget('del_spparents').connect('clicked',self.del_sp_parents)
self.top.get_widget('fam_back').connect('clicked',self.child_back)
self.top.get_widget('del_child_btn').connect('clicked',self.remove_child_clicked)
self.top.get_widget('add_child_btn').connect('clicked',self.add_child_clicked)
self.top.get_widget('select_child').connect('clicked',self.select_child_clicked)
self.top.get_widget('ap_parents_btn').connect('clicked',self.ap_parents_clicked)
self.top.get_widget('sp_parents_btn').connect('clicked',self.sp_parents_clicked)
def init_interface(self):
self.set_widgets(GrampsCfg.familyview)
self.ap_model = gtk.ListStore(gobject.TYPE_STRING)
self.ap_data.set_model(self.ap_model)
column = gtk.TreeViewColumn('',gtk.CellRendererText(),text=0)
self.ap_data.append_column(column)
self.ap_data.connect('button-press-event',self.edit_active_person)
self.swap_btn = self.top.get_widget('swap_spouse_btn')
self.add_spouse_btn = self.top.get_widget('add_spouse')
self.select_spouse_btn = self.top.get_widget('select_spouse')
self.remove_spouse_btn = self.top.get_widget('remove_spouse')
self.ap_parents = self.top.get_widget('ap_parents')
self.ap_parents_model = gtk.ListStore(gobject.TYPE_STRING)
self.ap_parents.set_model(self.ap_parents_model)
self.ap_selection = self.ap_parents.get_selection()
@ -84,7 +129,6 @@ class FamilyView:
self.ap_parents.append_column(column)
self.ap_parents.connect('button-press-event',self.edit_ap_parents)
self.sp_parents = self.top.get_widget('sp_parents')
self.sp_parents_model = gtk.ListStore(gobject.TYPE_STRING)
self.sp_parents.set_model(self.sp_parents_model)
self.sp_selection = self.sp_parents.get_selection()
@ -92,28 +136,16 @@ class FamilyView:
self.sp_parents.append_column(column)
self.sp_parents.connect('button-press-event',self.edit_sp_parents)
self.spouse_list = self.top.get_widget('sp_list')
self.spouse_model = gtk.ListStore(gobject.TYPE_STRING)
self.spouse_list.set_model(self.spouse_model)
self.spouse_selection = self.spouse_list.get_selection()
self.spouse_selection.connect('changed',self.spouse_changed)
self.spouse_list.connect('button-press-event',self.edit_relationship)
self.top.get_widget('add_parents').connect('clicked',self.add_parents_clicked)
self.top.get_widget('del_parents').connect('clicked',self.del_parents_clicked)
self.top.get_widget('add_spparents').connect('clicked',self.add_sp_parents)
self.top.get_widget('del_spparents').connect('clicked',self.del_sp_parents)
self.top.get_widget('fam_back').connect('clicked',self.child_back)
self.top.get_widget('del_child_btn').connect('clicked',self.remove_child_clicked)
self.top.get_widget('add_child_btn').connect('clicked',self.add_child_clicked)
self.top.get_widget('select_child').connect('clicked',self.select_child_clicked)
column = gtk.TreeViewColumn('',gtk.CellRendererText(),text=0)
self.spouse_list.append_column(column)
self.selected_spouse = None
self.child_list = self.top.get_widget('chlist')
self.child_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
self.child_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.child_list.connect('drag_data_get', self.drag_data_get)
@ -129,9 +161,6 @@ class FamilyView:
self.child_list.connect('button-press-event',self.on_child_list_button_press)
self.top.get_widget('ap_parents_btn').connect('clicked',self.ap_parents_clicked)
self.top.get_widget('sp_parents_btn').connect('clicked',self.sp_parents_clicked)
self.swap_btn.connect('clicked',self.spouse_swap)
self.remove_spouse_btn.connect('clicked',self.remove_spouse)
self.add_spouse_btn.connect('clicked',self.add_spouse)
@ -141,8 +170,6 @@ class FamilyView:
self.child_list.set_search_column(0)
self.child_selection = self.child_list.get_selection()
self.family = None
Utils.build_columns(self.child_list,
[ ('',30,0), (_('Name'),250,-1), (_('ID'),50,-1),
(_('Gender'),100,-1), (_('Birth date'),150,6),

View File

@ -146,6 +146,7 @@ globalprop = 1
localprop = 1
capitalize = 0
defaultview = 0
familyview = 0
#-------------------------------------------------------------------------
#
@ -214,6 +215,7 @@ def loadConfig(call):
global localprop
global capitalize
global defaultview
global familyview
_callback = call
lastfile = get_string("/apps/gramps/last-file")
@ -232,6 +234,7 @@ def loadConfig(call):
status_bar = get_int("/apps/gramps/statusbar")
toolbar = get_int("/apps/gramps/toolbar",2)
defaultview = get_int("/apps/gramps/defaultview")
familyview = get_int("/apps/gramps/familyview")
autoload = get_bool("/apps/gramps/autoload",0)
autosave_int = get_int("/apps/gramps/auto-save-interval")
@ -607,6 +610,11 @@ class GrampsPreferences:
else:
self.top.get_widget('fvbutton').set_active(1)
if familyview == 0:
self.top.get_widget('familyview1').set_active(1)
else:
self.top.get_widget('familyview2').set_active(1)
paper_obj = self.top.get_widget("paper_size")
menu = gtk.Menu()
choice = 0
@ -812,6 +820,7 @@ class GrampsPreferences:
global status_bar
global toolbar
global defaultview
global familyview
global paper_preference
global output_preference
global goutput_preference
@ -860,6 +869,11 @@ class GrampsPreferences:
else:
defaultview = 1
if self.top.get_widget("familyview1").get_active():
familyview = 0
else:
familyview = 1
iprefix = self.top.get_widget("iprefix").get_text()
if iprefix == "":
iprefix = "I"
@ -907,6 +921,7 @@ class GrampsPreferences:
set_int("/apps/gramps/statusbar",status_bar)
set_int("/apps/gramps/toolbar",toolbar)
set_int("/apps/gramps/defaultview",defaultview)
set_int("/apps/gramps/familyview",familyview)
set_string("/apps/gramps/paper-preference",paper_preference)
set_string("/apps/gramps/output-preference",output_preference)
set_string("/apps/gramps/goutput-preference",goutput_preference)

File diff suppressed because it is too large Load Diff

View File

@ -89,6 +89,14 @@ _BUGREPORT = "http://sourceforge.net/tracker/?group_id=25770&atid=385137"
_sel_mode = gtk.SELECTION_MULTIPLE
PERSON_VIEW = 0
FAMILY_VIEW1 = 1
FAMILY_VIEW2 = 2
PEDIGREE_VIEW = 3
SOURCE_VIEW = 4
PLACE_VIEW = 5
MEDIA_VIEW = 6
#-------------------------------------------------------------------------
#
# Main GRAMPS class
@ -410,6 +418,7 @@ class Gramps:
"on_edit_bookmarks_activate" : self.on_edit_bookmarks_activate,
"on_exit_activate" : self.on_exit_activate,
"on_family1_activate" : self.on_family1_activate,
"on_family2_activate" : self.on_family2_activate,
"on_find_activate" : self.on_find_activate,
"on_findname_activate" : self.on_findname_activate,
"on_home_clicked" : self.on_home_clicked,
@ -652,35 +661,35 @@ class Gramps:
def edit_button_clicked(self,obj):
cpage = self.views.get_current_page()
if cpage == 0:
if cpage == PERSON_VIEW:
self.load_selected_people(obj)
elif cpage == 3:
elif cpage == SOURCE_VIEW:
self.source_view.on_edit_clicked(obj)
elif cpage == 4:
elif cpage == PLACE_VIEW:
self.place_view.on_edit_clicked(obj)
elif cpage == 5:
elif cpage == MEDIA_VIEW:
self.media_view.on_edit_clicked(obj)
def add_button_clicked(self,obj):
cpage = self.views.get_current_page()
if cpage == 0:
if cpage == PERSON_VIEW:
self.load_new_person(obj)
elif cpage == 3:
elif cpage == SOURCE_VIEW:
self.source_view.on_add_clicked(obj)
elif cpage == 4:
elif cpage == PLACE_VIEW:
self.place_view.on_add_place_clicked(obj)
elif cpage == 5:
elif cpage == MEDIA_VIEW:
self.media_view.on_add_clicked(obj)
def remove_button_clicked(self,obj):
cpage = self.views.get_current_page()
if cpage == 0:
if cpage == PERSON_VIEW:
self.delete_person_clicked(obj)
elif cpage == 3:
elif cpage == SOURCE_VIEW:
self.source_view.on_delete_clicked(obj)
elif cpage == 4:
elif cpage == PLACE_VIEW:
self.place_view.on_delete_clicked(obj)
elif cpage == 5:
elif cpage == MEDIA_VIEW:
self.media_view.on_delete_clicked(obj)
def enable_buttons(self,val):
@ -758,17 +767,17 @@ class Gramps:
def on_find_activate(self,obj):
"""Display the find box"""
if self.views.get_current_page() == 4:
if self.views.get_current_page() == PLACE_VIEW:
if self.find_place:
self.find_place.show()
else:
self.find_place = Find.FindPlace(self.find_goto_place,self.db)
elif self.views.get_current_page() == 3:
elif self.views.get_current_page() == SOURCE_VIEW:
if self.find_source:
self.find_source.show()
else:
Find.FindSource(self.find_goto_source,self.db)
elif self.views.get_current_page() == 5:
elif self.views.get_current_page() == MEDIA_VIEW:
if self.find_media:
self.find_media.show()
else:
@ -813,7 +822,7 @@ class Gramps:
def on_merge_activate(self,obj):
"""Calls up the merge dialog for the selection"""
page = self.views.get_current_page()
if page == 0:
if page == PERSON_VIEW:
mlist = self.person_tree.get_selected_objects()
@ -829,7 +838,7 @@ class Gramps:
p2 = self.db.getPerson(mlist[1])
MergeData.MergePeople(self.db,p1,p2,self.merge_update,
self.update_after_edit)
elif page == 4:
elif page == PLACE_VIEW:
self.place_view.merge()
def delete_event(self,widget, event):
@ -1036,18 +1045,18 @@ class Gramps:
def update_display(self,changed):
"""Incremental display update, update only the displayed page"""
page = self.views.get_current_page()
if page == 0:
if page == PERSON_VIEW:
if changed:
self.apply_filter()
else:
self.goto_active_person()
elif page == 1:
elif page == FAMILY_VIEW1 or page == FAMILY_VIEW2:
self.family_view.load_family()
elif page == 2:
elif page == PEDIGREE_VIEW:
self.pedigree_view.load_canvas(self.active_person)
elif page == 3:
elif page == SOURCE_VIEW:
self.source_view.load_sources()
elif page == 4:
elif page == PLACE_VIEW:
if len(self.db.getPlaceKeys()) > 2000:
self.status_text(_('Updating display - this may take a few seconds...'))
else:
@ -1784,19 +1793,23 @@ class Gramps:
def on_person_list1_activate(self,obj):
"""Switches to the person list view"""
self.views.set_current_page(0)
self.views.set_current_page(PERSON_VIEW)
def on_family1_activate(self,obj):
"""Switches to the family view"""
self.views.set_current_page(1)
self.views.set_current_page(FAMILY_VIEW1)
def on_family2_activate(self,obj):
"""Switches to the family view"""
self.views.set_current_page(FAMILY_VIEW2)
def on_pedigree1_activate(self,obj):
"""Switches to the pedigree view"""
self.views.set_current_page(2)
self.views.set_current_page(PEDIGREE_VIEW)
def on_sources_activate(self,obj):
"""Switches to the sources view"""
self.views.set_current_page(3)
self.views.set_current_page(SOURCE_VIEW)
def on_places_activate(self,obj):
"""Switches to the places view"""
@ -1804,36 +1817,36 @@ class Gramps:
self.status_text(_('Updating display - this may take a few seconds...'))
else:
self.status_text(_('Updating display...'))
self.views.set_current_page(4)
self.views.set_current_page(PLACE_VIEW)
self.modify_statusbar()
def on_media_activate(self,obj):
"""Switches to the media view"""
self.views.set_current_page(5)
self.views.set_current_page(MEDIA_VIEW)
def on_views_switch_page(self,obj,junk,page):
"""Load the appropriate page after a notebook switch"""
if page == 0:
if page == PERSON_VIEW:
self.enable_buttons(1)
self.goto_active_person()
self.merge_button.set_sensitive(1)
elif page == 1:
elif page == FAMILY_VIEW1 or page == FAMILY_VIEW2:
self.enable_buttons(0)
self.merge_button.set_sensitive(0)
self.family_view.load_family()
elif page == 2:
elif page == PEDIGREE_VIEW:
self.enable_buttons(0)
self.merge_button.set_sensitive(0)
self.pedigree_view.load_canvas(self.active_person)
elif page == 3:
elif page == SOURCE_VIEW:
self.enable_buttons(1)
self.merge_button.set_sensitive(0)
self.source_view.load_sources()
elif page == 4:
elif page == PLACE_VIEW:
self.enable_buttons(1)
self.place_view.load_places()
self.merge_button.set_sensitive(1)
elif page == 5:
elif page == MEDIA_VIEW:
self.enable_buttons(1)
self.merge_button.set_sensitive(0)
self.media_view.load_media()

View File

@ -735,7 +735,7 @@
<widget class="GtkTable" id="table15">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">8</property>
<property name="n_rows">9</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -782,8 +782,8 @@
<packing>
<property name="left_attach">0</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>
@ -872,8 +872,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -895,8 +895,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -918,8 +918,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -967,7 +967,7 @@
<widget class="GtkTable" id="table16">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">6</property>
<property name="n_rows">11</property>
<property name="n_columns">2</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@ -989,8 +989,8 @@
<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">9</property>
<property name="bottom_attach">10</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -1012,8 +1012,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">10</property>
<property name="bottom_attach">11</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -1036,8 +1036,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -1111,6 +1111,75 @@
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label139">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Family view style&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</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>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">2</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>
</child>
<child>
<widget class="GtkRadioButton" id="familyview1">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Left to right</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_object_toggled" last_modification_time="Tue, 26 Aug 2003 03:33:34 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</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="GtkRadioButton" id="familyview2">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="label" translatable="yes">Top to bottom</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="active">False</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">familyview1</property>
<signal name="toggled" handler="on_object_toggled" last_modification_time="Tue, 26 Aug 2003 03:33:46 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
<packing>
<property name="padding">0</property>