mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Update to add sort_by option
Added a class attribute "last_updated" for sort_by Added an instance attribute for search_sort Added if statement to add the sort_by string, currently by default.
This commit is contained in:
parent
56b8205ce0
commit
afc0f7c615
1 changed files with 4 additions and 0 deletions
|
@ -21,6 +21,7 @@ catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
class RemotePackageList(PackageList):
|
class RemotePackageList(PackageList):
|
||||||
ITEMS_PER_PAGE = 20 # Pagination of number of elements to download at once.
|
ITEMS_PER_PAGE = 20 # Pagination of number of elements to download at once.
|
||||||
|
LAST_UPDATED = "last_updated" # Default value to send for sort_by filter.
|
||||||
|
|
||||||
def __init__(self, parent: Optional["QObject"] = None) -> None:
|
def __init__(self, parent: Optional["QObject"] = None) -> None:
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
@ -28,6 +29,7 @@ class RemotePackageList(PackageList):
|
||||||
self._package_type_filter = ""
|
self._package_type_filter = ""
|
||||||
self._requested_search_string = ""
|
self._requested_search_string = ""
|
||||||
self._current_search_string = ""
|
self._current_search_string = ""
|
||||||
|
self._search_sort = "sort_by"
|
||||||
self._search_type = "search"
|
self._search_type = "search"
|
||||||
self._request_url = self._initialRequestUrl()
|
self._request_url = self._initialRequestUrl()
|
||||||
self._ongoing_requests["get_packages"] = None
|
self._ongoing_requests["get_packages"] = None
|
||||||
|
@ -102,6 +104,8 @@ class RemotePackageList(PackageList):
|
||||||
request_url += f"&package_type={self._package_type_filter}"
|
request_url += f"&package_type={self._package_type_filter}"
|
||||||
if self._current_search_string != "":
|
if self._current_search_string != "":
|
||||||
request_url += f"&{self._search_type}={self._current_search_string}"
|
request_url += f"&{self._search_type}={self._current_search_string}"
|
||||||
|
if self._search_sort != "":
|
||||||
|
request_url += f"&{self._search_sort}={self.LAST_UPDATED}"
|
||||||
return request_url
|
return request_url
|
||||||
|
|
||||||
def _parseResponse(self, reply: "QNetworkReply") -> None:
|
def _parseResponse(self, reply: "QNetworkReply") -> None:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue