mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-17 23:35:53 +08:00
Merge pull request #10685 from Ultimaker/CURA-8556_marketplace_new_design
Clear contents of net marketplace if window is closed
This commit is contained in:
commit
27fb95aa85
@ -33,6 +33,7 @@ class PackageList(ListModel):
|
|||||||
PackageRole = Qt.UserRole + 1
|
PackageRole = Qt.UserRole + 1
|
||||||
|
|
||||||
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.
|
||||||
|
INCLUDED_PACKAGE_TYPE = ("material", "plugin") # Only show these kind of packages
|
||||||
|
|
||||||
def __init__(self, parent: "QObject" = None) -> None:
|
def __init__(self, parent: "QObject" = None) -> None:
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@ -121,8 +122,9 @@ class PackageList(ListModel):
|
|||||||
return
|
return
|
||||||
|
|
||||||
for package_data in response_data["data"]:
|
for package_data in response_data["data"]:
|
||||||
package = PackageModel(package_data, parent = self)
|
if package_data["package_type"] in self.INCLUDED_PACKAGE_TYPE:
|
||||||
self.appendItem({"package": package}) # Add it to this list model.
|
package = PackageModel(package_data, parent = self)
|
||||||
|
self.appendItem({"package": package}) # Add it to this list model.
|
||||||
|
|
||||||
self._request_url = response_data["links"].get("next", "") # Use empty string to signify that there is no next page.
|
self._request_url = response_data["links"].get("next", "") # Use empty string to signify that there is no next page.
|
||||||
self.hasMoreChanged.emit()
|
self.hasMoreChanged.emit()
|
||||||
|
@ -7,6 +7,7 @@ import QtQuick.Layouts 1.15
|
|||||||
import QtQuick.Window 2.2
|
import QtQuick.Window 2.2
|
||||||
|
|
||||||
import UM 1.2 as UM
|
import UM 1.2 as UM
|
||||||
|
import Cura 1.6 as Cura
|
||||||
|
|
||||||
Window
|
Window
|
||||||
{
|
{
|
||||||
@ -18,6 +19,18 @@ Window
|
|||||||
width: minimumWidth
|
width: minimumWidth
|
||||||
height: minimumHeight
|
height: minimumHeight
|
||||||
|
|
||||||
|
// Set and unset the content. No need to keep things in memory if it's not visible.
|
||||||
|
onVisibleChanged: content.source = visible ? "Plugins.qml" : ""
|
||||||
|
|
||||||
|
Connections
|
||||||
|
{
|
||||||
|
target: Cura.API.account
|
||||||
|
function onLoginStateChanged()
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
title: "Marketplace" //Seen by Ultimaker as a brand name, so this doesn't get translated.
|
title: "Marketplace" //Seen by Ultimaker as a brand name, so this doesn't get translated.
|
||||||
modality: Qt.NonModal
|
modality: Qt.NonModal
|
||||||
|
|
||||||
@ -61,9 +74,9 @@ Window
|
|||||||
|
|
||||||
Loader //Page contents.
|
Loader //Page contents.
|
||||||
{
|
{
|
||||||
|
id: content
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
source: "Plugins.qml"
|
source: "Plugins.qml"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import UM 1.4 as UM
|
|||||||
ScrollView
|
ScrollView
|
||||||
{
|
{
|
||||||
clip: true
|
clip: true
|
||||||
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
|
|
||||||
ListView
|
ListView
|
||||||
{
|
{
|
||||||
@ -170,4 +171,4 @@ ScrollView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user