2548: deprecated system_filter.xml
svn: r13087
This commit is contained in:
		@@ -52,8 +52,7 @@ import GrampsDisplay
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
import const
 | 
			
		||||
from Filters import (GenericFilterFactory, FilterList, reload_custom_filters, 
 | 
			
		||||
                     reload_system_filters)
 | 
			
		||||
from Filters import (GenericFilterFactory, FilterList, reload_custom_filters)
 | 
			
		||||
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
 | 
			
		||||
import ListModel
 | 
			
		||||
import ManagedWindow
 | 
			
		||||
@@ -140,7 +139,7 @@ class FilterEditor(ManagedWindow.ManagedWindow):
 | 
			
		||||
    def close(self, *obj):
 | 
			
		||||
        self.filterdb.save()
 | 
			
		||||
        reload_custom_filters()
 | 
			
		||||
        reload_system_filters()
 | 
			
		||||
        #reload_system_filters()
 | 
			
		||||
        self.uistate.emit('filters-changed', (self.namespace,))
 | 
			
		||||
        ManagedWindow.ManagedWindow.close(self, *obj)
 | 
			
		||||
        
 | 
			
		||||
 
 | 
			
		||||
@@ -55,11 +55,11 @@ class MatchesFilterBase(Rule):
 | 
			
		||||
    category    = _('General filters')
 | 
			
		||||
 | 
			
		||||
    def prepare(self, db):
 | 
			
		||||
        if Filters.SystemFilters:
 | 
			
		||||
            for filt in Filters.SystemFilters.get_filters(self.namespace):
 | 
			
		||||
                if filt.get_name() == self.list[0]:
 | 
			
		||||
                    for rule in filt.flist:
 | 
			
		||||
                        rule.prepare(db)
 | 
			
		||||
        #if Filters.SystemFilters:
 | 
			
		||||
            #for filt in Filters.SystemFilters.get_filters(self.namespace):
 | 
			
		||||
                #if filt.get_name() == self.list[0]:
 | 
			
		||||
                    #for rule in filt.flist:
 | 
			
		||||
                        #rule.prepare(db)
 | 
			
		||||
        if Filters.CustomFilters:
 | 
			
		||||
            for filt in Filters.CustomFilters.get_filters(self.namespace):
 | 
			
		||||
                if filt.get_name() == self.list[0]:
 | 
			
		||||
@@ -67,11 +67,11 @@ class MatchesFilterBase(Rule):
 | 
			
		||||
                        rule.prepare(db)
 | 
			
		||||
 | 
			
		||||
    def reset(self):
 | 
			
		||||
        if Filters.SystemFilters:
 | 
			
		||||
            for filt in Filters.SystemFilters.get_filters(self.namespace):
 | 
			
		||||
                if filt.get_name() == self.list[0]:
 | 
			
		||||
                    for rule in filt.flist:
 | 
			
		||||
                        rule.reset()
 | 
			
		||||
        #if Filters.SystemFilters:
 | 
			
		||||
            #for filt in Filters.SystemFilters.get_filters(self.namespace):
 | 
			
		||||
                #if filt.get_name() == self.list[0]:
 | 
			
		||||
                    #for rule in filt.flist:
 | 
			
		||||
                        #rule.reset()
 | 
			
		||||
        if Filters.CustomFilters:
 | 
			
		||||
            for filt in Filters.CustomFilters.get_filters(self.namespace):
 | 
			
		||||
                if filt.get_name() == self.list[0]:
 | 
			
		||||
@@ -79,10 +79,10 @@ class MatchesFilterBase(Rule):
 | 
			
		||||
                        rule.reset()
 | 
			
		||||
 | 
			
		||||
    def apply(self, db, obj):
 | 
			
		||||
        if Filters.SystemFilters:
 | 
			
		||||
            for filt in Filters.SystemFilters.get_filters(self.namespace):
 | 
			
		||||
                if filt.get_name() == self.list[0]:
 | 
			
		||||
                    return filt.check(db, obj.handle)
 | 
			
		||||
        #if Filters.SystemFilters:
 | 
			
		||||
            #for filt in Filters.SystemFilters.get_filters(self.namespace):
 | 
			
		||||
                #if filt.get_name() == self.list[0]:
 | 
			
		||||
                    #return filt.check(db, obj.handle)
 | 
			
		||||
        if Filters.CustomFilters:
 | 
			
		||||
            for filt in Filters.CustomFilters.get_filters(self.namespace):
 | 
			
		||||
                if filt.get_name() == self.list[0]:
 | 
			
		||||
