2008-01-18 Raphael Ackermann <raphael.ackermann@gmail.com>

* src/gen/db/dbdir.py
    * src/plugins/ChangeNames.py
    * src/DisplayModels/_NoteModel.py
    * src/GrampsDbUtils/_GrampsBSDDB.py
    * src/Filters/SideBar/_MediaSidebarFilter.py
    * src/Filters/SideBar/_SidebarFilter.py
    * src/Filters/SideBar/_SourceSidebarFilter.py
    * src/Filters/SideBar/_EventSidebarFilter.py
    * src/Filters/SideBar/_FamilySidebarFilter.py
    * src/Filters/SideBar/_PlaceSidebarFilter.py
    * src/Filters/SideBar/_NoteSidebarFilter.py
    * src/Filters/SideBar/_RepoSidebarFilter.py
    * src/Filters/SideBar/_PersonSidebarFilter.py
    * src/Filters/Rules/Family/_HasNoteRegexp.py
    * src/Filters/Rules/Event/_MatchesSourceFilter.py
    * src/Filters/Rules/Event/_HasNoteRegexp.py
    * src/Filters/Rules/Event/_MatchesPersonFilter.py
    * src/Filters/Rules/_HasTextMatchingRegexpOf.py
    * src/Filters/Rules/Place/_MatchesEventFilter.py
    * src/Filters/Rules/Person/_HasTextMatchingRegexpOf.py
    * src/Filters/Rules/Person/_MatchesEventFilter.py
    Pylint fixes.

svn: r9885
This commit is contained in:
Raphael Ackermann 2008-01-18 15:51:15 +00:00
parent 78b28b583b
commit 493c790703
22 changed files with 171 additions and 131 deletions

View File

@ -1,3 +1,27 @@
2008-01-18 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/gen/db/dbdir.py
* src/plugins/ChangeNames.py
* src/DisplayModels/_NoteModel.py
* src/GrampsDbUtils/_GrampsBSDDB.py
* src/Filters/SideBar/_MediaSidebarFilter.py
* src/Filters/SideBar/_SidebarFilter.py
* src/Filters/SideBar/_SourceSidebarFilter.py
* src/Filters/SideBar/_EventSidebarFilter.py
* src/Filters/SideBar/_FamilySidebarFilter.py
* src/Filters/SideBar/_PlaceSidebarFilter.py
* src/Filters/SideBar/_NoteSidebarFilter.py
* src/Filters/SideBar/_RepoSidebarFilter.py
* src/Filters/SideBar/_PersonSidebarFilter.py
* src/Filters/Rules/Family/_HasNoteRegexp.py
* src/Filters/Rules/Event/_MatchesSourceFilter.py
* src/Filters/Rules/Event/_HasNoteRegexp.py
* src/Filters/Rules/Event/_MatchesPersonFilter.py
* src/Filters/Rules/_HasTextMatchingRegexpOf.py
* src/Filters/Rules/Place/_MatchesEventFilter.py
* src/Filters/Rules/Person/_HasTextMatchingRegexpOf.py
* src/Filters/Rules/Person/_MatchesEventFilter.py
Pylint fixes.
2008-01-18 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/plugins/DefaultGramplets.py (SurnameCloudGramplet.main):
moved cursor to beginning of text

View File

@ -24,7 +24,6 @@
# python modules
#
#-------------------------------------------------------------------------
import time
import logging
import re
log = logging.getLogger(".")

View File

@ -25,7 +25,6 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
import re
from gettext import gettext as _
#-------------------------------------------------------------------------

View File

@ -32,7 +32,6 @@ from gettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import Filters
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
#-------------------------------------------------------------------------

View File

@ -32,7 +32,6 @@ from gettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import Filters
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
#-------------------------------------------------------------------------

View File

@ -25,7 +25,6 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
import re
from gettext import gettext as _
#-------------------------------------------------------------------------

View File

