Model component widget
Composite list view-based widgets for displaying activity and NCS pathway items.
ActivityComponentWidget
Bases: ModelComponentWidget
Widget for displaying and managing activities.
Source code in src/cplus_plugin/gui/model_component_widget.py
activities
Returns a collection of activity objects in the list view.
Returns:
Type | Description |
---|---|
list
|
Collection of activity objects in the list view. |
Source code in src/cplus_plugin/gui/model_component_widget.py
add_activity
Adds an activity object to the view with the option of specifying the layer.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
activity |
Activity
|
activity object to be added to the view. |
required |
layer |
QgsMapLayer
|
Optional map layer to be added to the activity. |
None
|
Returns:
Type | Description |
---|---|
bool
|
True if the activity was successfully added, else False. |
Source code in src/cplus_plugin/gui/model_component_widget.py
add_auxiliary_widgets
Adds additional action widgets for managing activities.
Source code in src/cplus_plugin/gui/model_component_widget.py
add_ncs_pathway_items
Adds an NCS pathway item to the collection.
One, and only one, target activity item needs to have been selected.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ncs_items |
List[NcsPathwayItem]
|
NCS pathway items to be added to the activity. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the item was successfully added, else False. |
Source code in src/cplus_plugin/gui/model_component_widget.py
clear
load
model_items
Returns a collection of all ActivityItem objects in the list view.
Returns:
Type | Description |
---|---|
list
|
Collection of ActivityItem objects in the list view. |
Source code in src/cplus_plugin/gui/model_component_widget.py
model_names
Gets the names of the activities in the item model.
Returns:
Type | Description |
---|---|
list
|
Returns the names of activities in lower case or an empty list if the item model has not been set. |
Source code in src/cplus_plugin/gui/model_component_widget.py
on_pathways_updated
Slot raised when the pathways of an ActivityItem have been added or removed. Persist this information in settings.
on_show_pixel_value_editor
Slot raised to show editor dialog for managing activity pixel values for styling.
Source code in src/cplus_plugin/gui/model_component_widget.py
reassign_pixel_values
Reassign the styling pixel values for activities from the given start position.
It is important to call this function when the maximum pixel value does not match the number of activities such as when one or more activities have been deleted.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_position |
int
|
Position to start reassigning the pixel values. |
required |
Source code in src/cplus_plugin/gui/model_component_widget.py
remove_ncs_pathway_items
Delete NCS pathway items used for activities that are linked to the given NCS pathway.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ncs_pathway_uuid |
str
|
NCS pathway whose corresponding items will be deleted in the activity items that contain it. |
required |
Source code in src/cplus_plugin/gui/model_component_widget.py
update_ncs_pathway_items
Update NCS pathway items used for activities that are linked to the given NCS pathway.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ncs_pathway |
NcsPathway
|
NCS pathway whose attribute values will be updated for the related pathways used in the activities. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if NCS pathway items were updated, else False. |
Source code in src/cplus_plugin/gui/model_component_widget.py
ModelComponentWidget
Bases: QWidget
, WidgetUi
Widget for displaying and managing model items in a list view.
Source code in src/cplus_plugin/gui/model_component_widget.py
item_model
property
writable
Returns the component item model for managing items the list view.
Returns:
Type | Description |
---|---|
ComponentItemModel
|
Component item model for managing items the list view. |
selection_model
property
Gets the item's view selection model.
Returns:
Type | Description |
---|---|
QtCore.QItemSelectionModel
|
The item's view selection model. |
title
property
writable
Returns the title of the view.
Returns:
Type | Description |
---|---|
str
|
Title of the view. |
add_action_widget
Adds an auxiliary widget below the list view from the left-hand side.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
widget |
QWidget
|
Widget to be added to the collection of controls below the list view. |
required |
Source code in src/cplus_plugin/gui/model_component_widget.py
clear
clear_description
enable_default_items
Enable or disable default model component items in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state |
bool
|
True to enable or False to disable default model component items. |
required |
Source code in src/cplus_plugin/gui/model_component_widget.py
load
model_names
Gets the names of the components in the item model.
Returns:
Type | Description |
---|---|
list
|
Returns the model names in lower case or an empty list if the item model has not been set. |
Source code in src/cplus_plugin/gui/model_component_widget.py
selected_items
Returns the selected items in the list view.
Returns:
Type | Description |
---|---|
list
|
A collection of the selected model component items. Returns an empty list if the item model has not been set. |
Source code in src/cplus_plugin/gui/model_component_widget.py
set_description
Updates the text for the selected item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
description |
str
|
Description for the selected item. |
required |
Source code in src/cplus_plugin/gui/model_component_widget.py
NcsComponentWidget
Bases: ModelComponentWidget
Widget for displaying and managing NCS pathways.
Source code in src/cplus_plugin/gui/model_component_widget.py
add_auxiliary_widgets
Adds additional action widgets for managing NCS pathways.
Source code in src/cplus_plugin/gui/model_component_widget.py
add_ncs_pathway
Adds an NCS pathway object to the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ncs_pathway |
NcsPathway
|
NCS pathway object to be added to the view. |
required |
Returns:
Type | Description |
---|---|
bool
|
Returns True if the NcsPathway was successfully added, else False. |
Source code in src/cplus_plugin/gui/model_component_widget.py
clear
is_valid
Returns whether the NCS pathways are valid based on the validation against a given set of rules defined for an NCSValidator.
The validation process is automatically triggered through the validation manager object.
Returns:
Type | Description |
---|---|
bool
|
True if the NCS pathways are valid, else False. If the validation result has warnings and no errors, the overall results will be True. However, if there are errors, it will return False. |
Source code in src/cplus_plugin/gui/model_component_widget.py
load
Load items from settings.
Source code in src/cplus_plugin/gui/model_component_widget.py
ncs_items
Returns a collection of all NcsPathwayItem objects in the list view.
Returns:
Type | Description |
---|---|
list
|
Collection of NcsPathwayItem objects in the list view. |
Source code in src/cplus_plugin/gui/model_component_widget.py
on_delete_triggered
Slot raised to select the default delete action.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action |
QAction
|
Action that has been triggered. |
required |
Source code in src/cplus_plugin/gui/model_component_widget.py
on_item_changed
Slot raised when the data of an NCS pathway item changes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
item |
NcsPathwayItem
|
NCS pathway item whose data has changed. |
required |
Source code in src/cplus_plugin/gui/model_component_widget.py
on_load_validation_inspector
Slot raised to show the validation inspector dialog.
If the validation process is not yet completed, a progress dialog will be shown.
Source code in src/cplus_plugin/gui/model_component_widget.py
pathways
Returns a collection of NcsPathway objects in the list view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
valid_only |
bool
|
True to only return those NcsPathway objects that are valid, default is False. |
False
|
Returns:
Type | Description |
---|---|
list
|
Collection of NcsPathway objects in the list view. |
Source code in src/cplus_plugin/gui/model_component_widget.py
validate_pathways
Validates NCS pathway model components against a given set of rules using the ValidationManager.