def _setup_table_view_page()

in Gems/AWSCore/Code/Tools/ResourceMappingTool/view/view_edit_page.py [0:0]


    def _setup_table_view_page(self) -> None:
        self._table_view_page: QWidget = QWidget(self)
        table_view_vertical_layout: QVBoxLayout = QVBoxLayout(self._table_view_page)
        table_view_vertical_layout.setSizeConstraint(QLayout.SetMinimumSize)
        table_view_vertical_layout.setContentsMargins(0, 0, 0, 0)

        interaction_area: QWidget = QWidget(self._table_view_page)
        interaction_area.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Minimum)
        interaction_area.setMinimumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
                                        view_size_constants.TABLE_VIEW_PAGE_INTERACTION_AREA_HEIGHT)

        interaction_area_layout: QHBoxLayout = QHBoxLayout(interaction_area)
        interaction_area_layout.setSizeConstraint(QLayout.SetMinimumSize)
        interaction_area_layout.setContentsMargins(0, view_size_constants.VIEW_EDIT_PAGE_MARGIN_TOPBOTTOM,
                                                   0, view_size_constants.VIEW_EDIT_PAGE_MARGIN_TOPBOTTOM)

        self._add_row_button: QPushButton = QPushButton(interaction_area)
        self._add_row_button.setObjectName("Primary")
        self._add_row_button.setText(notification_label_text.VIEW_EDIT_PAGE_ADD_ROW_TEXT)
        self._add_row_button.setMinimumSize(view_size_constants.ADD_ROW_BUTTON_WIDTH,
                                            view_size_constants.INTERACTION_COMPONENT_HEIGHT)
        interaction_area_layout.addWidget(self._add_row_button)

        self._delete_row_button: QPushButton = QPushButton(interaction_area)
        self._delete_row_button.setObjectName("Primary")
        self._delete_row_button.setText(notification_label_text.VIEW_EDIT_PAGE_DELETE_ROW_TEXT)
        self._delete_row_button.setMinimumSize(view_size_constants.DELETE_ROW_BUTTON_WIDTH,
                                               view_size_constants.INTERACTION_COMPONENT_HEIGHT)
        interaction_area_layout.addWidget(self._delete_row_button)

        interaction_area_separator_label: QLabel = QLabel(interaction_area)
        interaction_area_separator_label.setPixmap(QPixmap(":/stylesheet/img/separator.png"))
        interaction_area_layout.addWidget(interaction_area_separator_label)

        self._import_resources_combobox: QComboBox = QComboBox(interaction_area)
        self._import_resources_combobox.setLineEdit(QLineEdit())
        self._import_resources_combobox.lineEdit().setPlaceholderText(
            notification_label_text.VIEW_EDIT_PAGE_IMPORT_RESOURCES_PLACEHOLDER_TEXT)
        self._import_resources_combobox.lineEdit().setReadOnly(True)
        self._import_resources_combobox.setMinimumSize(view_size_constants.IMPORT_RESOURCES_COMBOBOX_WIDTH,
                                                       view_size_constants.INTERACTION_COMPONENT_HEIGHT)
        self._import_resources_combobox.addItem(constants.SEARCH_TYPED_RESOURCES_VERSION)
        self._import_resources_combobox.addItem(constants.SEARCH_CFN_STACKS_VERSION)
        self._import_resources_combobox.setCurrentIndex(-1)
        interaction_area_layout.addWidget(self._import_resources_combobox)

        interaction_area_spacer: QSpacerItem = QSpacerItem(
            view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH, view_size_constants.INTERACTION_COMPONENT_HEIGHT,
            QSizePolicy.Expanding, QSizePolicy.Minimum)
        interaction_area_layout.addItem(interaction_area_spacer)

        self._search_filter_line_edit: SearchFilterLineEdit = \
            SearchFilterLineEdit(interaction_area, notification_label_text.VIEW_EDIT_PAGE_SEARCH_PLACEHOLDER_TEXT)
        self._search_filter_line_edit.setMinimumSize(view_size_constants.TABLE_VIEW_PAGE_SEARCH_FILTER_WIDGET_WIDTH,
                                                     view_size_constants.INTERACTION_COMPONENT_HEIGHT)
        interaction_area_layout.addWidget(self._search_filter_line_edit)
        table_view_vertical_layout.addWidget(interaction_area)

        self._table_view: ResourceTableView = ResourceTableView(self._table_view_page)
        self._table_view.setAlternatingRowColors(True)
        self._table_view.setMaximumSize(view_size_constants.TOOL_APPLICATION_MAIN_WINDOW_WIDTH,
                                        view_size_constants.TABLE_VIEW_PAGE_TABLE_VIEW_AREA_HEIGHT)
        self._table_view.setSelectionBehavior(QAbstractItemView.SelectRows)
        self._table_view.setSortingEnabled(True)
        self._table_view.verticalHeader().hide()

        horizontal_header: QHeaderView = self._table_view.horizontalHeader()
        horizontal_header.setSectionResizeMode(ResourceTableConstants.TABLE_STATE_COLUMN_INDEX,
                                               QHeaderView.Stretch)
        horizontal_header.setMaximumSectionSize(view_size_constants.RESOURCE_TABLE_HEADER_CELL_MAXIMUM)
        horizontal_header.setMinimumSectionSize(view_size_constants.RESOURCE_TABLE_HEADER_CELL_MINIMUM)
        horizontal_header.resizeSection(ResourceTableConstants.TABLE_KEYNAME_COLUMN_INDEX,
                                        view_size_constants.RESOURCE_TABLE_KEYNAME_COLUMN_WIDTH)
        horizontal_header.resizeSection(ResourceTableConstants.TABLE_TYPE_COLUMN_INDEX,
                                        view_size_constants.RESOURCE_TABLE_TYPE_COLUMN_WIDTH)
        horizontal_header.resizeSection(ResourceTableConstants.TABLE_NAME_OR_ID_COLUMN_INDEX,
                                        view_size_constants.RESOURCE_TABLE_NAME_OR_ID_COLUMN_WIDTH)
        horizontal_header.resizeSection(ResourceTableConstants.TABLE_ACCOUNTID_COLUMN_INDEX,
                                        view_size_constants.RESOURCE_TABLE_ACCOUNTID_COLUMN_WIDTH)
        horizontal_header.resizeSection(ResourceTableConstants.TABLE_REGION_COLUMN_INDEX,
                                        view_size_constants.RESOURCE_TABLE_REGION_COLUMN_WIDTH)

        table_view_vertical_layout.addWidget(self._table_view)