@ -25,7 +25,6 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
@ -38,7 +37,10 @@ from _HasTextMatchingSubstringOf import HasTextMatchingSubstringOf
# "HasTextMatchingRegexOf"
#-------------------------------------------------------------------------
class HasTextMatchingRegexpOf(HasTextMatchingSubstringOf):
"""This is wrapping HasTextMatchingSubstringOf to enable the regex_match parameter"""
"""This is wrapping HasTextMatchingSubstringOf to enable the regex_match
parameter.
"""
def __init__(self,list):
HasTextMatchingSubstringOf.__init__(self,list)

View File

@ -32,7 +32,6 @@ from gettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import Filters
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
#-------------------------------------------------------------------------

View File

@ -32,7 +32,6 @@ from gettext import gettext as _
# GRAMPS modules
#
#-------------------------------------------------------------------------
import Filters
from Filters.Rules._MatchesFilterBase import MatchesFilterBase
#-------------------------------------------------------------------------

View File

@ -25,7 +25,6 @@
# Standard Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
@ -38,7 +37,10 @@ from _HasTextMatchingSubstringOf import HasTextMatchingSubstringOf
# "HasTextMatchingRegexOf"
#-------------------------------------------------------------------------
class HasTextMatchingRegexpOf(HasTextMatchingSubstringOf):
"""This is wrapping HasTextMatchingSubstringOf to enable the regex_match parameter"""
"""This is wrapping HasTextMatchingSubstringOf to enable the regex_match
parameter.
"""
def __init__(self,list):
HasTextMatchingSubstringOf.__init__(self,list)

View File

@ -42,9 +42,11 @@ import gtk
import GrampsWidgets
import gen.lib
from _SidebarFilter import SidebarFilter
from Filters.SideBar import SidebarFilter
from Filters import GenericFilterFactory, build_filter_model, Rules
from Filters.Rules.Event import *
from Filters.Rules.Event import (RegExpIdOf, HasIdOf, HasNoteRegexp,
HasNoteMatchingSubstringOf, MatchesFilter,
HasEvent)
GenericEventFilter = GenericFilterFactory('Event')
#-------------------------------------------------------------------------
@ -55,14 +57,11 @@ GenericEventFilter = GenericFilterFactory('Event')
class EventSidebarFilter(SidebarFilter):
def __init__(self, dbstate, uistate, clicked):
SidebarFilter.__init__(self, dbstate, uistate)
self.clicked_func = clicked
def create_widget(self):
self.filter_id = gtk.Entry()
self.filter_desc = gtk.Entry()
self.filter_event = gen.lib.Event()
self.filter_event.set_type((gen.lib.EventType.CUSTOM,u''))
self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
self.etype = gtk.ComboBoxEntry()
self.event_menu = GrampsWidgets.MonitoredDataType(
@ -77,6 +76,10 @@ class EventSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate)
def create_widget(self):
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
@ -107,11 +110,11 @@ class EventSidebarFilter(SidebarFilter):
place = unicode(self.filter_place.get_text()).strip()
note = unicode(self.filter_note.get_text()).strip()
regex = self.filter_regex.get_active()
gen = self.generic.get_active() > 0
generic = self.generic.get_active() > 0
etype = self.filter_event.get_type().xml_str()
empty = not (gid or desc or date or place or note
or etype or regex or gen)
or etype or regex or generic)
if empty:
generic_filter = None
else:
@ -123,7 +126,7 @@ class EventSidebarFilter(SidebarFilter):
rule = HasIdOf([gid])
generic_filter.add_rule(rule)
rule = HasEvent([etype,date,place,desc])
rule = HasEvent([etype, date, place, desc])
generic_filter.add_rule(rule)
if note:
@ -144,8 +147,8 @@ class EventSidebarFilter(SidebarFilter):
def on_filters_changed(self,name_space):
if name_space == 'Event':
all = GenericEventFilter()
all.set_name(_("None"))
all.add_rule(Rules.Event.AllEvents([]))
self.generic.set_model(build_filter_model('Event', [all]))
all_filter = GenericEventFilter()
all_filter.set_name(_("None"))
all_filter.add_rule(Rules.Event.AllEvents([]))
self.generic.set_model(build_filter_model('Event', [all_filter]))
self.generic.set_active(0)

