mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-24 23:23:57 -06:00
Reset the model when pressing the Add cloud printer button
CURA-7022
This commit is contained in:
parent
1d4225a44a
commit
6583f5f5ac
4 changed files with 9 additions and 6 deletions
|
@ -27,7 +27,7 @@ class DiscoveredUltimakerCloudPrintersModel(ListModel):
|
||||||
self._discovered_ultimaker_cloud_printers_list = []
|
self._discovered_ultimaker_cloud_printers_list = []
|
||||||
self._application = application
|
self._application = application
|
||||||
|
|
||||||
def addDiscoveredUltimakerCloudPrinter(self, new_devices) -> None:
|
def addDiscoveredUltimakerCloudPrinters(self, new_devices) -> None:
|
||||||
for device in new_devices:
|
for device in new_devices:
|
||||||
self._discovered_ultimaker_cloud_printers_list.append({
|
self._discovered_ultimaker_cloud_printers_list.append({
|
||||||
"ip_address": device.key,
|
"ip_address": device.key,
|
||||||
|
@ -39,7 +39,7 @@ class DiscoveredUltimakerCloudPrintersModel(ListModel):
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def clearDiscoveredUltimakerCloudPrinters(self):
|
def clear(self):
|
||||||
self._discovered_ultimaker_cloud_printers_list = []
|
self._discovered_ultimaker_cloud_printers_list = []
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
|
|
|
@ -146,7 +146,7 @@ class CloudOutputDeviceManager:
|
||||||
self._remote_clusters[device.getId()] = device
|
self._remote_clusters[device.getId()] = device
|
||||||
remote_clusters_added = True
|
remote_clusters_added = True
|
||||||
|
|
||||||
CuraApplication.getInstance().getDiscoveredUltimakerCloudPrintersModel().addDiscoveredUltimakerCloudPrinter(new_devices)
|
CuraApplication.getInstance().getDiscoveredUltimakerCloudPrintersModel().addDiscoveredUltimakerCloudPrinters(new_devices)
|
||||||
|
|
||||||
if not new_devices:
|
if not new_devices:
|
||||||
if remote_clusters_added:
|
if remote_clusters_added:
|
||||||
|
|
|
@ -169,7 +169,7 @@ Item
|
||||||
text: catalog.i18nc("@button", "Add printer manually")
|
text: catalog.i18nc("@button", "Add printer manually")
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
discoveredCloudPrintersModel.clearDiscoveredUltimakerCloudPrinters()
|
discoveredCloudPrintersModel.clear()
|
||||||
base.showPreviousPage()
|
base.showPreviousPage()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ Item
|
||||||
text: catalog.i18nc("@button", "Finish")
|
text: catalog.i18nc("@button", "Finish")
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
addCloudPrinterScreen.discoveredCloudPrintersModel.clearDiscoveredUltimakerCloudPrinters()
|
discoveredCloudPrintersModel.clear()
|
||||||
base.showNextPage()
|
base.showNextPage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,10 @@ Item
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: catalog.i18nc("@label", "Add cloud printer")
|
text: catalog.i18nc("@label", "Add cloud printer")
|
||||||
height: UM.Theme.getSize("message_action_button").height
|
height: UM.Theme.getSize("message_action_button").height
|
||||||
onClicked: base.addCloudPrinterButtonClicked()
|
onClicked: {
|
||||||
|
CuraApplication.getDiscoveredUltimakerCloudPrintersModel().clear()
|
||||||
|
base.addCloudPrinterButtonClicked()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue