0002070: Event Comparison Tool filter list doesn't update with new filter

remove old unused libglade menu in _FilterMenu

svn: r12855
This commit is contained in:
Raphael Ackermann 2009-08-01 16:09:17 +00:00
parent 9e5cc9d93a
commit 874d43f2aa
3 changed files with 15 additions and 45 deletions

View File

@ -26,7 +26,6 @@
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
import gtk import gtk
from gettext import gettext as _
import gobject import gobject
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -34,36 +33,7 @@ import gobject
# This is used by plugins to create a menu of available filters # This is used by plugins to create a menu of available filters
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def build_filter_menu(local_filters = [], default=""): def build_filter_model(space, local = []):
from Filters import SystemFilters, CustomFilters
menu = gtk.Menu()
for filt in local_filters:
menuitem = gtk.MenuItem(filt.get_name())
menuitem.show()
menu.append(menuitem)
menuitem.set_data("filter", filt)
for filt in SystemFilters.get_filters():
menuitem = gtk.MenuItem(_(filt.get_name()))
menuitem.show()
menu.append(menuitem)
menuitem.set_data("filter", filt)
for filt in CustomFilters.get_filters():
menuitem = gtk.MenuItem(_(filt.get_name()))
menuitem.show()
menu.append(menuitem)
menuitem.set_data("filter", filt)
return menu
#-------------------------------------------------------------------------
#
# This is used by plugins to create a menu of available filters
#
#-------------------------------------------------------------------------
def build_filter_model(space, local = [], default=""):
from Filters import SystemFilters, CustomFilters from Filters import SystemFilters, CustomFilters
model = gtk.ListStore(gobject.TYPE_STRING, object) model = gtk.ListStore(gobject.TYPE_STRING, object)

View File

@ -49,7 +49,7 @@ if not CustomFilters:
reload_custom_filters() reload_custom_filters()
from _FilterComboBox import FilterComboBox from _FilterComboBox import FilterComboBox
from _FilterMenu import build_filter_menu, build_filter_model from _FilterMenu import build_filter_model
from _FilterStore import FilterStore from _FilterStore import FilterStore
from _SearchBar import SearchBar from _SearchBar import SearchBar
from _SearchFilter import SearchFilter, ExactSearchFilter from _SearchFilter import SearchFilter, ExactSearchFilter

View File

@ -139,20 +139,20 @@ class EventComparison(Tool.Tool,ManagedWindow.ManagedWindow):
self.set_window(window,self.filterDialog.get_object('title'), self.set_window(window,self.filterDialog.get_object('title'),
self.label) self.label)
all = GenericFilter() self.on_filters_changed('Person')
all.set_name(_("Entire Database")) uistate.connect('filters-changed', self.on_filters_changed)
all.add_rule(Rules.Person.Everyone([]))
the_filters = [all]
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person'))
self.filter_menu = build_filter_model(the_filters)
filter_num = self.options.handler.options_dict['filter']
self.filters.set_model(self.filter_menu)
self.filters.set_active(0)
self.show() self.show()
def on_filters_changed(self, name_space):
if name_space == 'Person':
all_filter = GenericFilter()
all_filter.set_name(_("Entire Database"))
all_filter.add_rule(Rules.Person.Everyone([]))
self.filter_model = build_filter_model('Person', [all_filter])
self.filters.set_model(self.filter_model)
self.filters.set_active(0)
def on_help_clicked(self, obj): def on_help_clicked(self, obj):
"""Display the relevant portion of GRAMPS manual""" """Display the relevant portion of GRAMPS manual"""
@ -170,7 +170,7 @@ class EventComparison(Tool.Tool,ManagedWindow.ManagedWindow):
pass pass
def on_apply_clicked(self, obj): def on_apply_clicked(self, obj):
cfilter = self.filter_menu[self.filters.get_active()][1] cfilter = self.filter_model[self.filters.get_active()][1]
progress_bar = ProgressMeter(_('Comparing events'),'') progress_bar = ProgressMeter(_('Comparing events'),'')
progress_bar.set_pass(_('Selecting people'),1) progress_bar.set_pass(_('Selecting people'),1)