View File

@ -42,9 +42,14 @@ import gtk
import GrampsWidgets
import gen.lib
from _SidebarFilter import SidebarFilter
from Filters.SideBar import SidebarFilter
from Filters import GenericFilterFactory, build_filter_model, Rules
from Filters.Rules.Family import *
from Filters.Rules.Family import (RegExpIdOf, HasIdOf, RegExpFatherName,
SearchFatherName, RegExpMotherName,
SearchMotherName, RegExpChildName,
SearchChildName, HasEvent, HasRelType,
HasMarkerOf, HasNoteRegexp,
HasNoteMatchingSubstringOf, MatchesFilter)
GenericFamilyFilter = GenericFilterFactory('Family')
#-------------------------------------------------------------------------
@ -55,21 +60,18 @@ GenericFamilyFilter = GenericFilterFactory('Family')
class FamilySidebarFilter(SidebarFilter):
def __init__(self, dbstate, uistate, clicked):
SidebarFilter.__init__(self, dbstate, uistate)
self.clicked_func = clicked
def create_widget(self):
self.filter_id = gtk.Entry()
self.filter_father = gtk.Entry()
self.filter_mother = gtk.Entry()
self.filter_child = gtk.Entry()
self.filter_event = gen.lib.Event()
self.filter_event.set_type((gen.lib.EventType.CUSTOM,u''))
self.filter_event.set_type((gen.lib.EventType.CUSTOM, u''))
self.etype = gtk.ComboBoxEntry()
self.family_stub = gen.lib.Family()
self.family_stub.set_relationship((gen.lib.FamilyRelType.CUSTOM,u''))
self.family_stub.set_relationship((gen.lib.FamilyRelType.CUSTOM, u''))
self.rtype = gtk.ComboBoxEntry()
self.event_menu = GrampsWidgets.MonitoredDataType(
@ -83,7 +85,7 @@ class FamilySidebarFilter(SidebarFilter):
self.family_stub.get_relationship)
self.filter_marker = gen.lib.Family()
self.filter_marker.set_marker((gen.lib.MarkerType.CUSTOM,u''))
self.filter_marker.set_marker((gen.lib.MarkerType.CUSTOM, u''))
self.mtype = gtk.ComboBoxEntry()
self.marker_menu = GrampsWidgets.MonitoredDataType(
self.mtype,
@ -95,6 +97,10 @@ class FamilySidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate)
def create_widget(self):
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
@ -132,10 +138,10 @@ class FamilySidebarFilter(SidebarFilter):
rtype = self.family_stub.get_relationship().xml_str()
mtype = self.filter_marker.get_marker().xml_str()
regex = self.filter_regex.get_active()
gen = self.generic.get_active() > 0
generic = self.generic.get_active() > 0
empty = not (gid or father or mother or child or note or mtype
or regex or etype or rtype or gen)
or regex or etype or rtype or generic)
if empty:
generic_filter = None
else:
@ -196,10 +202,10 @@ class FamilySidebarFilter(SidebarFilter):
return generic_filter
def on_filters_changed(self,name_space):
def on_filters_changed(self, name_space):
if name_space == 'Family':
all = GenericFamilyFilter()
all.set_name(_("None"))
all.add_rule(Rules.Family.AllFamilies([]))
self.generic.set_model(build_filter_model('Family', [all]))
all_filter = GenericFamilyFilter()
all_filter.set_name(_("None"))
all_filter.add_rule(Rules.Family.AllFamilies([]))
self.generic.set_model(build_filter_model('Family', [all_filter]))
self.generic.set_active(0)

View File

