def prepare_objs(self, sorted_items, available_items):
        """Instantiate special objects representing items.

        Parameters: see "sort_sequence" method docstring.
        """
        ### for each list, attribute name and area listed,
        ### define a new List2D instance containing
        ### the items of the list, align such items and
        ### position them according to the given area and
        ### finally store the List2D instance in the
        ### attribute

        for class_, collection, attr_name, area in (
            (List2D, sorted_items, "items", self.items_area),
            (Set2D, available_items, "available_items", self.available_items_area),
        ):

            ## instantiate collection

            items = class_(
                Object2D.from_surface(
                    surface=(
                        render_text(
                            text=repr(item),
                            font_height=ENC_SANS_BOLD_FONT_HEIGHT,
                            padding=5,
                            depth_finish_thickness=1,
                            foreground_color=(0, 0, 190),
                            background_color=(255,) * 3,
                            border_color=(0, 0, 190),
                            border_thickness=2,
                        )
                    ),
                    value=item,
                )
                for item in collection
            )

            ## align its items and position the instance
            ## if not empty

            if items:

                items.rect.snap_rects_ip(
                    retrieve_pos_from="topright",
                    assign_pos_to="topleft",
                    offset_pos_by=(5, 0),
                )

                items.rect.midleft = area.move(30, 7).midleft

            ## store the instance in an attribute
            setattr(self, attr_name, items)
Instantiate special objects representing items.

        Parameters: see "sort_sequence" method docstring.
        
nodezator/our3rdlibs/sortingeditor/main.py