Comment 1 for bug 1225927

Revision history for this message
Jon Hill (jon-hill) wrote :

This is a bit odd. I can replicate this easily. The store function is meant to kick in and store the comment as soon as the comment block loses focus (which includes clicking on another application). I can see the function getting called, but the comment is empty when a inactive portion of the tree was the click that lost the comment box focus.

Relevant code is in commentWidget.py

  def store(self):
    """
    Store data in the node comment.
    """

    comment_tree = self.comment_tree
    print comment_tree
    if comment_tree is None or not self.interacted:
      print "returning"
      return

    data_buffer_bounds = self.textView.get_buffer().get_bounds()
    new_comment = self.textView.get_buffer().get_text(data_buffer_bounds[0], data_buffer_bounds[1])

    if new_comment != comment_tree.data:
      print new_comment
      if new_comment == "":
        comment_tree.data = None
        comment_tree.active = False
      else:
        comment_tree.set_data(new_comment)
        comment_tree.active = True
        self.emit("on-store")
    return