@ -39,12 +39,11 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import GrampsWidgets
import gen.lib
from _SidebarFilter import SidebarFilter
from Filters.SideBar import SidebarFilter
from Filters import GenericFilterFactory, build_filter_model, Rules
from Filters.Rules.MediaObject import *
from Filters.Rules.MediaObject import (RegExpIdOf, HasIdOf, HasMedia,
HasNoteRegexp, MatchesFilter,
HasNoteMatchingSubstringOf)
GenericMediaFilter = GenericFilterFactory('MediaObject')
#-------------------------------------------------------------------------
@ -55,10 +54,7 @@ GenericMediaFilter = GenericFilterFactory('MediaObject')
class MediaSidebarFilter(SidebarFilter):
def __init__(self, dbstate, uistate, clicked):
SidebarFilter.__init__(self, dbstate, uistate)
self.clicked_func = clicked
def create_widget(self):
self.filter_id = gtk.Entry()
self.filter_title = gtk.Entry()
self.filter_type = gtk.Entry()
@ -70,6 +66,10 @@ class MediaSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate)
def create_widget(self):
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
@ -116,7 +116,7 @@ class MediaSidebarFilter(SidebarFilter):
rule = HasIdOf([gid])
generic_filter.add_rule(rule)
rule = HasMedia([title,mime,path,date])
rule = HasMedia([title, mime, path, date])
generic_filter.add_rule(rule)
if note:
@ -135,10 +135,11 @@ class MediaSidebarFilter(SidebarFilter):
return generic_filter
def on_filters_changed(self,name_space):
def on_filters_changed(self, name_space):
if name_space == 'MediaObject':
all = GenericMediaFilter()
all.set_name(_("None"))
all.add_rule(Rules.MediaObject.AllMedia([]))
self.generic.set_model(build_filter_model('MediaObject', [all]))
all_filter = GenericMediaFilter()
all_filter.set_name(_("None"))
all_filter.add_rule(Rules.MediaObject.AllMedia([]))
self.generic.set_model(build_filter_model('MediaObject',
[all_filter]))
self.generic.set_active(0)

View File

@ -42,9 +42,9 @@ import gtk
import GrampsWidgets
from gen.lib import Note, NoteType
from _SidebarFilter import SidebarFilter
from Filters.SideBar import SidebarFilter
from Filters import GenericFilterFactory, build_filter_model, Rules
from Filters.Rules.Note import *
from Filters.Rules.Note import RegExpIdOf, HasIdOf, HasNote, MatchesFilter
GenericNoteFilter = GenericFilterFactory('Note')
#-------------------------------------------------------------------------
@ -55,10 +55,7 @@ GenericNoteFilter = GenericFilterFactory('Note')
class NoteSidebarFilter(SidebarFilter):
def __init__(self, dbstate, uistate, clicked):
SidebarFilter.__init__(self, dbstate, uistate)
self.clicked_func = clicked
def create_widget(self):
self.filter_id = gtk.Entry()
self.filter_text = gtk.Entry()
@ -73,6 +70,10 @@ class NoteSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate)
def create_widget(self):
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
@ -109,7 +110,7 @@ class NoteSidebarFilter(SidebarFilter):
rule = HasIdOf([gid])
generic_filter.add_rule(rule)
rule = HasNote([text,ntype])
rule = HasNote([text, ntype])
generic_filter.add_rule(rule)
@ -122,10 +123,10 @@ class NoteSidebarFilter(SidebarFilter):
return generic_filter
def on_filters_changed(self,name_space):
def on_filters_changed(self, name_space):
if name_space == 'Note':
all = GenericNoteFilter()
all.set_name(_("None"))
all.add_rule(Rules.Note.AllNotes([]))
self.generic.set_model(build_filter_model('Note', [all]))
all_filter = GenericNoteFilter()
all_filter.set_name(_("None"))
all_filter.add_rule(Rules.Note.AllNotes([]))
self.generic.set_model(build_filter_model('Note', [all_filter]))
self.generic.set_active(0)

View File

