Skip to content

Commit

Permalink
Merge pull request #203 from Samweli/variable_change
Browse files Browse the repository at this point in the history
Minor updates
  • Loading branch information
Samweli authored Jul 15, 2022
2 parents 55f6f5c + e3f0c74 commit 23ed543
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/qgis_stac/api/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class FilterLang(enum.Enum):
STAC API item search
"""
CQL_TEXT = 'CQL_TEXT'
CQL2_TEXT = 'CQL_TEXT'
CQL2_TEXT = 'CQL2_TEXT'
CQL_JSON = 'CQL_JSON'
CQL2_JSON = 'CQL2_JSON'
STAC_QUERY = 'STAC_QUERY'
Expand Down
13 changes: 10 additions & 3 deletions src/qgis_stac/gui/qgis_stac_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def __init__(
self.all_footprints_btn.clicked.connect(
self.all_footprints_btn_clicked
)
self.all_footprints_btn.setEnabled(
len(self.result_items) > 0
)

self.search_btn.clicked.connect(
self.search_items_api
Expand Down Expand Up @@ -733,13 +736,13 @@ def display_results(self, results, pagination=None):
)
self.item_model = ItemsModel(results)
self.items_proxy_model.setSourceModel(self.item_model)
self.result_items = results
settings_manager.delete_all_items(
settings_manager.get_current_connection(),
self.page
)
self.populate_results(results)
else:

self.clear_search_results()
if self.page > 1:
self.page -= 1
Expand All @@ -763,6 +766,9 @@ def display_results(self, results, pagination=None):
self.footprint_btn.setEnabled(
False
)
self.all_footprints_btn.setEnabled(
len(self.result_items) > 0
)
self.footprint_items = {}
self.container.setCurrentIndex(1)

Expand Down Expand Up @@ -797,7 +803,7 @@ def populate_results(self, results):
:type results: list
"""

self.items_results = results
self.result_items = results
scroll_container = QtWidgets.QWidget()
layout = QtWidgets.QVBoxLayout()
layout.setContentsMargins(1, 1, 1, 1)
Expand Down Expand Up @@ -881,7 +887,7 @@ def footprint_btn_clicked(self):

def all_footprints_btn_clicked(self):
""" Adds all footprints for the current page items as map layers."""
for item in self.items_results:
for item in self.result_items:
try:
footprint_task = QgsTask.fromFunction(
'Add footprint',
Expand All @@ -898,6 +904,7 @@ def clear_search_results(self):
""" Clear current search results from the UI"""
self.scroll_area.setWidget(QtWidgets.QWidget())
self.result_items_la.clear()
self.result_items = []

def filter_changed(self, filter_text):
"""
Expand Down

0 comments on commit 23ed543

Please sign in to comment.