Integrating up through commit 90f050496

This commit is contained in:
alexpete
2021-04-07 14:03:29 -07:00
parent 8f2ed080a9
commit c2cbd430fe
2694 changed files with 285622 additions and 176874 deletions
@@ -9,7 +9,31 @@ remove or modify any license notices. This file is distributed on an "AS IS" BAS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
"""
NOTIFICATION_LOADING_MESSAGE: str = "Loading..."
VIEW_EDIT_PAGE_CONFIG_FILE_TEXT: str = "Config File"
VIEW_EDIT_PAGE_CONFIG_LOCATION_TEXT: str = "Config Location:"
VIEW_EDIT_PAGE_ADD_ROW_TEXT: str = "Add Row"
VIEW_EDIT_PAGE_DELETE_ROW_TEXT: str = "Delete Row"
VIEW_EDIT_PAGE_SAVE_CHANGES_TEXT: str = "Save Changes"
VIEW_EDIT_PAGE_CANCEL_TEXT: str = "Cancel"
VIEW_EDIT_PAGE_CREATE_NEW_TEXT: str = "Create New"
VIEW_EDIT_PAGE_RESCAN_TEXT: str = "Rescan"
VIEW_EDIT_PAGE_CONFIG_FILES_PLACEHOLDER_TEXT: str = "Found {} config files"
VIEW_EDIT_PAGE_SEARCH_PLACEHOLDER_TEXT: str = "Search by Key Name, Type, Name/ID, Account ID or Region"
VIEW_EDIT_PAGE_IMPORT_RESOURCES_PLACEHOLDER_TEXT: str = "Import Additional Resources"
VIEW_EDIT_PAGE_SELECT_CONFIG_FILE_MESSAGE: str = "Please select the Config file you would like to view and modify..."
VIEW_EDIT_PAGE_NO_CONFIG_FILE_FOUND_MESSAGE: str = \
"<p><b>Unable to locate a resource mapping config file.</b></p>"\
"<p>We can either make this file for you or you can rescan your directory.</p>"
VIEW_EDIT_PAGE_SAVING_SUCCEED_MESSAGE: str = "Config file {} is saved successfully."
IMPORT_RESOURCES_PAGE_BACK_TEXT: str = "Back"
IMPORT_RESOURCES_PAGE_AWS_SEARCH_TYPE_TEXT: str = "AWS Resource Type"
IMPORT_RESOURCES_PAGE_SEARCH_TEXT: str = " Search"
IMPORT_RESOURCES_PAGE_IMPORT_TEXT: str = "Import"
IMPORT_RESOURCES_PAGE_SEARCH_PLACEHOLDER_TEXT: str = "Search for resources by Type or Name/ID"
IMPORT_RESOURCES_PAGE_AWS_SEARCH_TYPE_PLACEHOLDER_TEXT: str = "Please select"
@@ -20,7 +20,7 @@ from model.resource_mapping_attributes import (ResourceMappingAttributes, Resour
logger = logging.getLogger(__name__)
_TABLE_HORIZONTAL_HEADER_NAMES: List[str] =\
["Key Name*", "Type*", "Name/ID*", "Account ID", "Region", "Status"]
["Key Name", "Type", "Name/ID", "Account ID", "Region", "Status"]
class ResourceTableConstants(object):
@@ -70,16 +70,6 @@ class ResourceTableModel(ResourceAbstractModel, QAbstractTableModel, metaclass=R
return resource.status.value
return ""
def _get_resource_attribute_tooltip(self, row: int, column: int) -> str:
if 0 <= row < len(self._resources):
resource: ResourceMappingAttributes = self._resources[row]
attribute: str = self._get_resource_str_type_attribute(resource, column)
if attribute:
return attribute
elif column == ResourceTableConstants.TABLE_STATE_COLUMN_INDEX:
return resource.status.descriptions_in_tooltip()
return ""
def _set_resource_attribute(self, row: int, column: int, value: str) -> None:
if 0 <= row < len(self._resources):
resource: ResourceMappingAttributes = self._resources[row]
@@ -113,11 +103,17 @@ class ResourceTableModel(ResourceAbstractModel, QAbstractTableModel, metaclass=R
"""QAbstractTableModel override"""
row: int = index.row()
column: int = index.column()
if role == Qt.DisplayRole or role == Qt.EditRole:
return self._get_resource_attribute(row, column)
if role == Qt.ToolTipRole:
return self._get_resource_attribute_tooltip(row, column)
if 0 <= row < len(self._resources):
resource: ResourceMappingAttributes = self._resources[row]
attribute: str = self._get_resource_str_type_attribute(resource, column)
if attribute:
if role == Qt.DisplayRole or role == Qt.EditRole or role == Qt.ToolTipRole:
return attribute
elif column == ResourceTableConstants.TABLE_STATE_COLUMN_INDEX:
if role == Qt.ToolTipRole:
return resource.status.descriptions_in_tooltip()
if role == Qt.DisplayRole:
return resource.status.value
def headerData(self, section: int, orientation: int, role: int = Qt.DisplayRole) -> object:
"""QAbstractTableModel override"""
@@ -13,54 +13,33 @@ TOOL_APPLICATION_MAIN_WINDOW_WIDTH: int = 920
TOOL_APPLICATION_MAIN_WINDOW_HEIGHT: int = 600
MAIN_PAGE_LAYOUT_MARGIN_LEFTRIGHT: int = 10
MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM: int = 20
MAIN_PAGE_LAYOUT_MARGIN_TOPBOTTOM: int = 15
INTERACTION_COMPONENT_HEIGHT: int = 25
ICON_FRONT_SIZE: int = 12
"""view edit page related constants"""
VIEW_EDIT_PAGE_HEADER_FOOTER_AREA_HEIGHT: int = 75
VIEW_EDIT_PAGE_CENTER_AREA_HEIGHT: int = 450
VIEW_EDIT_PAGE_HEADER_AREA_HEIGHT: int = 65
VIEW_EDIT_PAGE_CENTER_AREA_HEIGHT: int = 500
VIEW_EDIT_PAGE_FOOTER_AREA_HEIGHT: int = 50
VIEW_EDIT_PAGE_WIDGET_SUBCOMPONENT_Y: int = 25
VIEW_EDIT_PAGE_MARGIN_TOPBOTTOM: int = 10
# header area
CONFIG_FILE_LABEL_X: int = 25
CONFIG_FILE_LABEL_WIDTH: int = 60
CONFIG_FILE_COMBOBOX_X: int = 95
CONFIG_FILE_COMBOBOX_WIDTH: int = 200
CONFIG_LOCATION_LABEL_X: int = 620
CONFIG_LOCATION_LABEL_WIDTH: int = 80
CONFIG_LOCATION_TEXT_X: int = 705
CONFIG_LOCATION_TEXT_WIDTH: int = 150
CONFIG_LOCATION_BUTTON_X: int = 860
CONFIG_FILE_LABEL_WIDTH: int = 70
CONFIG_FILE_COMBOBOX_WIDTH: int = 250
CONFIG_LOCATION_LABEL_WIDTH: int = 110
CONFIG_LOCATION_TEXT_WIDTH: int = 190
HEADER_AREA_SEPARATOR_WIDTH: int = 5
# center area
NOTIFICATION_PAGE_PROMPT_HEIGHT: int = 100
NOTIFICATION_PAGE_PROMPT_BUTTON_WIDTH: int = 75
TABLE_VIEW_PAGE_INTERACTION_AREA_HEIGHT: int = 40
ADD_ROW_BUTTON_X: int = 10
ADD_ROW_BUTTON_WIDTH: int = 75
ADD_ROW_BUTTON_WIDTH: int = 90
DELETE_ROW_BUTTON_WIDTH: int = 90
IMPORT_RESOURCES_COMBOBOX_WIDTH: int = 180
TABLE_VIEW_PAGE_SEARCH_FILTER_WIDGET_WIDTH: int = 370
DELETE_ROW_BUTTON_X: int = 90
DELETE_ROW_BUTTON_WIDTH: int = 75
IMPORT_RESOURCES_LABEL_X: int = 185
IMPORT_RESOURCES_LABEL_WIDTH: int = 40
IMPORT_RESOURCES_COMBOBOX_X: int = 225
IMPORT_RESOURCES_COMBOBOX_WIDTH: int = 150
TABLE_VIEW_PAGE_SEARCH_FILTER_WIDGET_X: int = 565
TABLE_VIEW_PAGE_SEARCH_FILTER_WIDGET_WIDTH: int = 300
TABLE_VIEW_PAGE_TABLE_VIEW_AREA_HEIGHT: int = 400
TABLE_VIEW_PAGE_TABLE_VIEW_AREA_HEIGHT: int = 450
RESOURCE_TABLE_HEADER_CELL_MAXIMUM: int = 450
RESOURCE_TABLE_HEADER_CELL_MINIMUM: int = 40
@@ -72,43 +51,31 @@ RESOURCE_TABLE_ACCOUNTID_COLUMN_WIDTH: int = 100
RESOURCE_TABLE_REGION_COLUMN_WIDTH: int = 100
# footer area
SAVE_CHANGES_BUTTON_X: int = 710
SAVE_CHANGES_BUTTON_WIDTH: int = 85
CANCEL_BUTTON_X: int = 800
CANCEL_BUTTON_WIDTH: int = 75
SAVE_CHANGES_BUTTON_WIDTH: int = 90
CREATE_NEW_BUTTON_WIDTH: int = 90
RESCAN_BUTTON_WIDTH: int = 90
CANCEL_BUTTON_WIDTH: int = 90
"""import resources page related constants"""
IMPORT_RESOURCES_PAGE_HEADER_AREA_HEIGHT: int = 55
IMPORT_RESOURCES_PAGE_SEARCH_AREA_HEIGHT: int = 55
IMPORT_RESOURCES_PAGE_VIEW_AREA_HEIGHT: int = 450
IMPORT_RESOURCES_PAGE_HEADER_AREA_HEIGHT: int = 65
IMPORT_RESOURCES_PAGE_SEARCH_AREA_HEIGHT: int = 50
IMPORT_RESOURCES_PAGE_VIEW_AREA_HEIGHT: int = 500
IMPORT_RESOURCES_PAGE_FOOTER_AREA_HEIGHT: int = 50
IMPORT_RESOURCES_PAGE_WIDGET_SUBCOMPONENT_Y: int = 15
IMPORT_RESOURCES_PAGE_MARGIN_TOPBOTTOM: int = 10
# back area
BACK_BUTTON_WIDTH: int = 100
TYPED_RESOURCES_LABEL_X: int = 10
TYPED_RESOURCES_LABEL_WIDTH: int = 100
TYPED_RESOURCES_COMBOBOX_X: int = 115
# search area
TYPED_RESOURCES_LABEL_WIDTH: int = 125
TYPED_RESOURCES_COMBOBOX_WIDTH: int = 150
SEARCH_BUTTON_WIDTH: int = 80
IMPORT_BUTTON_WIDTH: int = 80
TYPED_RESOURCES_SEARCH_BUTTON_X: int = 310
TYPED_RESOURCES_IMPORT_BUTTON_X: int = 395
CFN_STACKS_SEARCH_BUTTON_X: int = 10
CFN_STACKS_IMPORT_BUTTON_X: int = 95
IMPORT_RESOURCES_PAGE_SEARCH_FILTER_WIDGET_X: int = 565
SEARCH_BUTTON_WIDTH: int = 90
IMPORT_BUTTON_WIDTH: int = 90
IMPORT_RESOURCES_PAGE_SEARCH_FILTER_WIDGET_WIDTH: int = 300
IMPORT_RESOURCES_PAGE_TREE_VIEW_X: int = 50
IMPORT_RESOURCES_PAGE_TREE_VIEW_WIDTH: int = 800
IMPORT_RESOURCES_PAGE_TREE_VIEW_HEIGHT: int = 400
# tree view area
IMPORT_RESOURCES_PAGE_TREE_VIEW_HEIGHT: int = 450
RESOURCE_STACK_HEADER_CELL_MAXIMUM: int = 400
RESOURCE_STACK_HEADER_CELL_MINIMUM: int = 200
RESOURCE_STACK_HEADER_CELL_MAXIMUM: int = 500
RESOURCE_STACK_HEADER_CELL_MINIMUM: int = 300