comparison frontends/src/primitivus/chat.py @ 1967:de6faf9be715 refacoring_messages

primitivus (chat): fixed filters clearing when changing filter while one already exists
author Goffi <goffi@goffi.org>
date Mon, 20 Jun 2016 23:07:53 +0200
parents d727aab9a80e
children 200cd707a46d
comparison
equal deleted inserted replaced
1966:d727aab9a80e 1967:de6faf9be715
274 274
275 @param args(list[unicode]): filters following syntax "[filter]=[value]" 275 @param args(list[unicode]): filters following syntax "[filter]=[value]"
276 empty list to clear all filters 276 empty list to clear all filters
277 only lang=XX is handled for now 277 only lang=XX is handled for now
278 """ 278 """
279 del self.filters[:]
279 if args: 280 if args:
280 if args[0].startswith("lang="): 281 if args[0].startswith("lang="):
281 lang = args[0][5:].strip() 282 lang = args[0][5:].strip()
282 self.filters.append(lambda mess_data: lang in mess_data.message) 283 self.filters.append(lambda mess_data: lang in mess_data.message)
283 else:
284 del self.filters[:]
285 284
286 del self.mess_walker[:] 285 del self.mess_walker[:]
287 for message in self.messages.itervalues(): 286 for message in self.messages.itervalues():
288 self.appendMessage(message) 287 self.appendMessage(message)
289 288