backend (memory), frontends: improved history filtering:

a "filters" dictionnary is now use to filter, it can have, for now, filtering on:
        - "body": filter only on the body (equivalent to former "search" parameter, but not case sensitive)
        - "search": fitler on body + source resource
        - "types": allowed types
        - "not_types": forbidden types

    primitivus now do searching using "search", i.e. source resource is now taken into account (and search is now case insensitive)
This commit is contained in:
Goffi 2016-07-18 00:52:02 +02:00
commit 9647e90943

View file

@ -540,12 +540,12 @@ class Chat(PrimitivusWidget, quick_chat.QuickChat):
except AttributeError:
pass
def updateHistory(self, size=C.HISTORY_LIMIT_DEFAULT, search='', profile='@NONE@'):
def updateHistory(self, size=C.HISTORY_LIMIT_DEFAULT, filters=None, profile='@NONE@'):
del self.mess_walker[:]
if search:
self.mess_walker.append(urwid.Text(_(u"Results for searching the globbing pattern: {}").format(search)))
self.mess_walker.append(urwid.Text(_(u"Type ':history <lines>' to reset the chat history").format(search)))
super(Chat, self).updateHistory(size, search, profile)
if filters and 'search' in filters:
self.mess_walker.append(urwid.Text(_(u"Results for searching the globbing pattern: {}").format(filters['search'])))
self.mess_walker.append(urwid.Text(_(u"Type ':history <lines>' to reset the chat history")))
super(Chat, self).updateHistory(size, filters, profile)
def _onHistoryPrinted(self):
"""Refresh or scroll down the focus after the history is printed"""