@@ -93,10 +93,10 @@ class MatchesFilterBase(Rule):
 | 
			
		||||
        """
 | 
			
		||||
        Return the selected filter or None.
 | 
			
		||||
        """
 | 
			
		||||
        if Filters.SystemFilters:
 | 
			
		||||
            for filt in Filters.SystemFilters.get_filters(self.namespace):
 | 
			
		||||
                if filt.get_name() == self.list[0]:
 | 
			
		||||
                    return filt
 | 
			
		||||
        #if Filters.SystemFilters:
 | 
			
		||||
            #for filt in Filters.SystemFilters.get_filters(self.namespace):
 | 
			
		||||
                #if filt.get_name() == self.list[0]:
 | 
			
		||||
                    #return filt
 | 
			
		||||
        if Filters.CustomFilters:
 | 
			
		||||
            for filt in Filters.CustomFilters.get_filters(self.namespace):
 | 
			
		||||
                if filt.get_name() == self.list[0]:
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ import gobject
 | 
			
		||||
# GRAMPS modules
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
from Filters import SystemFilters, CustomFilters
 | 
			
		||||
from Filters import CustomFilters
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
@@ -64,12 +64,12 @@ class FilterComboBox(gtk.ComboBox):
 | 
			
		||||
                active = cnt
 | 
			
		||||
            cnt += 1
 | 
			
		||||
        
 | 
			
		||||
        for filt in SystemFilters.get_filters():
 | 
			
		||||
            self.store.append(row=[filt.get_name()])
 | 
			
		||||
            self.map[unicode(filt.get_name())] = filt
 | 
			
		||||
            if default != "" and default == filt.get_name():
 | 
			
		||||
                active = cnt
 | 
			
		||||
            cnt += 1
 | 
			
		||||
        #for filt in SystemFilters.get_filters():
 | 
			
		||||
            #self.store.append(row=[filt.get_name()])
 | 
			
		||||
            #self.map[unicode(filt.get_name())] = filt
 | 
			
		||||
            #if default != "" and default == filt.get_name():
 | 
			
		||||
                #active = cnt
 | 
			
		||||
            #cnt += 1
 | 
			
		||||
 | 
			
		||||
        for filt in CustomFilters.get_filters():
 | 
			
		||||
            self.store.append(row=[filt.get_name()])
 | 
			
		||||
@@ -82,10 +82,10 @@ class FilterComboBox(gtk.ComboBox):
 | 
			
		||||
            self.set_active(active)
 | 
			
		||||
        elif len(local_filters):
 | 
			
		||||
            self.set_active(2)
 | 
			
		||||
        elif len(SystemFilters.get_filters()):
 | 
			
		||||
            self.set_active(4 + len(local_filters))
 | 
			
		||||
        #elif len(SystemFilters.get_filters()):
 | 
			
		||||
            #self.set_active(4 + len(local_filters))
 | 
			
		||||
        elif len(CustomFilters.get_filters()):
 | 
			
		||||
            self.set_active(6 + len(local_filters) + len(SystemFilters.get_filters()))
 | 
			
		||||
            self.set_active(4 + len(local_filters))
 | 
			
		||||
        else:
 | 
			
		||||
            self.set_active(0)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -34,13 +34,12 @@ import gobject
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
def build_filter_model(space, local = []):
 | 
			
		||||
    from Filters import SystemFilters, CustomFilters
 | 
			
		||||
    from Filters import CustomFilters
 | 
			
		||||
 | 
			
		||||
    model = gtk.ListStore(gobject.TYPE_STRING, object)
 | 
			
		||||
 | 
			
		||||
    if isinstance(space, basestring):
 | 
			
		||||
        flist = local + SystemFilters.get_filters(space) + \
 | 
			
		||||
	                    CustomFilters.get_filters(space)
 | 
			
		||||
        flist = local + CustomFilters.get_filters(space)
 | 
			
		||||
    elif isinstance(space, (list, tuple)):
 | 
			
		||||
        flist = space
 | 
			
		||||
    else:
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ from gettext import gettext as _
 | 
			
		||||
