def copy(self, name): new = self._parent.new(name) for orig, copied in zip(self.settings, new.settings): copied.set_from(orig) new.data.steps = [robotapi.Step(s.as_list()) for s in self.steps] new.notify_steps_changed() return new
def _replace_steps_with_kw(self, name, step_range): steps_before_extraction_point = self._convert_controller_to_steps( self.steps[:step_range[0]]) extracted_kw_step = [robotapi.Step([name])] steps_after_extraction_point = self._convert_controller_to_steps( self.steps[step_range[1] + 1:]) self.set_steps(steps_before_extraction_point + extracted_kw_step + steps_after_extraction_point)
def _replace_with_normal_step(self, index, cells=None, comment=None): index_of_parent = self.parent.parent.index_of_step(self.parent._step) self.parent.parent.add_step( index_of_parent + index + 2, robotapi.Step(cells or self.as_list(), comment=comment)) self.parent.get_raw_steps().pop(index)
def _replace_with_new_cells(self, cells): index = self.parent.index_of_step(self._step) self.parent.replace_step(index, robotapi.Step(cells)) self.get_raw_steps().reverse() for substep in self.steps: self.parent.add_step(index + 1, robotapi.Step(substep.as_list()))
def _recreate_as_intended_step(self, for_loop_step, cells, comment, index): self.remove() for_loop_step.add_step(robotapi.Step(cells[1:], comment)) self._recreate_next_step(index)
def _empty_step(): return robotapi.Step([])
def _convert_controller_to_steps(self, step_controllers): return [robotapi.Step(s.as_list()) for s in step_controllers]