Mercurial > libervia-web
changeset 461:4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
author | souliane <souliane@mailoo.org> |
---|---|
date | Wed, 04 Jun 2014 00:22:00 +0200 |
parents | d0cd8ae579f7 |
children | 07433bd892ee |
files | src/browser/panels.py |
diffstat | 1 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/browser/panels.py Mon Jun 02 19:29:07 2014 +0200 +++ b/src/browser/panels.py Wed Jun 04 00:22:00 2014 +0200 @@ -706,9 +706,21 @@ self.new_button = Button("New message", listener=addBox) self.new_button.setStyleName("microblogNewButton") self.vpanel.insert(self.new_button, 0) - else: + elif not self.getNewMainEntry(): addBox() + def getNewMainEntry(self): + """Get the new entry being edited, or None if it doesn't exists. + + @return (MicroblogEntry): the new entry being edited. + """ + try: + first = self.vpanel.children[0] + except IndexError: + return None + assert(first.type == 'main_item') + return first if first.empty else None + @classmethod def registerClass(cls): base_widget.LiberviaWidget.addDropKey("GROUP", cls.createPanel)