GUI main¶
The plugin main window class.
QgisCplusMain ¶
Bases: QDockWidget
, WidgetUi
Main plugin UI class
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
add_priority_group ¶
Adds a new priority group into the plugin, then updates the priority list to show the new added priority group.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
add_priority_layer ¶
Adds a new priority layer into the plugin, then updates the priority list to show the new added priority layer.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
add_priority_layer_group ¶
Adds priority layer from the weighting layers into a priority group If no target_group or priority_layer is passed then the current selected group or priority layer from their respective list will be used.
Checks if priority layer is already in the target group and if so no addition is done.
Once the addition is done, the respective priority layer plugin settings are updated to store the new information.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_group |
dict
|
Priority group where layer will be added to |
None
|
priority_layer |
dict
|
Priority weighting layer to be added |
None
|
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 |
|
add_scenario ¶
Adds a new scenario into the scenario list.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
analysis_complete ¶
Calls the responsible function for handling analysis results outputs
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task |
ScenarioAnalysisTask
|
Analysis task |
required |
report_manager |
ReportManager
|
Report manager used to generate analysis report_templates |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
cancel_processing_task ¶
Cancels the current processing task.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
edit_priority_group ¶
Edits the current selected priority group and updates the group box list.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
edit_priority_layer ¶
Edits the current selected priority layer and updates the layer box list.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
enable_analysis_controls ¶
Enable or disable controls related to running the scenario analysis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
enable |
bool
|
True to enable else False to disable. |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
fetch_default_layer_list ¶
Fetch default layer list from API.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
fetch_scenario_history_list ¶
Fetch scenario history list from API.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
group_value_changed ¶
Slot to handle priority group widget changes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
group_name |
str
|
Group name |
required |
group_value |
int
|
Group value |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
has_trends_auth ¶
Check if plugin has user Trends.Earth authentication.
Returns:
Type | Description |
---|---|
bool
|
True if user has provided the username and password. |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
initialize_priority_layers ¶
Prepares the priority weighted layers UI with the defaults.
Gets the store priority layers from plugin settings and populates them into the QListWidget as QListWidgetItems then fetches the priority groups and adds them to the QTreeWidget as QTreeWidgetItems with their corresponding priority layers as their child items.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
is_metric_configuration_valid ¶
Checks if the setup of the metric configuration for the scenario analysis report is correct.
Returns:
Type | Description |
---|---|
bool
|
True if the configuration is correct else False. |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
load_layer_options ¶
Retrieve outputs scenarion layers selection from settings and update the releated ui components
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
load_report_options ¶
Load previously saved report options.
load_scenario ¶
Edits the current selected scenario and updates the layer box list.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 |
|
main_task ¶
Serves as a QgsTask function for the main task that contains smaller sub-tasks running the actual processing calculations.
move_layer_to_group ¶
Moves a layer open in QGIS to another group.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer |
QgsRasterLayer
|
Raster layer to move |
required |
group |
QgsLayerTreeGroup
|
Group to which the raster should be moved |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_fetch_scenario_history_list_finished ¶
Callback when plugin has finished pulling scenario history list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
success |
bool
|
True if API call is successful |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_generate_comparison_report ¶
Slot raised to generate a comparison for two or more selected scenario results.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 |
|
on_log_message_received ¶
Slot to handle log tab updates and processing logs
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
The received message from QGIS message log |
required |
tag |
str
|
Message log tag |
required |
level |
Qgis.MessageLevel
|
Message level enum value |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_manage_npv_pwls ¶
Slot raised to show the dialog for managing NPV PWLs.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_npv_pwl_created ¶
Callback that creates an PWL item when the corresponding raster layer has been created.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pathway_npv |
NcsPathwayNpv
|
NPV mapping for an NCS pathway. |
required |
npv_pwl_path |
str
|
Absolute file path of the created NPV PWL. |
required |
algorithm |
QgsProcessingAlgorithm
|
Processing algorithm that created the NPV PWL. |
required |
context |
QgsProcessingContext
|
Contextual information that was used to create the NPV PWL in processing. |
required |
feedback |
QgsProcessingFeedback
|
Feedback to update on the processing progress. |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_npv_pwl_removed ¶
Callback that is executed when an NPV PWL has been removed because it was disabled by the user.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_online_task_check_finished ¶
Handler for view online task and generate report button.
The button itself will be shown when Cplus plugin becomes visible.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_profile_action_group_triggered ¶
Slot raised when the action group for profiles has been triggered.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
action |
QAction
|
Action in the group that has been triggered. |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_progress_dialog_cancelled ¶
Slot raised when analysis has been cancelled in progress dialog.
on_report_error ¶
Slot raised when report task error has occured.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
progress_dialog |
ProgressDialog
|
Dialog responsible for showing all the analysis operations progress. |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_report_finished ¶
Slot raised when report task has finished.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
progress_dialog |
ProgressDialog
|
Dialog responsible for showing all the analysis operations progress. |
required |
scenario_id |
str
|
Scenario analysis id |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_report_running ¶
Slot raised when report task has started.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
progress_dialog |
ProgressDialog
|
Dialog responsible for showing all the analysis operations progress. |
required |
scenario_id |
str
|
Scenario analysis id |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_report_status_changed ¶
Slot raised when report task status has changed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
progress_dialog |
ProgressDialog
|
Dialog responsible for showing all the analysis operations progress. |
required |
message |
str
|
Status message. |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_reporting_progress_changed ¶
Slot raised when the reporting progress has changed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
progress_dialog |
ProgressDialog
|
Dialog responsible for showing all the analysis operations progress. |
required |
progress |
float
|
Analysis progress value between 0 and 100 |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_scenario_list_selection_changed ¶
Slot raised when the selection of scenarios changes.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_show_metrics_wizard ¶
Slot raised to show the metric customization wizard for creating the scenario analysis report.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_tab_step_changed ¶
Slot raised when the current tab changes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
index |
int
|
Zero-based index position of new current tab |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 |
|
on_use_custom_metrics ¶
Slot raised when use custom metrics has been enabled or disabled.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
checked |
bool
|
True to use custom metrics else False. |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
on_view_status_button_clicked ¶
Handler when view status report button in tab 4 is clicked.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
open_help ¶
open_settings ¶
outputs_options_changed ¶
Handles selected outputs changes
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
post_analysis ¶
Handles analysis outputs from the final analysis results. Adds the resulting scenario raster to the canvas with styling. Adds each of the activities to the canvas with styling. Adds each activities' pathways to the canvas.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_result |
ScenarioResult
|
ScenarioResult of output results |
required |
task |
ScenarioAnalysisTask
|
Analysis task |
required |
report_manager |
ReportManager
|
Report manager used to generate analysis report_templates |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 |
|
prepare_extent_box ¶
Configure the spatial extent box with the initial settings.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
prepare_input ¶
Initializes plugin input widgets
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
|
prepare_message_bar ¶
Initializes the widget message bar settings
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
priority_groups_update ¶
Updates the priority groups list item with the passed selected layer items.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_item |
QTreeWidgetItem
|
The priority group tree widget item that is to be updated |
required |
selected_items |
list
|
Priority layers items from the list widget |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
processing_options_changed ¶
remove_priority_group ¶
Removes the current active priority group.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
remove_priority_layer ¶
Removes one or more of the selected priority layers.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
remove_priority_layer_group ¶
Remove the current select priority layer from the current priority group.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
remove_scenario ¶
Removes the current active scenario.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
report_job_is_for_current_scenario ¶
Checks if the given scenario identifier is for the current scenario result.
This is to ensure that signals raised by the report manager refer to the current scenario result object and not for old jobs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scenario_id |
str
|
Scenario identifier usually from a signal raised by the report manager. |
required |
Returns:
Type | Description |
---|---|
bool
|
True if the scenario identifier matches the current scenario object in the results, else False. |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
reset_reporting_feedback ¶
Creates a new reporting feedback object and reconnects the signals.
We are doing this to address cases where the feedback is canceled and the same object has to be reused for subsequent report generation tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
progress_dialog |
ProgressDialog
|
Dialog responsible for showing all the analysis operations progress. |
required |
Returns:
Type | Description |
---|---|
QgsFeedback
|
Feedback instance to be used in storing processing status details. |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
restore_scenario ¶
Update the first tab input with the last scenario details
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
run_analysis ¶
Runs the plugin analysis Creates new QgsTask, progress dialog and report manager for each new scenario analysis.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 |
|
run_report ¶
Run report generation. This should be called after the analysis is complete.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
progress_dialog |
ProgressDialog
|
Dialog responsible for showing all the analysis operations progress. |
required |
report_manager |
ReportManager
|
Report manager used to generate analysis report_templates |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
save_scenario ¶
Save current scenario details into settings
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
scenario_results ¶
Called when the task ends. Sets the progress bar to 100 if it finished.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task |
ScenarioAnalysisTask
|
Analysis task |
required |
report_manager |
ReportManager
|
Report manager used to generate analysis report_templates |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
selected_activities ¶
Gets the collection of selected activities.
Returns:
Type | Description |
---|---|
typing.List[Activity]
|
A list of selected activities. |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
show_message ¶
Shows message on the main widget message bar.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Text message |
required |
level |
Qgis.MessageLevel
|
Message level type |
Warning
|
duration |
int
|
Duration of the shown message |
0
|
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
show_scenario_info ¶
Loads dialog for showing scenario information.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
style_activities_layer ¶
Applies the styling to the passed layer that contains the passed list of activities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer |
QgsRasterLayer
|
Layer to be styled |
required |
activities |
list
|
List which contains the activities that were passed to the highest position analysis tool. |
required |
Returns:
Type | Description |
---|---|
QgsPalettedRasterRenderer
|
Renderer for the symbology. |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
style_activity_layer ¶
Applies the styling to the layer that contains the passed activity name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
layer |
QgsRasterLayer
|
Raster layer to which to apply the symbology |
required |
activity |
Activity
|
activity |
required |
Returns:
Type | Description |
---|---|
QgsSingleBandPseudoColorRenderer
|
Renderer for the symbology. |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
task_terminated ¶
Handles logging of the scenario analysis task status after it has been terminated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task |
Union[ScenarioAnalysisTask, ScenarioAnalysisTaskApiClient]
|
Task that was terminated |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
transform_extent ¶
Transforms the passed extent into the destination crs
:param extent: Target extent
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_crs |
QgsCoordinateReferenceSystem
|
Source CRS of the passed extent |
required |
dest_crs |
QgsCoordinateReferenceSystem
|
Destination CRS |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
update_message_bar ¶
Changes the message in the message bar item.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str
|
Message to be updated |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
update_metric_button_profiles ¶
Updates the profiles in the metric button menu based on the existing metric configuration profiles.
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
update_priority_layers ¶
Updates the priority weighting layers list in the UI.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
update_groups |
bool
|
Whether to update the priority groups list or not |
True
|
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
update_progress_bar ¶
Sets the value of the progress bar
Parameters:
Name | Type | Description | Default |
---|---|---|---|
progress_dialog |
ProgressDialog
|
Dialog responsible for showing all the analysis operations progress. |
required |
value |
float
|
Value to be set on the progress bar |
required |
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
update_progress_dialog ¶
Run report generation. This should be called after the analysis is complete.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
progress_dialog |
ProgressDialog
|
Dialog responsible for showing all the analysis operations progress. |
required |
message |
ReportManager
|
Report manager used to generate analysis report_templates |
None
|
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
update_pwl_layers ¶
Updates the priority layers path available in the store activities.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
notify |
bool
|
Whether to show message to user about the update |
False
|
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
update_scenario_list ¶
Fetches scenarios from plugin settings and updates the scenario history list
Source code in src/cplus_plugin/gui/qgis_cplus_main.py
zoom_pilot_area ¶
Zoom the current main map canvas to the pilot area extent.