@ -43,16 +43,23 @@ import GrampsWidgets
import gen.lib
import DateHandler
from _SidebarFilter import SidebarFilter
from Filters.Rules.Person import *
from Filters.SideBar import SidebarFilter
from Filters.Rules.Person import (RegExpName, SearchName, RegExpIdOf,
MatchIdOf, IsMale, IsFemale,
HasUnknownGender, HasMarkerOf, HasEvent,
HasBirth, HasDeath, HasNoteRegexp,
HasNoteMatchingSubstringOf, MatchesFilter)
from Filters import GenericFilter, build_filter_model, Rules
def extract_text(entry_widget):
"""
Extracts the text from the entry widget, strips off any extra spaces,
and converts the string to unicode. For some strange reason a gtk bug
prevents the extracted string from being of type unicode.
Extract the text from the entry widget, strips off any extra spaces,
and converts the string to unicode.
For some strange reason a gtk bug prevents the extracted string from being
of type unicode.
"""
return unicode(entry_widget.get_text().strip())
@ -64,10 +71,7 @@ def extract_text(entry_widget):
class PersonSidebarFilter(SidebarFilter):
def __init__(self, dbstate, uistate, clicked):
SidebarFilter.__init__(self, dbstate, uistate)
self.clicked_func = clicked
def create_widget(self):
self.filter_name = gtk.Entry()
self.filter_id = gtk.Entry()
self.filter_birth = gtk.Entry()
@ -97,6 +101,10 @@ class PersonSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate)
def create_widget(self):
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
@ -155,13 +163,13 @@ class PersonSidebarFilter(SidebarFilter):
mtype = self.filter_marker.get_marker().xml_str()
gender = self.filter_gender.get_active()
regex = self.filter_regex.get_active()
gen = self.generic.get_active() > 0
generic = self.generic.get_active() > 0
# check to see if the filter is empty. If it is empty, then
# we don't build a filter
empty = not (name or gid or birth or death or etype or mtype
or note or gender or regex or gen)
or note or gender or regex or generic)
if empty:
generic_filter = None
else:
@ -237,8 +245,8 @@ class PersonSidebarFilter(SidebarFilter):
def on_filters_changed(self, name_space):
if name_space == 'Person':
all = GenericFilter()
all.set_name(_("None"))
all.add_rule(Rules.Person.Everyone([]))
self.generic.set_model(build_filter_model('Person', [all]))
all_filter = GenericFilter()
all_filter.set_name(_("None"))
all_filter.add_rule(Rules.Person.Everyone([]))
self.generic.set_model(build_filter_model('Person', [all_filter]))
self.generic.set_active(0)

View File

@ -39,12 +39,11 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import GrampsWidgets
import gen.lib
from _SidebarFilter import SidebarFilter
from Filters.SideBar import SidebarFilter
from Filters import GenericFilterFactory, build_filter_model, Rules
from Filters.Rules.Place import *
from Filters.Rules.Place import (RegExpIdOf, HasIdOf, HasPlace, HasNoteRegexp,
HasNoteMatchingSubstringOf, MatchesFilter)
GenericPlaceFilter = GenericFilterFactory('Place')
#-------------------------------------------------------------------------
@ -55,10 +54,8 @@ GenericPlaceFilter = GenericFilterFactory('Place')
class PlaceSidebarFilter(SidebarFilter):
def __init__(self, dbstate, uistate, clicked):
SidebarFilter.__init__(self, dbstate, uistate)
self.clicked_func = clicked
def create_widget(self):
self.filter_id = gtk.Entry()
self.filter_title = gtk.Entry()
self.filter_parish = gtk.Entry()
@ -67,12 +64,13 @@ class PlaceSidebarFilter(SidebarFilter):
self.filter_county = gtk.Entry()
self.filter_state = gtk.Entry()
self.filter_country = gtk.Entry()
self.filter_note = gtk.Entry()
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate)
def create_widget(self):
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
@ -128,7 +126,7 @@ class PlaceSidebarFilter(SidebarFilter):
rule = HasIdOf([gid])
generic_filter.add_rule(rule)
rule = HasPlace([title,parish,zipc,city,county,state,country])
rule = HasPlace([title, parish, zipc, city, county, state, country])
generic_filter.add_rule(rule)
if note:
@ -147,10 +145,10 @@ class PlaceSidebarFilter(SidebarFilter):
return generic_filter
def on_filters_changed(self,name_space):
def on_filters_changed(self, name_space):
if name_space == 'Place':
all = GenericPlaceFilter()
all.set_name(_("None"))
all.add_rule(Rules.Place.AllPlaces([]))
self.generic.set_model(build_filter_model('Place', [all]))
all_filter = GenericPlaceFilter()
all_filter.set_name(_("None"))
all_filter.add_rule(Rules.Place.AllPlaces([]))
self.generic.set_model(build_filter_model('Place', [all_filter]))
self.generic.set_active(0)

