Mercurial > libervia-desktop-kivy
comparison cagou/plugins/plugin_wid_chat.py @ 144:ae58f84fe4e6
plugin chat: fixed dropdown:
dropdown was calling "open" each time a key was pressed, abd open is calling dismiss if dropdown is already opened.
But dismiss is calling _real_dissmiss with a schedule, resulting in incoherent state and the dropdown not closed when expected.
A check is now done to call "open" only when there is not already a dropdown, and to call dismiss when the text input is empty.
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 14 Apr 2018 16:02:54 +0200 |
parents | 53fb221ad084 |
children | 654b00fa3fdc |
comparison
equal
deleted
inserted
replaced
143:05d602be0120 | 144:ae58f84fe4e6 |
---|---|
280 return | 280 return |
281 text = text.lstrip() | 281 text = text.lstrip() |
282 if not text: | 282 if not text: |
283 self._hi_comp_data = None | 283 self._hi_comp_data = None |
284 self._hi_comp_last = None | 284 self._hi_comp_last = None |
285 self._hi_comp_dropdown.dismiss() | |
285 return | 286 return |
286 | 287 |
287 profile = list(self.profiles)[0] | 288 profile = list(self.profiles)[0] |
288 | 289 |
289 if self._hi_comp_data is None: | 290 if self._hi_comp_data is None: |
321 for c in dropdown.children[0].children: | 322 for c in dropdown.children[0].children: |
322 if text not in c.jid and text not in (c.nick or ''): | 323 if text not in c.jid and text not in (c.nick or ''): |
323 to_remove.append(c) | 324 to_remove.append(c) |
324 for c in to_remove: | 325 for c in to_remove: |
325 dropdown.remove_widget(c) | 326 dropdown.remove_widget(c) |
326 | 327 if dropdown.attach_to is None: |
327 dropdown.open(wid) | 328 dropdown.open(wid) |
328 self._hi_comp_last = text | 329 self._hi_comp_last = text |
329 | 330 |
330 def messageDataConverter(self, idx, mess_id): | 331 def messageDataConverter(self, idx, mess_id): |
331 return {"mess_data": self.messages[mess_id]} | 332 return {"mess_data": self.messages[mess_id]} |
332 | 333 |