Mercurial > libervia-web
comparison 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 |
comparison
equal
deleted
inserted
replaced
413:7a8991cda2fa | 414:ae598511850d |
---|---|
468 @param new_avatar: path to the new image""" | 468 @param new_avatar: path to the new image""" |
469 self.avatar.setUrl(new_avatar) | 469 self.avatar.setUrl(new_avatar) |
470 | 470 |
471 def onClick(self, sender): | 471 def onClick(self, sender): |
472 if sender == self: | 472 if sender == self: |
473 try: # prevent re-selection of the main entry after a comment has been focused | |
474 if self.__ignoreNextEvent: | |
475 self.__ignoreNextEvent = False | |
476 return | |
477 except AttributeError: | |
478 pass | |
473 self._blog_panel.setSelectedEntry(self) | 479 self._blog_panel.setSelectedEntry(self) |
474 elif sender == self.delete_label: | 480 elif sender == self.delete_label: |
475 self._delete() | 481 self._delete() |
476 elif sender == self.update_label: | 482 elif sender == self.update_label: |
477 self.edit(True) | 483 self.edit(True) |
478 elif sender == self.comment_label: | 484 elif sender == self.comment_label: |
485 self.__ignoreNextEvent = True | |
479 self._comment() | 486 self._comment() |
480 | 487 |
481 def __modifiedCb(self, content): | 488 def __modifiedCb(self, content): |
482 """Send the new content to the backend | 489 """Send the new content to the backend |
483 @return: False to restore the original content if a deletion has been cancelled | 490 @return: False to restore the original content if a deletion has been cancelled |
564 | 571 |
565 def _comment(self): | 572 def _comment(self): |
566 """Add an empty entry for a new comment""" | 573 """Add an empty entry for a new comment""" |
567 if self._current_comment: | 574 if self._current_comment: |
568 self._current_comment.bubble.setFocus(True) | 575 self._current_comment.bubble.setFocus(True) |
576 self._blog_panel.setSelectedEntry(self._current_comment) | |
569 return | 577 return |
570 data = {'id': str(time()), | 578 data = {'id': str(time()), |
571 'new': True, | 579 'new': True, |
572 'type': 'comment', | 580 'type': 'comment', |
573 'author': self._blog_panel.host.whoami.bare, | 581 'author': self._blog_panel.host.whoami.bare, |
579 print "The entry of id %s can not be commented" % self.id | 587 print "The entry of id %s can not be commented" % self.id |
580 return | 588 return |
581 entry._parent_entry = self | 589 entry._parent_entry = self |
582 self._current_comment = entry | 590 self._current_comment = entry |
583 self.edit(True, entry) | 591 self.edit(True, entry) |
592 self._blog_panel.setSelectedEntry(entry) | |
584 | 593 |
585 def edit(self, edit, entry=None): | 594 def edit(self, edit, entry=None): |
586 """Toggle the bubble between display and edit mode | 595 """Toggle the bubble between display and edit mode |
587 @edit: boolean value | 596 @edit: boolean value |
588 @entry: MicroblogEntry instance, or None to use self | 597 @entry: MicroblogEntry instance, or None to use self |