def build_form_widgets(self):
        """Build widgets which compose the form."""
        ### create special list to hold widgets
        self.widgets = List2D()

        ### define an initial topleft relative to the
        ### topleft corner of the form 'rect'
        topleft = self.rect.move(5, 5).topleft

        ### instantiate a caption for the form

        self.caption_label = Label(
            text=(t.file_manager.new_path_form.caption),
            font_height=ENC_SANS_BOLD_FONT_HEIGHT,
            foreground_color=WINDOW_FG,
            background_color=WINDOW_BG,
            coordinates_name="topleft",
            coordinates_value=topleft,
        )

        self.widgets.append(self.caption_label)

        ### update the topleft to a value a bit below
        ### the bottomleft corner of the widgets already
        ### in the versatile list, and also a bit to the
        ### right
        topleft = self.widgets.rect.move(5, 10).bottomleft

        ### instantiate icon object

        self.icon = Object2D()

        self.icon.image = FILE_ICON
        self.icon.rect = self.icon.image.get_rect()
        self.icon.rect.topleft = topleft

        self.widgets.append(self.icon)

        ### instantiate type name label

        self.type_name_label = Label(
            text=(t.file_manager.new_path_form.type_path_name + ":"),
            font_height=ENC_SANS_BOLD_FONT_HEIGHT,
            foreground_color=WINDOW_FG,
            background_color=WINDOW_BG,
            coordinates_name="midleft",
            coordinates_value=self.icon.rect.midright,
        )

        self.widgets.append(self.type_name_label)

        ### update the topleft to a value a bit below
        ### the bottomleft corner of the widgets already
        ### in the versatile list, and a bit to the right
        topleft = self.widgets.rect.move(5, 5).bottomleft

        ### instantiate path name entry

        self.path_name_entry = StringEntry(
            value="",
            loop_holder=self,
            width=self.rect.width - 20,
            font_height=ENC_SANS_BOLD_FONT_HEIGHT,
            draw_on_window_resize=(
                CallList(
                    [
                        lambda: APP_REFS.fm.draw(),
                        self.draw,
                    ]
                )
            ),
            coordinates_name="topleft",
            coordinates_value=topleft,
        )

        self.widgets.append(self.path_name_entry)

        ### create, position and store form related buttons

        bottomright = self.rect.move(-10, -10).bottomright

        for attr_name, text, mouse_release_action in (
            (
                "create_button",
                t.file_manager.new_path_form.create,
                self.submit_form,
            ),
            ("cancel_button", t.file_manager.new_path_form.cancel, self.cancel_form),
        ):

            ## create button

            button = Button.from_text(
                text=text,
                font_height=ENC_SANS_BOLD_FONT_HEIGHT,
                padding=5,
                foreground_color=BUTTON_FG,
                background_color=BUTTON_BG,
                coordinates_name="bottomright",
                coordinates_value=bottomright,
                command=mouse_release_action,
            )

            ## improve surface style by giving a finish
            ## to convey depth
            draw_depth_finish(button.image)

            ## store in dedicated attribute
            setattr(self, attr_name, button)

            ## update the bottomright for the next button
            bottomright = button.rect.move(-5, 0).bottomleft

        ## also store buttons on the widgets special list

        self.widgets.extend(
            (
                self.create_button,
                self.cancel_button,
            )
        )
Build widgets which compose the form.
nodezator/fileman/dirpanel/newpathform.py