def move_widget(self, amount):
        """Move current widget by number of given color slots.

        Parameters
        ==========
        amount (integer)
            number of color slots to jump left or right,
            depending on the signal.
        """
        ### retrieve current index
        index = self.colors_editor.current_color_index

        ### calculate and clamp new index to available
        ### indices

        new_index = index + amount

        new_index = min(max(0, new_index), len(self.widgets) - 1)

        ### if indices are the same, there's no point in
        ### moving the current widget
        if new_index == index:
            return

        ### from this point on, perform operations to move
        ### index

        ## define a slice object representing the slice
        ## of widgets affected by the change and whether
        ## we'll rotate such slice one position to the
        ## left or to the right (according to the signal
        ## of the rotation amount)

        elif index < new_index:

            slice_obj = slice(index, new_index + 1)
            rotation_amount = -1

        elif index > new_index:

            slice_obj = slice(new_index, index + 1)
            rotation_amount = 1

        ## this else clause should never be reached (at
        ## least given that both index and new_index are
        ## integer), so raise an error if such ever happens

        else:
            raise RuntimeError(
                "given the logic adopted, this block" " should never execute"
            )

        ## obtain a deque from that slice and store
        ## the positions of each widget in the slice

        slice_deque = deque(self.widgets[slice_obj])

        positions = [widget.rect.topleft for widget in slice_deque]

        ## rotate the slice in the desired direction,
        ## then update the position of each widget to
        ## the ones we stored

        slice_deque.rotate(rotation_amount)

        for widget, pos in zip(slice_deque, positions):
            widget.rect.topleft = pos

        ## then fit the widgets of the slice in their
        ## respective positions inside the widgets list
        self.widgets[slice_obj] = slice_deque

        ### finally, update the index of the current widget
        ### and store a reference to such widget

        self.colors_editor.current_color_index = new_index
        self.store_current_widget()
Move current widget by number of given color slots.

        Parameters
        ==========
        amount (integer)
            number of color slots to jump left or right,
            depending on the signal.
        
nodezator/colorsman/editor/panel/main.py