layout improvements

svn: r5744
This commit is contained in:
Richard Taylor 2006-01-13 15:28:23 +00:00
parent 96a4ba566e
commit 2892a0e464
4 changed files with 123 additions and 123 deletions

View File

@ -1,3 +1,8 @@
2006-01-13 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/ObjectSelector/_ObjectSelectorWindow.py: layout improvements
* src/ObjectSelector/_PersonPreviewFrame.py: layout improvements
* src/ObjectSelector/_PersonSearchCriteriaWidget.py: layout improvements
2006-01-12 Don Allingham <don@gramps-project.org> 2006-01-12 Don Allingham <don@gramps-project.org>
* src/DisplayTabs.py: sub tabs for edit dialogs * src/DisplayTabs.py: sub tabs for edit dialogs
* src/EditFamily.py: family editor integration * src/EditFamily.py: family editor integration

View File

@ -20,6 +20,8 @@ class ObjectSelectorWindow(gtk.Window):
# Selected object label # Selected object label
label = gtk.Label("Selected:") label = gtk.Label("Selected:")
label.set_alignment(xalign=1,yalign=0.5)
sel_label = gtk.Label("No Selected Object") sel_label = gtk.Label("No Selected Object")
sel_frame = gtk.Frame() sel_frame = gtk.Frame()
sel_frame.set_shadow_type(gtk.SHADOW_IN) 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(label,False,False)
label_box.pack_start(sel_frame,True,True) label_box.pack_start(sel_frame,True,True)
# Toolbar # Object select
# FIXME: This should be done somewhere central obj_label = gtk.Label("Show")
factory = gtk.IconFactory() obj_label.set_alignment(xalign=1,yalign=0.5)
pixbuf = gtk.gdk.pixbuf_new_from_file("person.svg") person_pixbuf = gtk.gdk.pixbuf_new_from_file("../person.svg")
iconset = gtk.IconSet(pixbuf) flist_pixbuf = gtk.gdk.pixbuf_new_from_file("../flist.svg")
factory.add('gramps-person', iconset)
pixbuf = gtk.gdk.pixbuf_new_from_file("flist.svg") tool_list = gtk.ListStore(gtk.gdk.Pixbuf, str,int)
iconset = gtk.IconSet(pixbuf) tool_list.append([person_pixbuf,'People',0])
factory.add('gramps-family', iconset) tool_list.append([flist_pixbuf,'Families',1])
tool_list.append([person_pixbuf,'Events',2])
factory.add_default()
tips = gtk.Tooltips() tool_combo = gtk.ComboBox(tool_list)
person_tool = gtk.ToolButton("gramps-person") icon_cell = gtk.CellRendererPixbuf()
person_tool.set_tooltip(tips,"Show People") label_cell = gtk.CellRendererText()
family_tool = gtk.ToolButton("gramps-family") tool_combo.pack_start(icon_cell, True)
family_tool.set_tooltip(tips,"Show Families") tool_combo.pack_start(label_cell, True)
event_tool = gtk.ToolButton("gramps-person") tool_combo.add_attribute(icon_cell, 'pixbuf', 0)
event_tool.set_tooltip(tips,"Show Events") tool_combo.add_attribute(label_cell, 'text', 1)
toolbar = gtk.Toolbar() tool_combo.set_active(0)
toolbar.insert(person_tool,0)
toolbar.insert(family_tool,1) tool_box = gtk.HBox()
toolbar.insert(event_tool,2) tool_box.pack_start(obj_label,False,False)
tool_box.pack_start(tool_combo,False,False)
# Top box # Top box
top_box = gtk.HBox() 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) top_box.pack_start(label_box,True,True)
# Filters # Filters
@ -128,6 +130,8 @@ class ObjectSelectorWindow(gtk.Window):
cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL) 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 = gtk.HButtonBox()
bottom_button_bar.set_layout(gtk.BUTTONBOX_SPREAD) bottom_button_bar.set_layout(gtk.BUTTONBOX_SPREAD)
bottom_button_bar.set_spacing(self.__class__.__default_border_width/2) bottom_button_bar.set_spacing(self.__class__.__default_border_width/2)
@ -160,5 +164,6 @@ if __name__ == "__main__":
w = ObjectSelectorWindow() w = ObjectSelectorWindow()
w.show_all() w.show_all()
w.connect("destroy", gtk.main_quit)
gtk.main() gtk.main()

