* src/GrampsWidgets.py: edit label for column header
svn: r5792
This commit is contained in:
parent
307c50c456
commit
a3acfecb1a
@ -1,4 +1,5 @@
|
||||
2006-01-18 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsWidgets.py: edit label for column header
|
||||
* src/DisplayTabs.py: mediatab improvements
|
||||
* src/EditFamily.py: monitor for changed people and update if needed,
|
||||
CellRendererCombo for child relations
|
||||
|
@ -366,10 +366,17 @@ class ChildModel(gtk.ListStore):
|
||||
index += 1
|
||||
|
||||
def display_rel(self,rtype):
|
||||
if rtype[0] == RelLib.Family.CUSTOM:
|
||||
return unicode(rtype[1])
|
||||
if type(rtype) == tuple:
|
||||
rel = rtype[0]
|
||||
val = rtype[1]
|
||||
else:
|
||||
return Utils.child_relations[rtype[0]]
|
||||
rel = rtype
|
||||
val = "???"
|
||||
|
||||
if rel == RelLib.Family.CUSTOM:
|
||||
return unicode(val)
|
||||
else:
|
||||
return Utils.child_relations[rel]
|
||||
|
||||
def column_father_rel(self,data):
|
||||
chandle = data.handle
|
||||
|
@ -120,18 +120,14 @@ class ChildEmbedList(EmbeddedList):
|
||||
continue
|
||||
name = self.column_names[pair[1]][0]
|
||||
if pair[1] == 4 or pair[1] == 5:
|
||||
model = gtk.ListStore(str,int)
|
||||
for x in Utils.child_relations.keys():
|
||||
model.append(row=[Utils.child_relations[x],x])
|
||||
render = gtk.CellRendererCombo()
|
||||
render.set_property('editable',True)
|
||||
render.set_property('model',model)
|
||||
render.set_property('text-column',0)
|
||||
|
||||
render = TypeCellRenderer(Utils.child_relations)
|
||||
column = gtk.TreeViewColumn(name, render, text=pair[1])
|
||||
column.set_widget(EditLabel(name))
|
||||
else:
|
||||
render = gtk.CellRendererText()
|
||||
column = gtk.TreeViewColumn(name, render, text=pair[1])
|
||||
|
||||
column = gtk.TreeViewColumn(name, render, text=pair[1])
|
||||
column = gtk.TreeViewColumn(name, render, text=pair[1])
|
||||
column.set_resizable(True)
|
||||
column.set_min_width(40)
|
||||
column.set_sort_column_id(self.column_names[pair[1]][1])
|
||||
|
@ -94,6 +94,15 @@ class LinkBox(gtk.HBox):
|
||||
self.pack_start(button,False)
|
||||
self.show()
|
||||
|
||||
class EditLabel(gtk.HBox):
|
||||
def __init__(self,text):
|
||||
gtk.HBox.__init__(self)
|
||||
self.pack_start(BasicLabel(text),False)
|
||||
self.pack_start(gtk.image_new_from_stock(gtk.STOCK_EDIT,
|
||||
gtk.ICON_SIZE_MENU),False)
|
||||
self.set_spacing(4)
|
||||
self.show_all()
|
||||
|
||||
class BasicLabel(gtk.Label):
|
||||
|
||||
def __init__(self,text):
|
||||
@ -101,7 +110,6 @@ class BasicLabel(gtk.Label):
|
||||
self.set_alignment(0,0.5)
|
||||
self.show()
|
||||
|
||||
|
||||
class MarkupLabel(gtk.Label):
|
||||
|
||||
def __init__(self,text):
|
||||
@ -110,7 +118,6 @@ class MarkupLabel(gtk.Label):
|
||||
self.set_use_markup(True)
|
||||
self.show()
|
||||
|
||||
|
||||
class IntEdit(gtk.Entry):
|
||||
"""An gtk.Edit widget that only allows integers."""
|
||||
|
||||
@ -140,3 +147,16 @@ class IntEdit(gtk.Entry):
|
||||
widget.handler_unblock(self._signal)
|
||||
# set the correct position in the widget
|
||||
widget.set_position(pos + len(text))
|
||||
|
||||
class TypeCellRenderer(gtk.CellRendererCombo):
|
||||
|
||||
def __init__(self,values):
|
||||
gtk.CellRendererCombo.__init__(self)
|
||||
|
||||
model = gtk.ListStore(str,int)
|
||||
for key in values:
|
||||
model.append(row=[values[key],key])
|
||||
self.set_property('editable',True)
|
||||
self.set_property('model',model)
|
||||
self.set_property('text-column',0)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user