From 9c9514b9f9301e0cc9d2ad7f80942b92d2b274e5 Mon Sep 17 00:00:00 2001 From: David Hampton Date: Tue, 30 Oct 2001 03:58:40 +0000 Subject: [PATCH] Added alternating colors the child list, like in the person list. Move the index number in the child list to the first column, and add an item to the preferences so that the user can make it visible. svn: r522 --- gramps/src/Config.py | 10 +++++++++ gramps/src/config.glade | 20 +++++++++++++++++ gramps/src/gramps.glade | 29 ++++++++++++------------ gramps/src/gramps_main.py | 47 +++++++++++++++++++++++++++------------ 4 files changed, 78 insertions(+), 28 deletions(-) diff --git a/gramps/src/Config.py b/gramps/src/Config.py index 11f46a694..318fefbb7 100644 --- a/gramps/src/Config.py +++ b/gramps/src/Config.py @@ -114,6 +114,7 @@ web_dir = "./" db_dir = "./" id_visible = 0 id_edit = 0 +index_visible = 0 #------------------------------------------------------------------------- # @@ -167,6 +168,7 @@ def loadConfig(call): global uncompress global id_visible global id_edit + global index_visible global show_detail global hide_altnames global lastfile @@ -191,6 +193,7 @@ def loadConfig(call): uncompress = gnome.config.get_bool("/gramps/config/DontCompressXML") id_visible = gnome.config.get_bool("/gramps/config/IdVisible") id_edit = gnome.config.get_bool("/gramps/config/IdEdit") + index_visible = gnome.config.get_bool("/gramps/config/IndexVisible") show_detail = gnome.config.get_bool("/gramps/config/ShowDetail") status_bar = gnome.config.get_int("/gramps/config/StatusBar") display_attr = gnome.config.get_bool("/gramps/config/DisplayAttr") @@ -286,6 +289,8 @@ def loadConfig(call): id_visible = 0 if id_edit == None: id_edit = 0 + if index_visible == None: + index_visible = 0 if show_detail == None: show_detail = 0 if status_bar == None: @@ -395,6 +400,7 @@ def on_propertybox_apply(obj,page): global uncompress global id_visible global id_edit + global index_visible global status_bar global display_attr global attr_name @@ -419,6 +425,7 @@ def on_propertybox_apply(obj,page): uncompress = prefsTop.get_widget("uncompress").get_active() id_visible = prefsTop.get_widget("gid_visible").get_active() id_edit = prefsTop.get_widget("gid_edit").get_active() + index_visible = prefsTop.get_widget("show_child_id").get_active() hide_altnames = prefsTop.get_widget("display_altnames").get_active() paper_obj = prefsTop.get_widget("paper_size").get_menu().get_active() output_obj = prefsTop.get_widget("output_format").get_menu().get_active() @@ -467,6 +474,7 @@ def on_propertybox_apply(obj,page): gnome.config.set_bool("/gramps/config/DontCompressXML",uncompress) gnome.config.set_bool("/gramps/config/IdVisible",id_visible) gnome.config.set_bool("/gramps/config/IdEdit",id_edit) + gnome.config.set_bool("/gramps/config/IndexVisible",index_visible) gnome.config.set_bool("/gramps/config/ShowDetail",show_detail) gnome.config.set_int("/gramps/config/StatusBar",status_bar) gnome.config.set_bool("/gramps/config/DisplayAttr",display_attr) @@ -618,6 +626,7 @@ def display_preferences_box(db): auto = prefsTop.get_widget("autoload") vis = prefsTop.get_widget("gid_visible") idedit = prefsTop.get_widget("gid_edit") + index_vis = prefsTop.get_widget("show_child_id") tabs = prefsTop.get_widget("usetabs") vc = prefsTop.get_widget("use_vc") vcom = prefsTop.get_widget("vc_comment") @@ -633,6 +642,7 @@ def display_preferences_box(db): compress.set_active(uncompress) vis.set_active(id_visible) idedit.set_active(id_edit) + index_vis.set_active(index_visible) prefsTop.get_widget("iprefix").set_text(iprefix) prefsTop.get_widget("oprefix").set_text(oprefix) diff --git a/gramps/src/config.glade b/gramps/src/config.glade index 36c301f3a..79e723acd 100644 --- a/gramps/src/config.glade +++ b/gramps/src/config.glade @@ -1351,6 +1351,26 @@ False + + + GtkCheckButton + show_child_id + True + + toggled + on_object_toggled + propertybox + Mon, 29 Oct 2001 22:58:03 GMT + + + False + True + + 0 + False + False + + diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index 8a9e83bfe..37ef5f70b 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -1933,11 +1933,25 @@ Mon, 08 Oct 2001 20:31:41 GMT 7 - 210,60,85,150,75,50,25 + 15,210,60,85,150,75,50 GTK_SELECTION_SINGLE True GTK_SHADOW_IN + + GtkLabel + CList:title + label15 + False + + GTK_JUSTIFY_RIGHT + False + 0.5 + 0.5 + 0 + 0 + + GtkHBox CList:title @@ -2102,19 +2116,6 @@ 0 0 - - - GtkLabel - CList:title - label15 - - GTK_JUSTIFY_CENTER - False - 0.5 - 0.5 - 0 - 0 - diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index 59ae26ad9..ac45cdf53 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -116,7 +116,11 @@ merge_button = None sort_column = 5 sort_direct = SORT_ASCENDING DataFilter = Filter.Filter("") -c_birth_order = 6 +c_birth_order = 0 +c_name = 1 +c_id = 2 +c_birth_date = 4 +c_details = 6 c_sort_column = c_birth_order c_sort_direct = SORT_ASCENDING @@ -433,8 +437,9 @@ def full_update(): person_list.clear() notebook.set_show_tabs(Config.usetabs) clist = gtop.get_widget("child_list") - clist.set_column_visibility(4,Config.show_detail) - clist.set_column_visibility(1,Config.id_visible) + clist.set_column_visibility(c_details,Config.show_detail) + clist.set_column_visibility(c_id,Config.id_visible) + clist.set_column_visibility(c_birth_order,Config.index_visible) apply_filter() load_family() load_sources() @@ -1090,10 +1095,10 @@ def on_child_list_select_row(obj,row,b,c): # #------------------------------------------------------------------------- def on_child_list_click_column(clist,column): - if column == 0: - child_change_sort(clist,0,gtop.get_widget("cNameSort")) - elif (column == 3) or (column == 6): - child_change_sort(clist,6,gtop.get_widget("cDateSort")) + if column == c_name: + child_change_sort(clist,c_name,gtop.get_widget("cNameSort")) + elif (column == c_birth_order) or (column == c_birth_date): + child_change_sort(clist,c_birth_order,gtop.get_widget("cDateSort")) else: return @@ -1133,6 +1138,21 @@ def child_change_sort(clist,column,arrow): def sort_child_list(clist): clist.freeze() clist.sort() + if ListColors.get_enable(): + try: + oddbg = GdkColor(ListColors.oddbg[0],ListColors.oddbg[1],ListColors.oddbg[2]) + oddfg = GdkColor(ListColors.oddfg[0],ListColors.oddfg[1],ListColors.oddfg[2]) + evenbg = GdkColor(ListColors.evenbg[0],ListColors.evenbg[1],ListColors.evenbg[2]) + evenfg = GdkColor(ListColors.evenfg[0],ListColors.evenfg[1],ListColors.evenfg[2]) + rows = clist.rows + for i in range(0,rows,2): + clist.set_background(i,oddbg) + clist.set_foreground(i,oddfg) + if i != rows: + clist.set_background(i+1,evenbg) + clist.set_foreground(i+1,evenfg) + except OverflowError: + pass clist.thaw() #------------------------------------------------------------------------- @@ -1197,7 +1217,7 @@ def on_child_list_row_move(clist,fm,to): # Update the clist indices so any change of sorting works i = 0 for tmp in clist_order: - clist.set_text(i, c_birth_order, "%2d"%new_order[tmp]) + clist.set_text(i, c_birth_order, "%2d"%(new_order[tmp]+1)) i = i + 1 # Need to save the changed order @@ -1818,8 +1838,8 @@ def display_marriage(family): if len(child.getPhotoList()) > 0: attr = attr + "P" - clist.append([Config.nameof(child),child.getId(),\ - gender,utils.birthday(child),status,attr,"%2d"%i]) + clist.append(["%2d"%(i+1),Config.nameof(child),child.getId(),\ + gender,utils.birthday(child),status,attr]) clist.set_row_data(i,child) i=i+1 if i != 0: @@ -1828,7 +1848,7 @@ def display_marriage(family): else: fv_prev.set_sensitive(0) clist.set_data("f",family) - clist.sort() + sort_child_list(clist) else: fv_prev.set_sensitive(0) @@ -2731,9 +2751,8 @@ def main(arg): database.set_sprefix(Config.sprefix) database.set_pprefix(Config.pprefix) child_list = gtop.get_widget("child_list") - child_list.set_column_visibility(4,Config.show_detail) - child_list.set_column_visibility(6,0) - child_list.set_column_visibility(7,0) + child_list.set_column_visibility(c_details,Config.show_detail) + child_list.set_column_justification(c_birth_order,JUSTIFY_RIGHT) if arg != None: read_file(arg)