* 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
This commit is contained in:
Alex Roitman 2006-08-22 05:28:55 +00:00
parent b7a5d66344
commit 1cb5f1fa9b
10 changed files with 35 additions and 17 deletions

View File

@ -1,4 +1,19 @@
2006-08-21 Alex Roitman <shura@gramps-project.org> 2006-08-21 Alex Roitman <shura@gramps-project.org>
* 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/EventCmp.py (__init__): Add custom filters.
* src/plugins/ChangeTypes.py (on_apply_clicked): Remove extra * src/plugins/ChangeTypes.py (on_apply_clicked): Remove extra
unicode conversion. unicode conversion.

View File

@ -94,7 +94,7 @@ class FilterEditor(ManagedWindow.ManagedWindow):
self.delete.connect('clicked', self.delete_filter) self.delete.connect('clicked', self.delete_filter)
self.connect_button('help', self.help_clicked) 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.connect_button('add', self.add_new_filter)
self.clist = ListModel.ListModel( self.clist = ListModel.ListModel(
@ -123,11 +123,11 @@ class FilterEditor(ManagedWindow.ManagedWindow):
self.delete.set_sensitive(False) self.delete.set_sensitive(False)
self.test.set_sensitive(False) self.test.set_sensitive(False)
def close_window(self,obj): def close(self,obj):
self.filterdb.save() self.filterdb.save()
reload_custom_filters() reload_custom_filters()
reload_system_filters() reload_system_filters()
self.close() ManagedWindow.ManagedWindow.close(self,obj)
def draw_filters(self): def draw_filters(self):
self.clist.clear() self.clist.clear()

View File

@ -28,19 +28,13 @@
import gtk import gtk
from gettext import gettext as _ from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GRAMPS modules
#
#-------------------------------------------------------------------------
from Filters import SystemFilters, CustomFilters
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# 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_menu(local_filters = [], default=""):
from Filters import SystemFilters, CustomFilters
menu = gtk.Menu() menu = gtk.Menu()
for filt in local_filters: for filt in local_filters:
@ -69,6 +63,8 @@ def build_filter_menu(local_filters = [], default=""):
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
def build_filter_model(space, local = [], default=""): def build_filter_model(space, local = [], default=""):
from Filters import SystemFilters, CustomFilters
model = gtk.ListStore(str, object) model = gtk.ListStore(str, object)
flist = local + SystemFilters.get_filters(space) + \ flist = local + SystemFilters.get_filters(space) + \

View File

@ -41,7 +41,7 @@ from PluginUtils import register_report
from ReportBase import Report, ReportUtils, ReportOptions, \ from ReportBase import Report, ReportUtils, ReportOptions, \
CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI
pt2cm = ReportUtils.pt2cm pt2cm = ReportUtils.pt2cm
from Filters import CustomFilters, GenericFilter, ParamFilter, Rules from Filters import GenericFilter, ParamFilter, Rules
import GrampsLocale import GrampsLocale
import RelLib import RelLib
@ -545,6 +545,7 @@ class FilterWidget(Widget):
f.add_rule(Rules.Person.HasTextMatchingSubstringOf(['Calendar',0,0])) f.add_rule(Rules.Person.HasTextMatchingSubstringOf(['Calendar',0,0]))
retval.append(f) retval.append(f)
from Filters import CustomFilters
retval.extend(CustomFilters.get_filters('Person')) retval.extend(CustomFilters.get_filters('Person'))
return retval return retval

View File

@ -43,7 +43,7 @@ import gtk.glade
# GRAMPS modules # GRAMPS modules
# #
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from Filters import GenericFilter, build_filter_menu, Rules, CustomFilters from Filters import GenericFilter, build_filter_menu, Rules
import ListModel import ListModel
import Sort import Sort
import Utils import Utils
@ -162,6 +162,7 @@ class EventComparison(Tool.Tool,ManagedWindow.ManagedWindow):
all.add_rule(Rules.Person.Everyone([])) all.add_rule(Rules.Person.Everyone([]))
the_filters = [all] the_filters = [all]
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person')) the_filters.extend(CustomFilters.get_filters('Person'))
self.filter_menu = build_filter_menu(the_filters) self.filter_menu = build_filter_menu(the_filters)

View File

@ -57,7 +57,7 @@ from ReportBase import Report, ReportUtils, ReportOptions, \
CATEGORY_CODE, CATEGORY_DRAW, MODE_GUI, MODE_CLI CATEGORY_CODE, CATEGORY_DRAW, MODE_GUI, MODE_CLI
from ReportBase._ReportDialog import ReportDialog from ReportBase._ReportDialog import ReportDialog
from ReportBase._CommandLineReport import CommandLineReport from ReportBase._CommandLineReport import CommandLineReport
from Filters import GenericFilter, CustomFilters, Rules from Filters import GenericFilter, Rules
import RelLib import RelLib
import DateHandler import DateHandler
import const import const
@ -693,6 +693,7 @@ class GraphVizOptions(ReportOptions):
com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id]))
the_filters = [all,des,ans,com] the_filters = [all,des,ans,com]
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person')) the_filters.extend(CustomFilters.get_filters('Person'))
return the_filters return the_filters