View File

@ -42,9 +42,11 @@ import gtk
import GrampsWidgets
from gen.lib import Repository, RepositoryType
from _SidebarFilter import SidebarFilter
from Filters.SideBar import SidebarFilter
from Filters import GenericFilterFactory, build_filter_model, Rules
from Filters.Rules.Repository import *
from Filters.Rules.Repository import (RegExpIdOf, HasIdOf, HasRepo,
HasNoteRegexp, MatchesFilter,
HasNoteMatchingSubstringOf)
GenericRepoFilter = GenericFilterFactory('Repository')
#-------------------------------------------------------------------------
@ -55,10 +57,7 @@ GenericRepoFilter = GenericFilterFactory('Repository')
class RepoSidebarFilter(SidebarFilter):
def __init__(self, dbstate, uistate, clicked):
SidebarFilter.__init__(self, dbstate, uistate)
self.clicked_func = clicked
def create_widget(self):
self.filter_id = gtk.Entry()
self.filter_title = gtk.Entry()
self.filter_address = gtk.Entry()
@ -77,6 +76,10 @@ class RepoSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate)
def create_widget(self):
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
@ -123,7 +126,7 @@ class RepoSidebarFilter(SidebarFilter):
rule = HasIdOf([gid])
generic_filter.add_rule(rule)
rule = HasRepo([title,rtype,address,url])
rule = HasRepo([title, rtype, address, url])
generic_filter.add_rule(rule)
if note:
@ -142,10 +145,11 @@ class RepoSidebarFilter(SidebarFilter):
return generic_filter
def on_filters_changed(self,name_space):
def on_filters_changed(self, name_space):
if name_space == 'Repository':
all = GenericRepoFilter()
all.set_name(_("None"))
all.add_rule(Rules.Repository.AllRepos([]))
self.generic.set_model(build_filter_model('Repository', [all]))
all_filter = GenericRepoFilter()
all_filter.set_name(_("None"))
all_filter.add_rule(Rules.Repository.AllRepos([]))
self.generic.set_model(build_filter_model('Repository',
[all_filter]))
self.generic.set_active(0)

View File

@ -32,14 +32,17 @@ class SidebarFilter:
def __init__(self, dbstate, uistate):
self.position = 1
self.table = gtk.Table(4,11)
self.table = gtk.Table(4, 11)
self.table.set_border_width(6)
self.table.set_row_spacings(6)
self.table.set_col_spacing(0,6)
self.table.set_col_spacing(1,6)
self.table.set_col_spacing(0, 6)
self.table.set_col_spacing(1, 6)
self.tooltips = gtk.Tooltips()
self.apply_btn = gtk.Button(stock=gtk.STOCK_FIND)
self.clear_btn = gtk.Button()
self._init_interface()
uistate.connect('filters-changed',self.on_filters_changed)
uistate.connect('filters-changed', self.on_filters_changed)
self.uistate = uistate
self.dbstate = dbstate
@ -60,7 +63,6 @@ class SidebarFilter:
self.create_widget()
self.apply_btn = gtk.Button(stock=gtk.STOCK_FIND)
self.apply_btn.connect('clicked', self.clicked)
hbox = gtk.HBox()
@ -70,11 +72,10 @@ class SidebarFilter:
image.show()
label = gtk.Label(_('Reset'))
label.show()
hbox.pack_start(image,False,False)
hbox.pack_start(label,False,True)
hbox.pack_start(image, False, False)
hbox.pack_start(label, False, True)
hbox.set_spacing(4)
self.clear_btn = gtk.Button()
self.clear_btn.add(hbox)
self.clear_btn.connect('clicked', self.clear)
@ -112,7 +113,7 @@ class SidebarFilter:
def add_text_entry(self, name, widget, tooltip=None):
self.add_entry(name, widget)
widget.connect('key-press-event',self.key_press)
widget.connect('key-press-event', self.key_press)
if tooltip:
self.tooltips.set_tip(widget, tooltip)
@ -131,6 +132,6 @@ class SidebarFilter:
xoptions=gtk.FILL, yoptions=0)
self.position += 1
def on_filters_changed(self,namespace):
def on_filters_changed(self, namespace):
pass

