diff browser_side/panels.py @ 414:ae598511850d

browser_side: set microblog editor minimal width + fix the scrolling to comment
author souliane <souliane@mailoo.org>
date Fri, 21 Mar 2014 09:20:27 +0100
parents ee8ebfe23e16
children 20c508f9b32a
line wrap: on
line diff
--- a/browser_side/panels.py	Thu Mar 20 22:16:02 2014 +0100
+++ b/browser_side/panels.py	Fri Mar 21 09:20:27 2014 +0100
@@ -470,12 +470,19 @@
 
     def onClick(self, sender):
         if sender == self:
+            try:  # prevent re-selection of the main entry after a comment has been focused
+                if self.__ignoreNextEvent:
+                    self.__ignoreNextEvent = False
+                    return
+            except AttributeError:
+                pass
             self._blog_panel.setSelectedEntry(self)
         elif sender == self.delete_label:
             self._delete()
         elif sender == self.update_label:
             self.edit(True)
         elif sender == self.comment_label:
+            self.__ignoreNextEvent = True
             self._comment()
 
     def __modifiedCb(self, content):
@@ -566,6 +573,7 @@
         """Add an empty entry for a new comment"""
         if self._current_comment:
             self._current_comment.bubble.setFocus(True)
+            self._blog_panel.setSelectedEntry(self._current_comment)
             return
         data = {'id': str(time()),
                 'new': True,
@@ -581,6 +589,7 @@
         entry._parent_entry = self
         self._current_comment = entry
         self.edit(True, entry)
+        self._blog_panel.setSelectedEntry(entry)
 
     def edit(self, edit, entry=None):
         """Toggle the bubble between display and edit mode