コード例 #1
0
    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
コード例 #2
0
    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()
コード例 #3
0
    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)
コード例 #4
0
    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)
コード例 #5
0
    def animation_at(self, index):

        index = utils.clamp(index, 0, len(self._animations) - 1)
        return self._animations[index]
コード例 #6
0
    def set_surface(self, index):

        index = utils.clamp(index, 0, len(self._surfaces) - 1)

        self._current_surface_index = index
コード例 #7
0
    def surface_at(self, index):

        index = utils.clamp(index, 0, len(self._surfaces) - 1)
        return self._surfaces[index]
コード例 #8
0
    def frame_at(self, index):

        index = utils.clamp(index, 0, len(self._frames) - 1)
        return self._frames[index]
コード例 #9
0
    def set_animation(self, index):

        index = utils.clamp(index, 0, len(self._animations) - 1)

        self._currentAnimationIndex = index