From e4d71caea87c1b1d94569257c7cb6ef00be6c914 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 3 Jun 2006 04:31:59 +0000 Subject: [PATCH] * src/FilterEditor/_ShowResults.py: use list instead of text display svn: r6851 --- gramps2/ChangeLog | 1 + gramps2/src/FilterEditor/_EditFilter.py | 6 ++-- gramps2/src/FilterEditor/_ShowResults.py | 41 +++++++++++++++++------- gramps2/src/glade/rule.glade | 29 +++++++---------- 4 files changed, 45 insertions(+), 32 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 9e682a3d7..32fa1564a 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -10,6 +10,7 @@ * src/ReportBase.py: get_person_index -> get_person_mark 2006-06-02 Don Allingham + * src/FilterEditor/_ShowResults.py: use list instead of text display * src/FilterEditor/_EditFilter.py: clean up * src/FilterEditor/_EditRule.py: clean up * src/glade/rule.glade: clean up diff --git a/gramps2/src/FilterEditor/_EditFilter.py b/gramps2/src/FilterEditor/_EditFilter.py index 5efd37f32..5f1c1eaf5 100644 --- a/gramps2/src/FilterEditor/_EditFilter.py +++ b/gramps2/src/FilterEditor/_EditFilter.py @@ -92,7 +92,7 @@ class EditFilter(ManagedWindow.ManagedWindow): self.rule_list = self.glade.get_widget('rule_list') self.rlist = ListModel.ListModel( self.rule_list, - [(_('Name'),-1,150),(_('Value'),-1,150)], + [(_('Name'),-1,150),(_('Values'),-1,150)], self.select_row, self.on_edit_clicked) @@ -109,8 +109,8 @@ class EditFilter(ManagedWindow.ManagedWindow): self.del_btn.connect('clicked', self.on_delete_clicked) self.add_btn.connect('clicked', self.on_add_clicked) - self.glade.get_widget('help').('clicked', self.on_help_clicked) - self.glade.get_widget('cancel').('clicked', self.close_window) + self.glade.get_widget('help').connect('clicked', self.on_help_clicked) + self.glade.get_widget('cancel').connect('clicked', self.close_window) self.fname.connect('changed', self.filter_name_changed) if self.filter.get_logical_op() == 'or': diff --git a/gramps2/src/FilterEditor/_ShowResults.py b/gramps2/src/FilterEditor/_ShowResults.py index 5a34dcdb8..e02cdfce1 100644 --- a/gramps2/src/FilterEditor/_ShowResults.py +++ b/gramps2/src/FilterEditor/_ShowResults.py @@ -31,7 +31,7 @@ __author__ = "Don Allingham" # Python modules # #------------------------------------------------------------------------- -import os +import locale from gettext import gettext as _ #------------------------------------------------------------------------ @@ -49,8 +49,6 @@ log = logging.getLogger(".FilterEdit") #------------------------------------------------------------------------- import gtk import gtk.glade -import gobject -import GrampsDisplay #------------------------------------------------------------------------- # @@ -59,6 +57,7 @@ import GrampsDisplay #------------------------------------------------------------------------- import const import ManagedWindow +import NameDisplay #------------------------------------------------------------------------- # @@ -78,21 +77,39 @@ class ShowResults(ManagedWindow.ManagedWindow): self.glade.get_widget('title'), _('Filter Test')) - text = self.glade.get_widget('text') + nd = NameDisplay.displayer + + tree = self.glade.get_widget('list') + model = gtk.ListStore(str, str) + tree.set_model(model) + + column_n = gtk.TreeViewColumn( + _('Name'), gtk.CellRendererText(), text=0) + tree.append_column(column_n) + + column_n = gtk.TreeViewColumn( + _('ID'), gtk.CellRendererText(), text=1) + tree.append_column(column_n) self.glade.get_widget('close').connect('clicked',self.close_window) - n = [] - for p_handle in handle_list: - p = db.get_person_from_handle(p_handle) - n.append ("%s [%s]\n" % - (p.get_primary_name().get_name(),p.get_gramps_id())) + new_list = [ self.sort_val_from_handle(db, h) for h in handle_list ] + new_list.sort() + handle_list = [ h[1] for h in new_list ] - n.sort () - text.get_buffer().set_text(''.join(n)) + for p_handle in handle_list: + person = db.get_person_from_handle(p_handle) + name = nd.sorted(person) + gid = person.get_gramps_id() + + model.append(row=[name, gid]) self.show() - + + def sort_val_from_handle(self, db, h): + n = db.get_person_from_handle(h).get_primary_name() + return (locale.strxfrm(NameDisplay.displayer.sort_string(n)),h) + def close_window(self,obj): self.close() diff --git a/gramps2/src/glade/rule.glade b/gramps2/src/glade/rule.glade index 0828fd388..b0c5b8a6d 100644 --- a/gramps2/src/glade/rule.glade +++ b/gramps2/src/glade/rule.glade @@ -897,30 +897,25 @@ Exactly one rule must apply - + True - GTK_POLICY_AUTOMATIC - GTK_POLICY_ALWAYS + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC GTK_SHADOW_IN GTK_CORNER_TOP_LEFT - + True True - False - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_WORD - True - 0 - 0 - 0 - 0 - 0 - 0 - + True + False + False + True + False + False + False