View File

@ -44,7 +44,7 @@ import RelLib
import const import const
import Utils import Utils
import BaseDoc import BaseDoc
from Filters import GenericFilter, Rules, CustomFilters from Filters import GenericFilter, Rules
import DateHandler import DateHandler
from PluginUtils import register_report from PluginUtils import register_report
from ReportBase import Report, ReportUtils, ReportOptions, \ from ReportBase import Report, ReportUtils, ReportOptions, \
@ -566,6 +566,7 @@ class IndivCompleteOptions(ReportOptions):
com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id]))
the_filters = [filt_id,all,des,ans,com] the_filters = [filt_id,all,des,ans,com]
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person')) the_filters.extend(CustomFilters.get_filters('Person'))
return the_filters return the_filters

View File

@ -67,7 +67,7 @@ import gtk
import RelLib import RelLib
import const import const
from GrampsCfg import get_researcher from GrampsCfg import get_researcher
from Filters import GenericFilter, Rules, CustomFilters from Filters import GenericFilter, Rules
import Sort import Sort
from PluginUtils import register_report from PluginUtils import register_report
from ReportBase import Report, ReportUtils, ReportOptions, \ from ReportBase import Report, ReportUtils, ReportOptions, \
@ -2376,6 +2376,7 @@ class WebReportOptions(ReportOptions):
com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id]))
the_filters = [all,des,df,ans,com] the_filters = [all,des,df,ans,com]
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person')) the_filters.extend(CustomFilters.get_filters('Person'))
return the_filters return the_filters

View File

@ -56,7 +56,7 @@ import BaseDoc
from PluginUtils import register_report from PluginUtils import register_report
from ReportBase import Report, ReportUtils, ReportOptions, \ from ReportBase import Report, ReportUtils, ReportOptions, \
CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI
from Filters import GenericFilter, Rules, CustomFilters from Filters import GenericFilter, Rules
import DateHandler import DateHandler
from Utils import ProgressMeter from Utils import ProgressMeter
@ -859,6 +859,7 @@ class StatisticsChartOptions(ReportOptions):
com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id]))
the_filters = [all, des, ans, com] the_filters = [all, des, ans, com]
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person')) the_filters.extend(CustomFilters.get_filters('Person'))
return the_filters return the_filters

View File

@ -48,7 +48,7 @@ from ReportBase import Report, ReportUtils, ReportOptions, \
CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI
pt2cm = ReportUtils.pt2cm pt2cm = ReportUtils.pt2cm
import BaseDoc import BaseDoc
from Filters import GenericFilter, Rules, CustomFilters from Filters import GenericFilter, Rules
import Sort import Sort
from QuestionDialog import ErrorDialog from QuestionDialog import ErrorDialog
import NameDisplay import NameDisplay
@ -430,6 +430,7 @@ class TimeLineOptions(ReportOptions):
com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id])) com.add_rule(Rules.Person.HasCommonAncestorWith([gramps_id]))
the_filters = [all,des,ans,com] the_filters = [all,des,ans,com]
from Filters import CustomFilters
the_filters.extend(CustomFilters.get_filters('Person')) the_filters.extend(CustomFilters.get_filters('Person'))
return the_filters return the_filters