From 2892a0e464c47328b569c4359610a869e571412f Mon Sep 17 00:00:00 2001 From: Richard Taylor Date: Fri, 13 Jan 2006 15:28:23 +0000 Subject: [PATCH] layout improvements svn: r5744 --- gramps2/ChangeLog | 5 + .../ObjectSelector/_ObjectSelectorWindow.py | 61 +++--- .../src/ObjectSelector/_PersonPreviewFrame.py | 2 +- .../_PersonSearchCriteriaWidget.py | 178 +++++++++--------- 4 files changed, 123 insertions(+), 123 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 2a79bb202..58131521f 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2006-01-13 Richard Taylor + * src/ObjectSelector/_ObjectSelectorWindow.py: layout improvements + * src/ObjectSelector/_PersonPreviewFrame.py: layout improvements + * src/ObjectSelector/_PersonSearchCriteriaWidget.py: layout improvements + 2006-01-12 Don Allingham * src/DisplayTabs.py: sub tabs for edit dialogs * src/EditFamily.py: family editor integration diff --git a/gramps2/src/ObjectSelector/_ObjectSelectorWindow.py b/gramps2/src/ObjectSelector/_ObjectSelectorWindow.py index 497278117..808c971ba 100644 --- a/gramps2/src/ObjectSelector/_ObjectSelectorWindow.py +++ b/gramps2/src/ObjectSelector/_ObjectSelectorWindow.py @@ -20,6 +20,8 @@ class ObjectSelectorWindow(gtk.Window): # Selected object label label = gtk.Label("Selected:") + label.set_alignment(xalign=1,yalign=0.5) + sel_label = gtk.Label("No Selected Object") sel_frame = gtk.Frame() sel_frame.set_shadow_type(gtk.SHADOW_IN) @@ -30,41 +32,41 @@ class ObjectSelectorWindow(gtk.Window): label_box.pack_start(label,False,False) label_box.pack_start(sel_frame,True,True) - # Toolbar + # Object select - # FIXME: This should be done somewhere central - factory = gtk.IconFactory() - - pixbuf = gtk.gdk.pixbuf_new_from_file("person.svg") - iconset = gtk.IconSet(pixbuf) - factory.add('gramps-person', iconset) + obj_label = gtk.Label("Show") + obj_label.set_alignment(xalign=1,yalign=0.5) + + person_pixbuf = gtk.gdk.pixbuf_new_from_file("../person.svg") + flist_pixbuf = gtk.gdk.pixbuf_new_from_file("../flist.svg") - pixbuf = gtk.gdk.pixbuf_new_from_file("flist.svg") - iconset = gtk.IconSet(pixbuf) - factory.add('gramps-family', iconset) - - factory.add_default() - - tips = gtk.Tooltips() - - person_tool = gtk.ToolButton("gramps-person") - person_tool.set_tooltip(tips,"Show People") - - family_tool = gtk.ToolButton("gramps-family") - family_tool.set_tooltip(tips,"Show Families") - - event_tool = gtk.ToolButton("gramps-person") - event_tool.set_tooltip(tips,"Show Events") + tool_list = gtk.ListStore(gtk.gdk.Pixbuf, str,int) + tool_list.append([person_pixbuf,'People',0]) + tool_list.append([flist_pixbuf,'Families',1]) + tool_list.append([person_pixbuf,'Events',2]) - toolbar = gtk.Toolbar() - toolbar.insert(person_tool,0) - toolbar.insert(family_tool,1) - toolbar.insert(event_tool,2) + + tool_combo = gtk.ComboBox(tool_list) + + icon_cell = gtk.CellRendererPixbuf() + label_cell = gtk.CellRendererText() + + tool_combo.pack_start(icon_cell, True) + tool_combo.pack_start(label_cell, True) + + tool_combo.add_attribute(icon_cell, 'pixbuf', 0) + tool_combo.add_attribute(label_cell, 'text', 1) + tool_combo.set_active(0) + + tool_box = gtk.HBox() + tool_box.pack_start(obj_label,False,False) + tool_box.pack_start(tool_combo,False,False) + # Top box top_box = gtk.HBox() - top_box.pack_start(toolbar,True,True) + top_box.pack_start(tool_box,False,False) top_box.pack_start(label_box,True,True) # Filters @@ -128,6 +130,8 @@ class ObjectSelectorWindow(gtk.Window): cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL) + cancel_button.connect_object("clicked", gtk.Widget.destroy, self) + bottom_button_bar = gtk.HButtonBox() bottom_button_bar.set_layout(gtk.BUTTONBOX_SPREAD) bottom_button_bar.set_spacing(self.__class__.__default_border_width/2) @@ -160,5 +164,6 @@ if __name__ == "__main__": w = ObjectSelectorWindow() w.show_all() + w.connect("destroy", gtk.main_quit) gtk.main() diff --git a/gramps2/src/ObjectSelector/_PersonPreviewFrame.py b/gramps2/src/ObjectSelector/_PersonPreviewFrame.py index c124c4ec8..ae97ba7b4 100644 --- a/gramps2/src/ObjectSelector/_PersonPreviewFrame.py +++ b/gramps2/src/ObjectSelector/_PersonPreviewFrame.py @@ -19,7 +19,7 @@ class PersonPreviewFrame(gtk.Frame): image = gtk.Image() # test image - image.set_from_file("person.svg") + image.set_from_file("../person.svg") image_frame = gtk.Frame() image_frame.add(image) diff --git a/gramps2/src/ObjectSelector/_PersonSearchCriteriaWidget.py b/gramps2/src/ObjectSelector/_PersonSearchCriteriaWidget.py index f18419745..8ee5f8e0f 100644 --- a/gramps2/src/ObjectSelector/_PersonSearchCriteriaWidget.py +++ b/gramps2/src/ObjectSelector/_PersonSearchCriteriaWidget.py @@ -1,6 +1,8 @@ import gtk import gobject +from _IntEdit import IntEdit + class PersonSearchCriteriaWidget(gtk.Frame): __gproperties__ = {} @@ -17,40 +19,27 @@ class PersonSearchCriteriaWidget(gtk.Frame): # Gramps ID id_check = gtk.CheckButton() - id_label = gtk.Label("Gramps ID:") - id_label.set_sensitive(False) + id_label = gtk.Label("Gramps ID") id_label.set_alignment(xalign=0,yalign=0.5) id_edit = gtk.Entry() id_edit.set_sensitive(False) - - id_box = gtk.HBox() - id_box.pack_start(id_label,False,False) - id_box.pack_start(id_edit,True,True) id_check.connect('toggled',lambda b: id_edit.set_sensitive(id_check.get_active())) - id_check.connect('toggled',lambda b: id_label.set_sensitive(id_check.get_active())) # Name name_check = gtk.CheckButton() - name_label = gtk.Label("Name:") - name_label.set_sensitive(False) + name_label = gtk.Label("Name") name_label.set_alignment(xalign=0,yalign=0.5) name_edit = gtk.Entry() name_edit.set_sensitive(False) - name_box = gtk.HBox() - name_box.pack_start(name_label,False,False) - name_box.pack_start(name_edit,True,True) - name_check.connect('toggled',lambda b: name_edit.set_sensitive(name_check.get_active())) - name_check.connect('toggled',lambda b: name_label.set_sensitive(name_check.get_active())) # Gender gender_check = gtk.CheckButton() - gender_label = gtk.Label("Gender:") - gender_label.set_sensitive(False) + gender_label = gtk.Label("Gender") gender_label.set_alignment(xalign=0,yalign=0.5) gender_combo = gtk.combo_box_new_text() @@ -59,99 +48,74 @@ class PersonSearchCriteriaWidget(gtk.Frame): gender_combo.append_text("Unknown") gender_combo.set_active(2) gender_combo.set_sensitive(False) - - - gender_box = gtk.HBox() - gender_box.pack_start(gender_label,False,False) - gender_box.pack_start(gender_combo,True,True) gender_check.connect('toggled',lambda b: gender_combo.set_sensitive(gender_check.get_active())) - gender_check.connect('toggled',lambda b: gender_label.set_sensitive(gender_check.get_active())) # Birth birth_check = gtk.CheckButton() birth_check.set_alignment(xalign=0,yalign=0) - - #birth_frame = gtk.Frame("Birth") - #birth_frame.set_sensitive(False) - #birth_check.connect('toggled',lambda b: birth_frame.set_sensitive(birth_check.get_active())) - - birth_box = gtk.HBox() - birth_box.set_sensitive(False) - birth_check.connect('toggled',lambda b: birth_box.set_sensitive(birth_check.get_active())) - - b_label = gtk.Label("Birth:") + b_label = gtk.Label("Birth Year") b_label.set_alignment(xalign=0,yalign=0) - b_edit = gtk.Entry() - b_before = gtk.RadioButton(group=None,label="Before") + b_edit = IntEdit() + b_edit.set_sensitive(False) + + b_before = gtk.RadioButton(group=None,label="Before") + b_before.set_sensitive(False) + b_after = gtk.RadioButton(b_before,"After") + b_after.set_sensitive(False) b_before.set_active(True) + b_unknown = gtk.CheckButton("Include Unknown") + b_unknown.set_sensitive(False) b_unknown.set_active(True) + birth_check.connect('toggled',lambda b: b_edit.set_sensitive(birth_check.get_active())) + birth_check.connect('toggled',lambda b: b_before.set_sensitive(birth_check.get_active())) + birth_check.connect('toggled',lambda b: b_after.set_sensitive(birth_check.get_active())) + birth_check.connect('toggled',lambda b: b_unknown.set_sensitive(birth_check.get_active())) + b_inner_box = gtk.HBox() b_inner_box.pack_start(b_before) b_inner_box.pack_start(b_after) - b_box = gtk.VBox() - b_box.pack_start(b_edit,True,True) - b_box.pack_start(b_inner_box,False) - b_box.pack_start(b_unknown,False) - - b_align = gtk.Alignment() - b_align.set(0.5,0.5,1,1) - b_align.add(b_box) - - #birth_frame.add(b_align) - birth_box.pack_start(b_label,False,False) - birth_box.pack_start(b_align,True,True) - # Death death_check = gtk.CheckButton() - #death_frame = gtk.Frame("Death") - #death_frame.set_sensitive(False) - #death_check.connect('toggled',lambda b: death_frame.set_sensitive(death_check.get_active())) - - death_box = gtk.HBox() - death_box.set_sensitive(False) - death_check.connect('toggled',lambda b: death_box.set_sensitive(death_check.get_active())) - - d_label = gtk.Label("Death:") + d_label = gtk.Label("Death Year") d_label.set_alignment(xalign=0,yalign=0) - d_edit = gtk.Entry() - d_before = gtk.RadioButton(group=None,label="Before") + d_edit = IntEdit() + d_edit.set_sensitive(False) + + d_before = gtk.RadioButton(group=None,label="Before") + d_before.set_sensitive(False) + d_after = gtk.RadioButton(d_before,"After") + d_after.set_sensitive(False) + d_before.set_active(True) + d_before.set_sensitive(False) + d_unknown = gtk.CheckButton("Include Unknown") + d_unknown.set_sensitive(False) d_unknown.set_active(True) + death_check.connect('toggled',lambda b: d_edit.set_sensitive(death_check.get_active())) + death_check.connect('toggled',lambda b: d_before.set_sensitive(death_check.get_active())) + death_check.connect('toggled',lambda b: d_after.set_sensitive(death_check.get_active())) + death_check.connect('toggled',lambda b: d_unknown.set_sensitive(death_check.get_active())) + d_inner_box = gtk.HBox() d_inner_box.pack_start(d_before) d_inner_box.pack_start(d_after) - - d_box = gtk.VBox() - d_box.pack_start(d_edit,True,True) - d_box.pack_start(d_inner_box,False) - d_box.pack_start(d_unknown,False) - - d_align = gtk.Alignment() - b_align.set(0.5,0.5,1,1) - - d_align.add(d_box) - - #death_frame.add(d_align) - death_box.pack_start(d_label,False,False) - death_box.pack_start(d_align,True,True) # Filter filter_check = gtk.CheckButton() - filter_label = gtk.Label("Filter:") - filter_label.set_sensitive(False) + filter_label = gtk.Label("Filter") filter_label.set_alignment(xalign=0,yalign=0.5) filter_combo = gtk.combo_box_new_text() @@ -162,41 +126,67 @@ class PersonSearchCriteriaWidget(gtk.Frame): filter_combo.set_sensitive(False) - filter_box = gtk.HBox() - filter_box.pack_start(filter_label,False,False) - filter_box.pack_start(filter_combo,True,True) - filter_check.connect('toggled',lambda b: filter_combo.set_sensitive(filter_check.get_active())) - filter_check.connect('toggled',lambda b: filter_label.set_sensitive(filter_check.get_active())) # table layout - table = gtk.Table(2,6,False) + table = gtk.Table(3,6,False) table.set_row_spacings(5) table.set_col_spacings(5) - table.attach(id_check,0,1,0,1,xoptions=False,yoptions=False) - table.attach(id_box,1,2,0,1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) - table.attach(name_check,0,1,1,2,xoptions=False,yoptions=False) - table.attach(name_box,1,2,1,2,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) + label_col = 0 + check_col = 1 + control_col = 2 + + current_row = 0 + + table.attach(id_check,check_col,check_col+1,current_row,current_row+1,xoptions=False,yoptions=False) + table.attach(id_label,label_col,label_col+1,current_row,current_row+1,xoptions=gtk.FILL,yoptions=False) + table.attach(id_edit,control_col,control_col+1,current_row,current_row+1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) - table.attach(gender_check,0,1,2,3,xoptions=False,yoptions=False) - table.attach(gender_box,1,2,2,3,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) + current_row +=1 + + table.attach(name_check,check_col,check_col+1,current_row,current_row+1,xoptions=False,yoptions=False) + table.attach(name_label,label_col,label_col+1,current_row,current_row+1,xoptions=gtk.FILL,yoptions=False) + table.attach(name_edit,control_col,control_col+1,current_row,current_row+1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) - table.attach(birth_check,0,1,3,4,xoptions=False,yoptions=False) - table.attach(birth_box,1,2,3,4,xoptions=gtk.EXPAND|gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL) + current_row +=1 - table.attach(death_check,0,1,4,5,xoptions=False,yoptions=False) - table.attach(death_box,1,2,4,5,xoptions=gtk.EXPAND|gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL) + table.attach(gender_check,check_col,check_col+1,current_row,current_row+1,xoptions=False,yoptions=False) + table.attach(gender_label,label_col,label_col+1,current_row,current_row+1,xoptions=gtk.FILL,yoptions=False) + table.attach(gender_combo,control_col,control_col+1,current_row,current_row+1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) - table.attach(filter_check,0,1,5,6,xoptions=False,yoptions=False) - table.attach(filter_box,1,2,5,6,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) + + current_row +=1 + + table.attach(birth_check,check_col,check_col+1,current_row,current_row+1,xoptions=False,yoptions=False) + table.attach(b_label,label_col,label_col+1,current_row,current_row+1,xoptions=gtk.FILL,yoptions=False) + table.attach(b_edit,control_col,control_col+1,current_row,current_row+1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) + current_row +=1 + table.attach(b_inner_box,control_col,control_col+1,current_row,current_row+1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) + current_row +=1 + table.attach(b_unknown,control_col,control_col+1,current_row,current_row+1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) + + current_row +=1 + + table.attach(death_check,check_col,check_col+1,current_row,current_row+1,xoptions=False,yoptions=False) + table.attach(d_label,label_col,label_col+1,current_row,current_row+1,xoptions=gtk.FILL,yoptions=False) + table.attach(d_edit,control_col,control_col+1,current_row,current_row+1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) + current_row +=1 + table.attach(d_inner_box,control_col,control_col+1,current_row,current_row+1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) + current_row +=1 + table.attach(d_unknown,control_col,control_col+1,current_row,current_row+1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) + + current_row +=1 + + table.attach(filter_check,check_col,check_col+1,current_row,current_row+1,xoptions=False,yoptions=False) + table.attach(filter_label,label_col,label_col+1,current_row,current_row+1,xoptions=gtk.FILL,yoptions=False) + table.attach(filter_combo,control_col,control_col+1,current_row,current_row+1,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) # Apply apply_button = gtk.Button(stock=gtk.STOCK_APPLY) - - + # Outer box outer_box = gtk.VBox()