comparison src/browser/panels.py @ 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 1a0cec9b0f1e
children 07433bd892ee
comparison
equal deleted inserted replaced
460:d0cd8ae579f7 461:4f25aa5039b3
704 entry.edit(True) 704 entry.edit(True)
705 if NEW_MESSAGE_USE_BUTTON: 705 if NEW_MESSAGE_USE_BUTTON:
706 self.new_button = Button("New message", listener=addBox) 706 self.new_button = Button("New message", listener=addBox)
707 self.new_button.setStyleName("microblogNewButton") 707 self.new_button.setStyleName("microblogNewButton")
708 self.vpanel.insert(self.new_button, 0) 708 self.vpanel.insert(self.new_button, 0)
709 else: 709 elif not self.getNewMainEntry():
710 addBox() 710 addBox()
711
712 def getNewMainEntry(self):
713 """Get the new entry being edited, or None if it doesn't exists.
714
715 @return (MicroblogEntry): the new entry being edited.
716 """
717 try:
718 first = self.vpanel.children[0]
719 except IndexError:
720 return None
721 assert(first.type == 'main_item')
722 return first if first.empty else None
711 723
712 @classmethod 724 @classmethod
713 def registerClass(cls): 725 def registerClass(cls):
714 base_widget.LiberviaWidget.addDropKey("GROUP", cls.createPanel) 726 base_widget.LiberviaWidget.addDropKey("GROUP", cls.createPanel)
715 base_widget.LiberviaWidget.addDropKey("CONTACT_TITLE", cls.createMetaPanel) 727 base_widget.LiberviaWidget.addDropKey("CONTACT_TITLE", cls.createMetaPanel)