def cursorAtSpaceEnd(block):
            cursor = QTextCursor(block)
            cursor.setPosition(block.position() + len(blockIndentation(block)))
            return cursor
def lock_temp(self, key):
    self.lock(key)
    try:
      yield
    finally:
      self.unlock(key)