* src/FilterEditor/_ShowResults.py: use list instead of text display

svn: r6851
This commit is contained in:
Don Allingham 2006-06-03 04:31:59 +00:00
parent 0c008ceb78
commit 79921262dd
4 changed files with 45 additions and 32 deletions

View File

@ -10,6 +10,7 @@
* src/ReportBase.py: get_person_index -> get_person_mark * src/ReportBase.py: get_person_index -> get_person_mark
2006-06-02 Don Allingham <don@gramps-project.org> 2006-06-02 Don Allingham <don@gramps-project.org>
* src/FilterEditor/_ShowResults.py: use list instead of text display
* src/FilterEditor/_EditFilter.py: clean up * src/FilterEditor/_EditFilter.py: clean up
* src/FilterEditor/_EditRule.py: clean up * src/FilterEditor/_EditRule.py: clean up
* src/glade/rule.glade: clean up * src/glade/rule.glade: clean up

View File

@ -92,7 +92,7 @@ class EditFilter(ManagedWindow.ManagedWindow):
self.rule_list = self.glade.get_widget('rule_list') self.rule_list = self.glade.get_widget('rule_list')
self.rlist = ListModel.ListModel( self.rlist = ListModel.ListModel(
self.rule_list, self.rule_list,
[(_('Name'),-1,150),(_('Value'),-1,150)], [(_('Name'),-1,150),(_('Values'),-1,150)],
self.select_row, self.select_row,
self.on_edit_clicked) self.on_edit_clicked)
@ -109,8 +109,8 @@ class EditFilter(ManagedWindow.ManagedWindow):
self.del_btn.connect('clicked', self.on_delete_clicked) self.del_btn.connect('clicked', self.on_delete_clicked)
self.add_btn.connect('clicked', self.on_add_clicked) self.add_btn.connect('clicked', self.on_add_clicked)
self.glade.get_widget('help').('clicked', self.on_help_clicked) self.glade.get_widget('help').connect('clicked', self.on_help_clicked)
self.glade.get_widget('cancel').('clicked', self.close_window) self.glade.get_widget('cancel').connect('clicked', self.close_window)
self.fname.connect('changed', self.filter_name_changed) self.fname.connect('changed', self.filter_name_changed)
if self.filter.get_logical_op() == 'or': if self.filter.get_logical_op() == 'or':

View File

@ -31,7 +31,7 @@ __author__ = "Don Allingham"
# Python modules # Python modules
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import os import locale
from gettext import gettext as _ from gettext import gettext as _
#------------------------------------------------------------------------ #------------------------------------------------------------------------
@ -49,8 +49,6 @@ log = logging.getLogger(".FilterEdit")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
import gtk.glade import gtk.glade
import gobject
import GrampsDisplay
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -59,6 +57,7 @@ import GrampsDisplay
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import const import const
import ManagedWindow import ManagedWindow
import NameDisplay
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -78,21 +77,39 @@ class ShowResults(ManagedWindow.ManagedWindow):
self.glade.get_widget('title'), self.glade.get_widget('title'),
_('Filter Test')) _('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) self.glade.get_widget('close').connect('clicked',self.close_window)
n = [] new_list = [ self.sort_val_from_handle(db, h) for h in handle_list ]
for p_handle in handle_list: new_list.sort()
p = db.get_person_from_handle(p_handle) handle_list = [ h[1] for h in new_list ]
n.append ("%s [%s]\n" %
(p.get_primary_name().get_name(),p.get_gramps_id()))
n.sort () for p_handle in handle_list:
text.get_buffer().set_text(''.join(n)) person = db.get_person_from_handle(p_handle)
name = nd.sorted(person)
gid = person.get_gramps_id()
model.append(row=[name, gid])
self.show() 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): def close_window(self,obj):
self.close() self.close()

View File

@ -897,30 +897,25 @@ Exactly one rule must apply</property>
</child> </child>
<child> <child>
<widget class="GtkScrolledWindow" id="scrolledwindow3"> <widget class="GtkScrolledWindow" id="scrolledwindow5">
<property name="visible">True</property> <property name="visible">True</property>
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property> <property name="can_focus">True</property>
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="shadow_type">GTK_SHADOW_IN</property> <property name="shadow_type">GTK_SHADOW_IN</property>
<property name="window_placement">GTK_CORNER_TOP_LEFT</property> <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
<child> <child>
<widget class="GtkTextView" id="text"> <widget class="GtkTreeView" id="list">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="editable">False</property> <property name="headers_visible">True</property>
<property name="overwrite">False</property> <property name="rules_hint">False</property>
<property name="accepts_tab">True</property> <property name="reorderable">False</property>
<property name="justification">GTK_JUSTIFY_LEFT</property> <property name="enable_search">True</property>
<property name="wrap_mode">GTK_WRAP_WORD</property> <property name="fixed_height_mode">False</property>
<property name="cursor_visible">True</property> <property name="hover_selection">False</property>
<property name="pixels_above_lines">0</property> <property name="hover_expand">False</property>
<property name="pixels_below_lines">0</property>
<property name="pixels_inside_wrap">0</property>
<property name="left_margin">0</property>
<property name="right_margin">0</property>
<property name="indent">0</property>
<property name="text" translatable="yes"></property>
</widget> </widget>
</child> </child>
</widget> </widget>