# GRAMPS modules
 | 
			
		||||
#
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
from Filters import SystemFilters, CustomFilters
 | 
			
		||||
from Filters import CustomFilters
 | 
			
		||||
 | 
			
		||||
#-------------------------------------------------------------------------
 | 
			
		||||
#
 | 
			
		||||
@@ -60,8 +60,7 @@ class FilterStore(gtk.ListStore):
 | 
			
		||||
                self.def_index = cnt
 | 
			
		||||
            cnt += 1
 | 
			
		||||
 | 
			
		||||
        for filt in SystemFilters.get_filters(namespace) + \
 | 
			
		||||
                                        CustomFilters.get_filters(namespace):
 | 
			
		||||
        for filt in CustomFilters.get_filters(namespace):
 | 
			
		||||
            name = _(filt.get_name())
 | 
			
		||||
            self.append(row=[name])
 | 
			
		||||
            self.list_map.append(filt)
 | 
			
		||||
 
 | 
			
		||||
@@ -24,26 +24,26 @@
 | 
			
		||||
Package providing filtering framework for GRAMPS.
 | 
			
		||||
"""
 | 
			
		||||
 | 
			
		||||
SystemFilters = None
 | 
			
		||||
#SystemFilters = None
 | 
			
		||||
CustomFilters = None
 | 
			
		||||
 | 
			
		||||
from const import SYSTEM_FILTERS, CUSTOM_FILTERS
 | 
			
		||||
from const import CUSTOM_FILTERS
 | 
			
		||||
from _FilterList import FilterList
 | 
			
		||||
from _GenericFilter import GenericFilter, GenericFilterFactory
 | 
			
		||||
from _ParamFilter import ParamFilter
 | 
			
		||||
 | 
			
		||||
def reload_system_filters():
 | 
			
		||||
    global SystemFilters
 | 
			
		||||
    SystemFilters = FilterList(SYSTEM_FILTERS)
 | 
			
		||||
    SystemFilters.load()
 | 
			
		||||
#def reload_system_filters():
 | 
			
		||||
    #global SystemFilters
 | 
			
		||||
    #SystemFilters = FilterList(SYSTEM_FILTERS)
 | 
			
		||||
    #SystemFilters.load()
 | 
			
		||||
    
 | 
			
		||||
def reload_custom_filters():
 | 
			
		||||
    global CustomFilters
 | 
			
		||||
    CustomFilters = FilterList(CUSTOM_FILTERS)
 | 
			
		||||
    CustomFilters.load()
 | 
			
		||||
    
 | 
			
		||||
if not SystemFilters:
 | 
			
		||||
    reload_system_filters()
 | 
			
		||||
#if not SystemFilters:
 | 
			
		||||
    #reload_system_filters()
 | 
			
		||||
 | 
			
		||||
if not CustomFilters:
 | 
			
		||||
    reload_custom_filters()
 | 
			
		||||
 
 | 
			
		||||
@@ -136,7 +136,7 @@ RULE_GLADE     = os.path.join(GLADE_DIR, "rule.glade")
 | 
			
		||||
 | 
			
		||||
PLUGINS_DIR    = os.path.join(ROOT_DIR, "plugins")
 | 
			
		||||
DATA_DIR       = os.path.join(ROOT_DIR, "data")
 | 
			
		||||
SYSTEM_FILTERS = os.path.join(DATA_DIR, "system_filters.xml")
 | 
			
		||||
#SYSTEM_FILTERS = os.path.join(DATA_DIR, "system_filters.xml")
 | 
			
		||||
TIP_DATA       = os.path.join(DATA_DIR, "tips.xml")
 | 
			
		||||
 | 
			
		||||
PAPERSIZE      = os.path.join(DATA_DIR, "papersize.xml")
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,6 @@ dist_pkgdata_DATA = \
 | 
			
		||||
        authors.xml \
 | 
			
		||||
	gedcom.xml \
 | 
			
		||||
	papersize.xml \
 | 
			
		||||
	system_filters.xml \
 | 
			
		||||
	tips.xml\
 | 
			
		||||
	lds.xml\
 | 
			
		||||
	behaviour.css\
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user