comparison frontends/src/primitivus/chat.py @ 2013:b536dd121da1

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)
author Goffi <goffi@goffi.org>
date Mon, 18 Jul 2016 00:52:02 +0200
parents d2144d04065e
children 20fb71b656e3
comparison
equal deleted inserted replaced
2012:53587e738aca 2013:b536dd121da1
538 try: 538 try:
539 w.redraw() 539 w.redraw()
540 except AttributeError: 540 except AttributeError:
541 pass 541 pass
542 542
543 def updateHistory(self, size=C.HISTORY_LIMIT_DEFAULT, search='', profile='@NONE@'): 543 def updateHistory(self, size=C.HISTORY_LIMIT_DEFAULT, filters=None, profile='@NONE@'):
544 del self.mess_walker[:] 544 del self.mess_walker[:]
545 if search: 545 if filters and 'search' in filters:
546 self.mess_walker.append(urwid.Text(_(u"Results for searching the globbing pattern: {}").format(search))) 546 self.mess_walker.append(urwid.Text(_(u"Results for searching the globbing pattern: {}").format(filters['search'])))
547 self.mess_walker.append(urwid.Text(_(u"Type ':history <lines>' to reset the chat history").format(search))) 547 self.mess_walker.append(urwid.Text(_(u"Type ':history <lines>' to reset the chat history")))
548 super(Chat, self).updateHistory(size, search, profile) 548 super(Chat, self).updateHistory(size, filters, profile)
549 549
550 def _onHistoryPrinted(self): 550 def _onHistoryPrinted(self):
551 """Refresh or scroll down the focus after the history is printed""" 551 """Refresh or scroll down the focus after the history is printed"""
552 self.printMessages(clear=False) 552 self.printMessages(clear=False)
553 super(Chat, self)._onHistoryPrinted() 553 super(Chat, self)._onHistoryPrinted()