From ca35f8de21ccd4384ed9fa9e5a4f785e49c6a604 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Tue, 4 Apr 2006 23:20:47 +0000 Subject: [PATCH] define cellrenderer svn: r6266 --- gramps2/src/GrampsWidgets.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/gramps2/src/GrampsWidgets.py b/gramps2/src/GrampsWidgets.py index a734d15bf..31fba0dfa 100644 --- a/gramps2/src/GrampsWidgets.py +++ b/gramps2/src/GrampsWidgets.py @@ -350,6 +350,10 @@ class MonitoredMenu: self.get_val = get_val self.obj = obj + cell = gtk.CellRendererText() + self.obj.pack_start(cell, True) + self.obj.add_attribute(cell, 'text', 0) + self.model = gtk.ListStore(str,int) for t,v in mapping: self.model.append(row=[t,v]) @@ -374,8 +378,16 @@ class MonitoredStrMenu: self.get_val = get_val self.obj = obj - self.model = gtk.ListStore(str,int) - self.model.append(row=['',0]) + self.model = gtk.ListStore(str) + + cell = gtk.CellRendererText() + self.obj.pack_start(cell, True) + self.obj.add_attribute(cell, 'text', 0) + + if len(mapping) > 20: + self.obj.set_wrap_width(3) + + self.model.append(row=['']) index = 0 self.data = [''] @@ -383,14 +395,14 @@ class MonitoredStrMenu: active = 0 for t,v in mapping: - self.model.append(row=[t,index]) - self.data.append(v) + self.model.append(row=[v]) + self.data.append(t) if v == default: active = index index += 1 self.obj.set_model(self.model) - self.obj.set_active(index) + self.obj.set_active(active) self.obj.connect('changed',self.on_change) self.obj.set_sensitive(not readonly)