Skip to content

Commit

Permalink
using limit property in fetching items
Browse files Browse the repository at this point in the history
  • Loading branch information
Samweli committed Dec 9, 2021
1 parent ff5d445 commit e763caf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 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 @@ -229,7 +229,7 @@ def params(self):
parameters = {
"ids": self.ids,
"collections": self.collections or None,
"max_items": self.page_size,
"limit": self.page_size,
"bbox": bbox,
"datetime": datetime_str,
}
Expand Down
6 changes: 4 additions & 2 deletions src/qgis_stac/gui/qgis_stac_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def __init__(

# initialize page
self.page = 1
self.total_pages = 0

self.current_collections = []
self.get_filters()
Expand Down Expand Up @@ -330,8 +331,8 @@ def update_search_inputs(self, enabled):
self.extent_box.setEnabled(enabled)
self.metadata_group.setEnabled(enabled)
self.search_btn.setEnabled(enabled)
self.prev_btn.setEnabled(enabled)
self.next_btn.setEnabled(enabled)
self.next_btn.setEnabled(self.page < self.total_pages)
self.prev_btn.setEnabled(self.page > 1)

def prepare_message_bar(self):
""" Initializes the widget message bar settings"""
Expand Down Expand Up @@ -391,6 +392,7 @@ def display_results(self, results, pagination):
pagination.total_items
)
)
self.total_pages = pagination.total_pages
self.next_btn.setEnabled(self.page < pagination.total_pages)
self.prev_btn.setEnabled(self.page > 1)

Expand Down
4 changes: 2 additions & 2 deletions src/qgis_stac/ui/qgis_stac_widget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Go to previous page&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Go back to previous page</string>
</property>
<property name="text">
<string>Previous</string>
Expand All @@ -634,7 +634,7 @@
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Go to next page&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>Go to next page</string>
</property>
<property name="text">
<string>Next</string>
Expand Down

0 comments on commit e763caf

Please sign in to comment.