View File

@ -19,7 +19,7 @@ class PersonPreviewFrame(gtk.Frame):
image = gtk.Image() image = gtk.Image()
# test image # test image
image.set_from_file("person.svg") image.set_from_file("../person.svg")
image_frame = gtk.Frame() image_frame = gtk.Frame()
image_frame.add(image) image_frame.add(image)

View File

@ -1,6 +1,8 @@
import gtk import gtk
import gobject import gobject
from _IntEdit import IntEdit
class PersonSearchCriteriaWidget(gtk.Frame): class PersonSearchCriteriaWidget(gtk.Frame):
__gproperties__ = {} __gproperties__ = {}
@ -17,40 +19,27 @@ class PersonSearchCriteriaWidget(gtk.Frame):
# Gramps ID # Gramps ID
id_check = gtk.CheckButton() id_check = gtk.CheckButton()
id_label = gtk.Label("Gramps ID:") id_label = gtk.Label("Gramps ID")
id_label.set_sensitive(False)
id_label.set_alignment(xalign=0,yalign=0.5) id_label.set_alignment(xalign=0,yalign=0.5)
id_edit = gtk.Entry() id_edit = gtk.Entry()
id_edit.set_sensitive(False) 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_edit.set_sensitive(id_check.get_active()))
id_check.connect('toggled',lambda b: id_label.set_sensitive(id_check.get_active()))
# Name # Name
name_check = gtk.CheckButton() name_check = gtk.CheckButton()
name_label = gtk.Label("Name:") name_label = gtk.Label("Name")
name_label.set_sensitive(False)
name_label.set_alignment(xalign=0,yalign=0.5) name_label.set_alignment(xalign=0,yalign=0.5)
name_edit = gtk.Entry() name_edit = gtk.Entry()
name_edit.set_sensitive(False) 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_edit.set_sensitive(name_check.get_active()))
name_check.connect('toggled',lambda b: name_label.set_sensitive(name_check.get_active()))
# Gender # Gender
gender_check = gtk.CheckButton() gender_check = gtk.CheckButton()
gender_label = gtk.Label("Gender:") gender_label = gtk.Label("Gender")
gender_label.set_sensitive(False)
gender_label.set_alignment(xalign=0,yalign=0.5) gender_label.set_alignment(xalign=0,yalign=0.5)
gender_combo = gtk.combo_box_new_text() gender_combo = gtk.combo_box_new_text()
@ -60,98 +49,73 @@ class PersonSearchCriteriaWidget(gtk.Frame):
gender_combo.set_active(2) gender_combo.set_active(2)
gender_combo.set_sensitive(False) 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_combo.set_sensitive(gender_check.get_active()))
gender_check.connect('toggled',lambda b: gender_label.set_sensitive(gender_check.get_active()))
# Birth # Birth
birth_check = gtk.CheckButton() birth_check = gtk.CheckButton()
birth_check.set_alignment(xalign=0,yalign=0) birth_check.set_alignment(xalign=0,yalign=0)
#birth_frame = gtk.Frame("Birth") b_label = gtk.Label("Birth Year")
#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.set_alignment(xalign=0,yalign=0) b_label.set_alignment(xalign=0,yalign=0)
b_edit = gtk.Entry() b_edit = IntEdit()
b_edit.set_sensitive(False)
b_before = gtk.RadioButton(group=None,label="Before") b_before = gtk.RadioButton(group=None,label="Before")
b_before.set_sensitive(False)
b_after = gtk.RadioButton(b_before,"After") b_after = gtk.RadioButton(b_before,"After")
b_after.set_sensitive(False)
b_before.set_active(True) b_before.set_active(True)
b_unknown = gtk.CheckButton("Include Unknown") b_unknown = gtk.CheckButton("Include Unknown")
b_unknown.set_sensitive(False)
b_unknown.set_active(True) 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 = gtk.HBox()
b_inner_box.pack_start(b_before) b_inner_box.pack_start(b_before)
b_inner_box.pack_start(b_after) 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
death_check = gtk.CheckButton() 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())) d_label = gtk.Label("Death Year")
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.set_alignment(xalign=0,yalign=0) d_label.set_alignment(xalign=0,yalign=0)
d_edit = gtk.Entry() d_edit = IntEdit()
d_edit.set_sensitive(False)
d_before = gtk.RadioButton(group=None,label="Before") d_before = gtk.RadioButton(group=None,label="Before")
d_before.set_sensitive(False)
d_after = gtk.RadioButton(d_before,"After") d_after = gtk.RadioButton(d_before,"After")
d_after.set_sensitive(False)
d_before.set_active(True) d_before.set_active(True)
d_before.set_sensitive(False)
d_unknown = gtk.CheckButton("Include Unknown") d_unknown = gtk.CheckButton("Include Unknown")
d_unknown.set_sensitive(False)
d_unknown.set_active(True) 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 = gtk.HBox()
d_inner_box.pack_start(d_before) d_inner_box.pack_start(d_before)
d_inner_box.pack_start(d_after) 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
filter_check = gtk.CheckButton() filter_check = gtk.CheckButton()
filter_label = gtk.Label("Filter:") filter_label = gtk.Label("Filter")
filter_label.set_sensitive(False)
filter_label.set_alignment(xalign=0,yalign=0.5) filter_label.set_alignment(xalign=0,yalign=0.5)
filter_combo = gtk.combo_box_new_text() filter_combo = gtk.combo_box_new_text()
@ -162,41 +126,67 @@ class PersonSearchCriteriaWidget(gtk.Frame):
filter_combo.set_sensitive(False) 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_combo.set_sensitive(filter_check.get_active()))
filter_check.connect('toggled',lambda b: filter_label.set_sensitive(filter_check.get_active()))
# table layout # table layout
table = gtk.Table(2,6,False) table = gtk.Table(3,6,False)
table.set_row_spacings(5) table.set_row_spacings(5)
table.set_col_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) label_col = 0
table.attach(name_box,1,2,1,2,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False) check_col = 1
control_col = 2
table.attach(gender_check,0,1,2,3,xoptions=False,yoptions=False) current_row = 0
table.attach(gender_box,1,2,2,3,xoptions=gtk.EXPAND|gtk.FILL,yoptions=False)
table.attach(birth_check,0,1,3,4,xoptions=False,yoptions=False) table.attach(id_check,check_col,check_col+1,current_row,current_row+1,xoptions=False,yoptions=False)
table.attach(birth_box,1,2,3,4,xoptions=gtk.EXPAND|gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL) 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(death_check,0,1,4,5,xoptions=False,yoptions=False) current_row +=1
table.attach(death_box,1,2,4,5,xoptions=gtk.EXPAND|gtk.FILL,yoptions=gtk.EXPAND|gtk.FILL)
table.attach(filter_check,0,1,5,6,xoptions=False,yoptions=False) table.attach(name_check,check_col,check_col+1,current_row,current_row+1,xoptions=False,yoptions=False)
table.attach(filter_box,1,2,5,6,xoptions=gtk.EXPAND|gtk.FILL,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)
current_row +=1
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)
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
apply_button = gtk.Button(stock=gtk.STOCK_APPLY) apply_button = gtk.Button(stock=gtk.STOCK_APPLY)
# Outer box # Outer box
outer_box = gtk.VBox() outer_box = gtk.VBox()