def set_frame(self, index): if index is None: self._current_frameIndex = -1 else: index = utils.clamp(index, 0, len(self._frames) - 1) self._current_frameIndex = index
def selected_index(self, value): value = utils.clamp(value, 0, len(self._items) - 1) if self._selectedItem is not None: self._selectedItem.selected = False self._selectedItem = None self._selectedItem = self._items[value] self._selectedItem.selected = True self.update()
def copy_frame(self, index=None): if index is None: index = self._current_frameIndex else: index = utils.clamp(index, 0, len(self._frames) - 1) clone = self._frames[index].clone() if index < len(self._frames) - 1: self._frames.insert(self._current_frameIndex, clone) else: self._frames.append(clone) self.set_frame(index + 1)
def remove_frame(self, index=None): if index is None: index = self._current_frameIndex else: index = utils.clamp(index, 0, len(self._frames) - 1) new_index = index if self._current_frameIndex == index: if self.is_on_last_frame: new_index -= 1 del self._frames[index] if len(self._frames) > 0: self.set_frame(new_index) else: self.set_frame(None)
def animation_at(self, index): index = utils.clamp(index, 0, len(self._animations) - 1) return self._animations[index]
def set_surface(self, index): index = utils.clamp(index, 0, len(self._surfaces) - 1) self._current_surface_index = index
def surface_at(self, index): index = utils.clamp(index, 0, len(self._surfaces) - 1) return self._surfaces[index]
def frame_at(self, index): index = utils.clamp(index, 0, len(self._frames) - 1) return self._frames[index]
def set_animation(self, index): index = utils.clamp(index, 0, len(self._animations) - 1) self._currentAnimationIndex = index