From 5ead9508be146150460be1c8d975945b1ac35321 Mon Sep 17 00:00:00 2001 From: Michiel Nauta Date: Sat, 28 Jan 2012 22:10:56 +0000 Subject: [PATCH] 5536: Abbreviation field in source sidebar filter svn: r18786 --- src/Filters/Rules/_HasSourceBase.py | 6 +++++- src/Filters/SideBar/_SourceSidebarFilter.py | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Filters/Rules/_HasSourceBase.py b/src/Filters/Rules/_HasSourceBase.py index e0f44fac9..aa663bd1e 100644 --- a/src/Filters/Rules/_HasSourceBase.py +++ b/src/Filters/Rules/_HasSourceBase.py @@ -46,6 +46,7 @@ class HasSourceBase(Rule): labels = [ _('Title:'), _('Author:'), + _('Abbreviation:'), _('Publication:') ] name = _('Sources matching parameters') description = _("Matches sources with particular parameters") @@ -58,7 +59,10 @@ class HasSourceBase(Rule): if not self.match_substring(1,source.get_author()): return False - if not self.match_substring(2,source.get_publication_info()): + if not self.match_substring(2,source.get_abbreviation()): + return False + + if not self.match_substring(3,source.get_publication_info()): return False return True diff --git a/src/Filters/SideBar/_SourceSidebarFilter.py b/src/Filters/SideBar/_SourceSidebarFilter.py index 2199deab7..32473fa83 100644 --- a/src/Filters/SideBar/_SourceSidebarFilter.py +++ b/src/Filters/SideBar/_SourceSidebarFilter.py @@ -59,6 +59,7 @@ class SourceSidebarFilter(SidebarFilter): self.filter_id = widgets.BasicEntry() self.filter_title = widgets.BasicEntry() self.filter_author = widgets.BasicEntry() + self.filter_abbr = widgets.BasicEntry() self.filter_pub = widgets.BasicEntry() self.filter_note = widgets.BasicEntry() @@ -79,6 +80,7 @@ class SourceSidebarFilter(SidebarFilter): self.add_text_entry(_('ID'), self.filter_id) self.add_text_entry(_('Title'), self.filter_title) self.add_text_entry(_('Author'), self.filter_author) + self.add_text_entry(_('Abbreviation'), self.filter_abbr) self.add_text_entry(_('Publication'), self.filter_pub) self.add_text_entry(_('Note'), self.filter_note) self.add_filter_entry(_('Custom filter'), self.generic) @@ -88,6 +90,7 @@ class SourceSidebarFilter(SidebarFilter): self.filter_id.set_text('') self.filter_title.set_text('') self.filter_author.set_text('') + self.filter_abbr.set_text('') self.filter_pub.set_text('') self.filter_note.set_text('') self.generic.set_active(0) @@ -96,12 +99,14 @@ class SourceSidebarFilter(SidebarFilter): gid = unicode(self.filter_id.get_text()).strip() title = unicode(self.filter_title.get_text()).strip() author = unicode(self.filter_author.get_text()).strip() + abbr = unicode(self.filter_abbr.get_text()).strip() pub = unicode(self.filter_pub.get_text()).strip() note = unicode(self.filter_note.get_text()).strip() regex = self.filter_regex.get_active() gen = self.generic.get_active() > 0 - empty = not (gid or title or author or pub or note or regex or gen) + empty = not (gid or title or author or abbr or pub or note or regex or + gen) if empty: generic_filter = None else: @@ -113,7 +118,7 @@ class SourceSidebarFilter(SidebarFilter): rule = HasIdOf([gid]) generic_filter.add_rule(rule) - rule = HasSource([title, author, pub], use_regex=regex) + rule = HasSource([title, author, abbr, pub], use_regex=regex) generic_filter.add_rule(rule) if note: