mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 00:25:56 +08:00
Reset the model when pressing the Add cloud printer button
CURA-7022
This commit is contained in:
parent
1d4225a44a
commit
6583f5f5ac
@ -27,7 +27,7 @@ class DiscoveredUltimakerCloudPrintersModel(ListModel):
|
||||
self._discovered_ultimaker_cloud_printers_list = []
|
||||
self._application = application
|
||||
|
||||
def addDiscoveredUltimakerCloudPrinter(self, new_devices) -> None:
|
||||
def addDiscoveredUltimakerCloudPrinters(self, new_devices) -> None:
|
||||
for device in new_devices:
|
||||
self._discovered_ultimaker_cloud_printers_list.append({
|
||||
"ip_address": device.key,
|
||||
@ -39,7 +39,7 @@ class DiscoveredUltimakerCloudPrintersModel(ListModel):
|
||||
self._update()
|
||||
|
||||
@pyqtSlot()
|
||||
def clearDiscoveredUltimakerCloudPrinters(self):
|
||||
def clear(self):
|
||||
self._discovered_ultimaker_cloud_printers_list = []
|
||||
self._update()
|
||||
|
||||
|
@ -146,7 +146,7 @@ class CloudOutputDeviceManager:
|
||||
self._remote_clusters[device.getId()] = device
|
||||
remote_clusters_added = True
|
||||
|
||||
CuraApplication.getInstance().getDiscoveredUltimakerCloudPrintersModel().addDiscoveredUltimakerCloudPrinter(new_devices)
|
||||
CuraApplication.getInstance().getDiscoveredUltimakerCloudPrintersModel().addDiscoveredUltimakerCloudPrinters(new_devices)
|
||||
|
||||
if not new_devices:
|
||||
if remote_clusters_added:
|
||||
|
@ -169,7 +169,7 @@ Item
|
||||
text: catalog.i18nc("@button", "Add printer manually")
|
||||
onClicked:
|
||||
{
|
||||
discoveredCloudPrintersModel.clearDiscoveredUltimakerCloudPrinters()
|
||||
discoveredCloudPrintersModel.clear()
|
||||
base.showPreviousPage()
|
||||
}
|
||||
}
|
||||
@ -182,7 +182,7 @@ Item
|
||||
text: catalog.i18nc("@button", "Finish")
|
||||
onClicked:
|
||||
{
|
||||
addCloudPrinterScreen.discoveredCloudPrintersModel.clearDiscoveredUltimakerCloudPrinters()
|
||||
discoveredCloudPrintersModel.clear()
|
||||
base.showNextPage()
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,10 @@ Item
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: catalog.i18nc("@label", "Add cloud printer")
|
||||
height: UM.Theme.getSize("message_action_button").height
|
||||
onClicked: base.addCloudPrinterButtonClicked()
|
||||
onClicked: {
|
||||
CuraApplication.getDiscoveredUltimakerCloudPrintersModel().clear()
|
||||
base.addCloudPrinterButtonClicked()
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
|
Loading…
x
Reference in New Issue
Block a user