mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-13 09:47:50 -06:00
Merge branch '4.0' of github.com:Ultimaker/Cura
This commit is contained in:
commit
0fbfe9e6c9
3 changed files with 63 additions and 46 deletions
|
@ -1382,8 +1382,9 @@ class MachineManager(QObject):
|
||||||
need_to_show_message = False
|
need_to_show_message = False
|
||||||
|
|
||||||
for extruder_configuration in configuration.extruderConfigurations:
|
for extruder_configuration in configuration.extruderConfigurations:
|
||||||
extruder_has_hotend = extruder_configuration.hotendID != ""
|
# We support "" or None, since the cloud uses None instead of empty strings
|
||||||
extruder_has_material = extruder_configuration.material.guid != ""
|
extruder_has_hotend = extruder_configuration.hotendID and extruder_configuration.hotendID != ""
|
||||||
|
extruder_has_material = extruder_configuration.material.guid and extruder_configuration.material.guid != ""
|
||||||
|
|
||||||
# If the machine doesn't have a hotend or material, disable this extruder
|
# If the machine doesn't have a hotend or material, disable this extruder
|
||||||
if not extruder_has_hotend or not extruder_has_material:
|
if not extruder_has_hotend or not extruder_has_material:
|
||||||
|
|
|
@ -50,7 +50,17 @@ Component
|
||||||
MonitorCarousel
|
MonitorCarousel
|
||||||
{
|
{
|
||||||
id: carousel
|
id: carousel
|
||||||
printers: OutputDevice.receivedPrintJobs ? OutputDevice.printers : [null]
|
printers:
|
||||||
|
{
|
||||||
|
// When printing over the cloud we don't recieve print jobs until there is one, so
|
||||||
|
// unless there's at least one print job we'll be stuck with skeleton loading
|
||||||
|
// indefinitely.
|
||||||
|
if (Cura.MachineManager.activeMachineIsUsingCloudConnection || OutputDevice.receivedPrintJobs)
|
||||||
|
{
|
||||||
|
return OutputDevice.printers
|
||||||
|
}
|
||||||
|
return [null]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -454,43 +454,20 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
|
||||||
def _onCloudFlowPossible(self) -> None:
|
def _onCloudFlowPossible(self) -> None:
|
||||||
# Cloud flow is possible, so show the message
|
# Cloud flow is possible, so show the message
|
||||||
if not self._start_cloud_flow_message:
|
if not self._start_cloud_flow_message:
|
||||||
self._start_cloud_flow_message = Message(
|
self._createCloudFlowStartMessage()
|
||||||
text = i18n_catalog.i18nc("@info:status", "Send and monitor print jobs from anywhere using your Ultimaker account."),
|
if self._start_cloud_flow_message and not self._start_cloud_flow_message.visible:
|
||||||
lifetime = 0,
|
|
||||||
image_source = QUrl.fromLocalFile(os.path.join(
|
|
||||||
PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"),
|
|
||||||
"resources", "svg", "cloud-flow-start.svg"
|
|
||||||
)),
|
|
||||||
image_caption = i18n_catalog.i18nc("@info:status", "Connect to Ultimaker Cloud"),
|
|
||||||
option_text = i18n_catalog.i18nc("@action", "Don't ask me again for this printer."),
|
|
||||||
option_state = False
|
|
||||||
)
|
|
||||||
self._start_cloud_flow_message.addAction("", i18n_catalog.i18nc("@action", "Get started"), "", "")
|
|
||||||
self._start_cloud_flow_message.optionToggled.connect(self._onDontAskMeAgain)
|
|
||||||
self._start_cloud_flow_message.actionTriggered.connect(self._onCloudFlowStarted)
|
|
||||||
self._start_cloud_flow_message.show()
|
self._start_cloud_flow_message.show()
|
||||||
return
|
|
||||||
|
|
||||||
def _onCloudPrintingConfigured(self) -> None:
|
def _onCloudPrintingConfigured(self) -> None:
|
||||||
if self._start_cloud_flow_message:
|
# Hide the cloud flow start message if it was hanging around already
|
||||||
|
# For example: if the user already had the browser openen and made the association themselves
|
||||||
|
if self._start_cloud_flow_message and self._start_cloud_flow_message.visible:
|
||||||
self._start_cloud_flow_message.hide()
|
self._start_cloud_flow_message.hide()
|
||||||
self._start_cloud_flow_message = None
|
|
||||||
|
|
||||||
# Show the successful pop-up
|
# Cloud flow is complete, so show the message
|
||||||
if not self._start_cloud_flow_message:
|
if not self._cloud_flow_complete_message:
|
||||||
self._cloud_flow_complete_message = Message(
|
self._createCloudFlowCompleteMessage()
|
||||||
text = i18n_catalog.i18nc("@info:status", "You can now send and monitor print jobs from anywhere using your Ultimaker account."),
|
if self._cloud_flow_complete_message and not self._cloud_flow_complete_message.visible:
|
||||||
lifetime = 30,
|
|
||||||
image_source = QUrl.fromLocalFile(os.path.join(
|
|
||||||
PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"),
|
|
||||||
"resources", "svg", "cloud-flow-completed.svg"
|
|
||||||
)),
|
|
||||||
image_caption = i18n_catalog.i18nc("@info:status", "Connected!")
|
|
||||||
)
|
|
||||||
# Don't show the review connection link if we're not on the local network
|
|
||||||
if self._application.getMachineManager().activeMachineHasNetworkConnection:
|
|
||||||
self._cloud_flow_complete_message.addAction("", i18n_catalog.i18nc("@action", "Review your connection"), "", "", 1) # TODO: Icon
|
|
||||||
self._cloud_flow_complete_message.actionTriggered.connect(self._onReviewCloudConnection)
|
|
||||||
self._cloud_flow_complete_message.show()
|
self._cloud_flow_complete_message.show()
|
||||||
|
|
||||||
# Set the machine's cloud flow as complete so we don't ask the user again and again for cloud connected printers
|
# Set the machine's cloud flow as complete so we don't ask the user again and again for cloud connected printers
|
||||||
|
@ -523,11 +500,40 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
|
||||||
return
|
return
|
||||||
|
|
||||||
def _onMachineSwitched(self) -> None:
|
def _onMachineSwitched(self) -> None:
|
||||||
if self._start_cloud_flow_message is not None:
|
# Hide any left over messages
|
||||||
|
if self._start_cloud_flow_message is not None and self._start_cloud_flow_message.visible:
|
||||||
self._start_cloud_flow_message.hide()
|
self._start_cloud_flow_message.hide()
|
||||||
self._start_cloud_flow_message = None
|
if self._cloud_flow_complete_message is not None and self._cloud_flow_complete_message.visible:
|
||||||
if self._cloud_flow_complete_message is not None:
|
|
||||||
self._cloud_flow_complete_message.hide()
|
self._cloud_flow_complete_message.hide()
|
||||||
self._cloud_flow_complete_message = None
|
|
||||||
|
|
||||||
|
# Check for cloud flow again with newly selected machine
|
||||||
self.checkCloudFlowIsPossible()
|
self.checkCloudFlowIsPossible()
|
||||||
|
|
||||||
|
def _createCloudFlowStartMessage(self):
|
||||||
|
self._start_cloud_flow_message = Message(
|
||||||
|
text = i18n_catalog.i18nc("@info:status", "Send and monitor print jobs from anywhere using your Ultimaker account."),
|
||||||
|
lifetime = 0,
|
||||||
|
image_source = QUrl.fromLocalFile(os.path.join(
|
||||||
|
PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"),
|
||||||
|
"resources", "svg", "cloud-flow-start.svg"
|
||||||
|
)),
|
||||||
|
image_caption = i18n_catalog.i18nc("@info:status", "Connect to Ultimaker Cloud"),
|
||||||
|
option_text = i18n_catalog.i18nc("@action", "Don't ask me again for this printer."),
|
||||||
|
option_state = False
|
||||||
|
)
|
||||||
|
self._start_cloud_flow_message.addAction("", i18n_catalog.i18nc("@action", "Get started"), "", "")
|
||||||
|
self._start_cloud_flow_message.optionToggled.connect(self._onDontAskMeAgain)
|
||||||
|
self._start_cloud_flow_message.actionTriggered.connect(self._onCloudFlowStarted)
|
||||||
|
|
||||||
|
def _createCloudFlowCompleteMessage(self):
|
||||||
|
self._cloud_flow_complete_message = Message(
|
||||||
|
text = i18n_catalog.i18nc("@info:status", "You can now send and monitor print jobs from anywhere using your Ultimaker account."),
|
||||||
|
lifetime = 30,
|
||||||
|
image_source = QUrl.fromLocalFile(os.path.join(
|
||||||
|
PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"),
|
||||||
|
"resources", "svg", "cloud-flow-completed.svg"
|
||||||
|
)),
|
||||||
|
image_caption = i18n_catalog.i18nc("@info:status", "Connected!")
|
||||||
|
)
|
||||||
|
self._cloud_flow_complete_message.addAction("", i18n_catalog.i18nc("@action", "Review your connection"), "", "", 1) # TODO: Icon
|
||||||
|
self._cloud_flow_complete_message.actionTriggered.connect(self._onReviewCloudConnection)
|
Loading…
Add table
Add a link
Reference in a new issue