(self, block, new_index)
Moves a block from one index to another.
Moves a block from one index to another.
Moves a block from one index to another .
def move_to(self, block, new_index):
        """Moves a block from one index to another."""
        if new_index < 0:
            return
        old_index = block.index
        old_block = self._blocks.pop(old_index)
        if old_block.data != block.data:
            raise ValueError('Block is not correctly set.')
        self._blocks.insert(new_index, block)
        self.commit()
def move_to ( self , block , new_index ) : if new_index < 0 : return old_index = block . index old_block = self . _blocks . pop ( old_index ) if old_block . data != block . data : raise ValueError ( 'Block is not correctly set.' ) self . _blocks . insert ( new_index , block ) self . commit ( )