View File

@ -39,12 +39,11 @@ import gtk
# GRAMPS modules
#
#-------------------------------------------------------------------------
import GrampsWidgets
import gen.lib
from _SidebarFilter import SidebarFilter
from Filters.SideBar import SidebarFilter
from Filters import GenericFilterFactory, build_filter_model, Rules
from Filters.Rules.Source import *
from Filters.Rules.Source import (RegExpIdOf, HasIdOf, HasSource,
HasNoteMatchingSubstringOf, HasNoteRegexp,
MatchesFilter)
GenericSourceFilter = GenericFilterFactory('Source')
#-------------------------------------------------------------------------
@ -55,10 +54,7 @@ GenericSourceFilter = GenericFilterFactory('Source')
class SourceSidebarFilter(SidebarFilter):
def __init__(self, dbstate, uistate, clicked):
SidebarFilter.__init__(self, dbstate, uistate)
self.clicked_func = clicked
def create_widget(self):
self.filter_id = gtk.Entry()
self.filter_title = gtk.Entry()
self.filter_author = gtk.Entry()
@ -68,6 +64,10 @@ class SourceSidebarFilter(SidebarFilter):
self.filter_regex = gtk.CheckButton(_('Use regular expressions'))
self.generic = gtk.ComboBox()
SidebarFilter.__init__(self, dbstate, uistate)
def create_widget(self):
cell = gtk.CellRendererText()
self.generic.pack_start(cell, True)
self.generic.add_attribute(cell, 'text', 0)
@ -110,7 +110,7 @@ class SourceSidebarFilter(SidebarFilter):
rule = HasIdOf([gid])
generic_filter.add_rule(rule)
rule = HasSource([title,author,pub])
rule = HasSource([title, author, pub])
generic_filter.add_rule(rule)
if note:
@ -129,10 +129,10 @@ class SourceSidebarFilter(SidebarFilter):
return generic_filter
def on_filters_changed(self,name_space):
def on_filters_changed(self, name_space):
if name_space == 'Source':
all = GenericSourceFilter()
all.set_name(_("None"))
all.add_rule(Rules.Source.AllSources([]))
self.generic.set_model(build_filter_model('Source', [all]))
all_filter = GenericSourceFilter()
all_filter.set_name(_("None"))
all_filter.add_rule(Rules.Source.AllSources([]))
self.generic.set_model(build_filter_model('Source', [all_filter]))
self.generic.set_active(0)

View File

@ -34,7 +34,6 @@ to version 2.2.x
import cPickle as pickle
import os
import shutil
import re
import time
from gettext import gettext as _
from bsddb import dbshelve, db

View File

@ -34,7 +34,6 @@ This is used since GRAMPS version 3.0
import cPickle as pickle
import os
import shutil
import re
import time
from types import InstanceType

View File

@ -28,7 +28,6 @@
#
#-------------------------------------------------------------------------
import os
import re
from gettext import gettext as _
#-------------------------------------------------------------------------