Allow filters/rules via plugin without fail on restart

This commit is contained in:
prculley 2018-11-07 10:12:18 -06:00 committed by Nick Hall
parent 5311cc7744
commit 8366ceb896
4 changed files with 8 additions and 12 deletions

View File

@ -22,7 +22,6 @@
Package providing filtering framework for Gramps. Package providing filtering framework for Gramps.
""" """
#SystemFilters = None
CustomFilters = None CustomFilters = None
from ..const import CUSTOM_FILTERS from ..const import CUSTOM_FILTERS
@ -32,18 +31,10 @@ from ._genericfilter import (GenericFilter, GenericFilterFactory,
from ._paramfilter import ParamFilter from ._paramfilter import ParamFilter
from ._searchfilter import SearchFilter, ExactSearchFilter from ._searchfilter import SearchFilter, ExactSearchFilter
#def reload_system_filters():
#global SystemFilters
#SystemFilters = FilterList(SYSTEM_FILTERS)
#SystemFilters.load()
def reload_custom_filters(): def reload_custom_filters():
global CustomFilters global CustomFilters
CustomFilters = FilterList(CUSTOM_FILTERS) CustomFilters = FilterList(CUSTOM_FILTERS)
CustomFilters.load() CustomFilters.load()
#if not SystemFilters: # if not CustomFilters: # moved to viewmanager
#reload_system_filters() # reload_custom_filters()
if not CustomFilters:
reload_custom_filters()

View File

@ -17,7 +17,6 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# #
from ....filters.rules.person._matchidof import MatchIdOf
""" """
Unittest that tests person-specific filter rules Unittest that tests person-specific filter rules
@ -27,6 +26,8 @@ import os
from time import perf_counter from time import perf_counter
import inspect import inspect
from ....filters import reload_custom_filters
reload_custom_filters()
from ....db.utils import import_as_dict from ....db.utils import import_as_dict
from ....filters import GenericFilter, CustomFilters from ....filters import GenericFilter, CustomFilters
from ....const import DATA_DIR from ....const import DATA_DIR

View File

@ -100,6 +100,7 @@ from gramps.gui.editors import (EditPerson, EditFamily, EditMedia, EditNote,
EditPlace, EditSource, EditRepository, EditPlace, EditSource, EditRepository,
EditCitation, EditEvent) EditCitation, EditEvent)
from gramps.gen.db.exceptions import DbWriteFailure from gramps.gen.db.exceptions import DbWriteFailure
from gramps.gen.filters import reload_custom_filters
from .managedwindow import ManagedWindow from .managedwindow import ManagedWindow
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
@ -195,6 +196,7 @@ class ViewManager(CLIManager):
self.__connect_signals() self.__connect_signals()
self.do_reg_plugins(self.dbstate, self.uistate) self.do_reg_plugins(self.dbstate, self.uistate)
reload_custom_filters()
#plugins loaded now set relationship class #plugins loaded now set relationship class
self.rel_class = get_relationship_calculator() self.rel_class = get_relationship_calculator()
self.uistate.set_relationship_class() self.uistate.set_relationship_class()

View File

@ -37,6 +37,8 @@ from gramps.cli.grampscli import CLIManager
from gramps.cli.argparser import ArgParser from gramps.cli.argparser import ArgParser
from gramps.cli.arghandler import ArgHandler from gramps.cli.arghandler import ArgHandler
from gramps.gen.const import USER_DIRLIST from gramps.gen.const import USER_DIRLIST
from gramps.gen.filters import reload_custom_filters
reload_custom_filters() # so reports with filter options don't fail
# _caller_context is primarily here to support and document the process # _caller_context is primarily here to support and document the process
# of determining the test-module's directory. # of determining the test-module's directory.