From a57f68666810dbda7bc67fe57ce4ec469981be59 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Tue, 22 Aug 2006 05:28:55 +0000 Subject: [PATCH] * src/FilterEditor/_FilterEditor.py (close): Override parent's close. * src/Filters/_FilterMenu.py (build_filter_menu, build_filter_model): Import Custom and System filters when needed. * src/plugins/Calendar.py (get_filters): Import Custom filters when needed. * src/plugins/GraphViz.py (get_report_filters): Import Custom filters when needed. * src/plugins/IndivComplete.py (get_report_filters): Import Custom filters when needed. * src/plugins/NarrativeWeb.py (get_report_filters): Import Custom filters when needed. * src/plugins/StatisticsChart.py (get_report_filters): Import Custom filters when needed. * src/plugins/TimeLine.py (get_report_filters): Import Custom filters when needed. svn: r7231 --- gramps2/ChangeLog | 15 +++++++++++++++ gramps2/src/FilterEditor/_FilterEditor.py | 6 +++--- gramps2/src/Filters/_FilterMenu.py | 10 +++------- gramps2/src/plugins/Calendar.py | 3 ++- gramps2/src/plugins/EventCmp.py | 3 ++- gramps2/src/plugins/GraphViz.py | 3 ++- gramps2/src/plugins/IndivComplete.py | 3 ++- gramps2/src/plugins/NarrativeWeb.py | 3 ++- gramps2/src/plugins/StatisticsChart.py | 3 ++- gramps2/src/plugins/TimeLine.py | 3 ++- 10 files changed, 35 insertions(+), 17 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 98bc91f1a..78098affe 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,19 @@ 2006-08-21 Alex Roitman + * src/FilterEditor/_FilterEditor.py (close): Override parent's close. + * src/Filters/_FilterMenu.py (build_filter_menu, + build_filter_model): Import Custom and System filters when needed. + * src/plugins/Calendar.py (get_filters): Import Custom + filters when needed. + * src/plugins/GraphViz.py (get_report_filters): Import Custom + filters when needed. + * src/plugins/IndivComplete.py (get_report_filters): Import Custom + filters when needed. + * src/plugins/NarrativeWeb.py (get_report_filters): Import Custom + filters when needed. + * src/plugins/StatisticsChart.py (get_report_filters): Import Custom + filters when needed. + * src/plugins/TimeLine.py (get_report_filters): Import Custom + filters when needed. * src/plugins/EventCmp.py (__init__): Add custom filters. * src/plugins/ChangeTypes.py (on_apply_clicked): Remove extra unicode conversion. diff --git a/gramps2/src/FilterEditor/_FilterEditor.py b/gramps2/src/FilterEditor/_FilterEditor.py index 2d568ec1d..de3a413b7 100644 --- a/gramps2/src/FilterEditor/_FilterEditor.py +++ b/gramps2/src/FilterEditor/_FilterEditor.py @@ -94,7 +94,7 @@ class FilterEditor(ManagedWindow.ManagedWindow): self.delete.connect('clicked', self.delete_filter) self.connect_button('help', self.help_clicked) - self.connect_button('close', self.close_window) + self.connect_button('close', self.close) self.connect_button('add', self.add_new_filter) self.clist = ListModel.ListModel( @@ -123,11 +123,11 @@ class FilterEditor(ManagedWindow.ManagedWindow): self.delete.set_sensitive(False) self.test.set_sensitive(False) - def close_window(self,obj): + def close(self,obj): self.filterdb.save() reload_custom_filters() reload_system_filters() - self.close() + ManagedWindow.ManagedWindow.close(self,obj) def draw_filters(self): self.clist.clear() diff --git a/gramps2/src/Filters/_FilterMenu.py b/gramps2/src/Filters/_FilterMenu.py index 0673908b1..2ca4d3bc9 100644 --- a/gramps2/src/Filters/_FilterMenu.py +++ b/gramps2/src/Filters/_FilterMenu.py @@ -28,19 +28,13 @@ import gtk from gettext import gettext as _ -#------------------------------------------------------------------------- -# -# GRAMPS modules -# -#------------------------------------------------------------------------- -from Filters import SystemFilters, CustomFilters - #------------------------------------------------------------------------- # # This is used by plugins to create a menu of available filters # #------------------------------------------------------------------------- def build_filter_menu(local_filters = [], default=""): + from Filters import SystemFilters, CustomFilters menu = gtk.Menu() for filt in local_filters: @@ -69,6 +63,8 @@ def build_filter_menu(local_filters = [], default=""): # #------------------------------------------------------------------------- def build_filter_model(space, local = [], default=""): + from Filters import SystemFilters, CustomFilters + model = gtk.ListStore(str, object) flist = local + SystemFilters.get_filters(space) + \ diff --git a/gramps2/src/plugins/Calendar.py b/gramps2/src/plugins/Calendar.py index 13fdb8c47..438fd7099 100644 --- a/gramps2/src/plugins/Calendar.py +++ b/gramps2/src/plugins/Calendar.py @@ -41,7 +41,7 @@ from PluginUtils import register_report from ReportBase import Report, ReportUtils, ReportOptions, \ CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI pt2cm = ReportUtils.pt2cm -from Filters import CustomFilters, GenericFilter, ParamFilter, Rules +from Filters import GenericFilter, ParamFilter, Rules import GrampsLocale import RelLib @@ -545,6 +545,7 @@ class FilterWidget(Widget): f.add_rule(Rules.Person.HasTextMatchingSubstringOf(['Calendar',0,0])) retval.append(f) + from Filters import CustomFilters retval.extend(CustomFilters.get_filters('Person')) return retval diff --git a/gramps2/src/plugins/EventCmp.py b/gramps2/src/plugins/EventCmp.py index 1baef4fc9..8cfd5a97a 100644 --- a/gramps2/src/plugins/EventCmp.py +++ b/gramps2/src/plugins/EventCmp.py @@ -43,7 +43,7 @@ import gtk.glade # GRAMPS modules # #------------------------------------------------------------------------ -from Filters import GenericFilter, build_filter_menu, Rules, CustomFilters +from Filters import GenericFilter, build_filter_menu, Rules import ListModel import Sort import Utils @@ -162,6 +162,7 @@ class EventComparison(Tool.Tool,ManagedWindow.ManagedWindow): 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_menu(the_filters) diff --git a/gramps2/src/plugins/GraphViz.py b/gramps2/src/plugins/GraphViz.py index 64550d01e..ada88e2f0 100644 --- a/gramps2/src/plugins/GraphViz.py +++ b/gramps2/src/plugins/GraphViz.py @@ -57,7 +57,7 @@ from ReportBase import Report, ReportUtils, ReportOptions, \ CATEGORY_CODE, CATEGORY_DRAW, MODE_GUI, MODE_CLI from ReportBase._ReportDialog import ReportDialog from ReportBase._CommandLineReport import CommandLineReport -from Filters import GenericFilter, CustomFilters, Rules +from Filters import GenericFilter, Rules import RelLib import DateHandler import const @@ -693,6 +693,7 @@ class GraphVizOptions(ReportOptions): com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) the_filters = [all,des,ans,com] + from Filters import CustomFilters the_filters.extend(CustomFilters.get_filters('Person')) return the_filters diff --git a/gramps2/src/plugins/IndivComplete.py b/gramps2/src/plugins/IndivComplete.py index 77c0da15d..1ce3db1b7 100644 --- a/gramps2/src/plugins/IndivComplete.py +++ b/gramps2/src/plugins/IndivComplete.py @@ -44,7 +44,7 @@ import RelLib import const import Utils import BaseDoc -from Filters import GenericFilter, Rules, CustomFilters +from Filters import GenericFilter, Rules import DateHandler from PluginUtils import register_report from ReportBase import Report, ReportUtils, ReportOptions, \ @@ -566,6 +566,7 @@ class IndivCompleteOptions(ReportOptions): com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) the_filters = [filt_id,all,des,ans,com] + from Filters import CustomFilters the_filters.extend(CustomFilters.get_filters('Person')) return the_filters diff --git a/gramps2/src/plugins/NarrativeWeb.py b/gramps2/src/plugins/NarrativeWeb.py index 567f85764..0e623c6c4 100644 --- a/gramps2/src/plugins/NarrativeWeb.py +++ b/gramps2/src/plugins/NarrativeWeb.py @@ -67,7 +67,7 @@ import gtk import RelLib import const from GrampsCfg import get_researcher -from Filters import GenericFilter, Rules, CustomFilters +from Filters import GenericFilter, Rules import Sort from PluginUtils import register_report from ReportBase import Report, ReportUtils, ReportOptions, \ @@ -2376,6 +2376,7 @@ class WebReportOptions(ReportOptions): com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) the_filters = [all,des,df,ans,com] + from Filters import CustomFilters the_filters.extend(CustomFilters.get_filters('Person')) return the_filters diff --git a/gramps2/src/plugins/StatisticsChart.py b/gramps2/src/plugins/StatisticsChart.py index 376f812f5..d93800b73 100644 --- a/gramps2/src/plugins/StatisticsChart.py +++ b/gramps2/src/plugins/StatisticsChart.py @@ -56,7 +56,7 @@ import BaseDoc from PluginUtils import register_report from ReportBase import Report, ReportUtils, ReportOptions, \ CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI -from Filters import GenericFilter, Rules, CustomFilters +from Filters import GenericFilter, Rules import DateHandler from Utils import ProgressMeter @@ -859,6 +859,7 @@ class StatisticsChartOptions(ReportOptions): com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) the_filters = [all, des, ans, com] + from Filters import CustomFilters the_filters.extend(CustomFilters.get_filters('Person')) return the_filters diff --git a/gramps2/src/plugins/TimeLine.py b/gramps2/src/plugins/TimeLine.py index 314dccd74..c71e770d8 100644 --- a/gramps2/src/plugins/TimeLine.py +++ b/gramps2/src/plugins/TimeLine.py @@ -48,7 +48,7 @@ from ReportBase import Report, ReportUtils, ReportOptions, \ CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI pt2cm = ReportUtils.pt2cm import BaseDoc -from Filters import GenericFilter, Rules, CustomFilters +from Filters import GenericFilter, Rules import Sort from QuestionDialog import ErrorDialog import NameDisplay @@ -430,6 +430,7 @@ class TimeLineOptions(ReportOptions): com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) the_filters = [all,des,ans,com] + from Filters import CustomFilters the_filters.extend(CustomFilters.get_filters('Person')) return the_filters