mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 22:13:58 -06:00
Merge branch '4.11' of github.com:Ultimaker/Cura
This commit is contained in:
commit
0348293f87
11 changed files with 149 additions and 138 deletions
|
@ -1,11 +1,13 @@
|
|||
# Copyright (c) 2021 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
from typing import Optional
|
||||
|
||||
from cura.CuraApplication import CuraApplication
|
||||
from UM.Message import Message
|
||||
from UM.Version import Version
|
||||
|
||||
def getBackwardsCompatibleMessage(text: str, title: str, lifetime: int, message_type_str: str) -> Message:
|
||||
|
||||
def getBackwardsCompatibleMessage(text: str, title: str, message_type_str: str, lifetime: Optional[int] = 30) -> Message:
|
||||
if CuraApplication.getInstance().getAPIVersion() < Version("7.7.0"):
|
||||
return Message(text=text, title=title, lifetime=lifetime)
|
||||
else:
|
||||
|
|
|
@ -73,6 +73,7 @@ class DFFileExportAndUploadManager:
|
|||
self._generic_success_message = getBackwardsCompatibleMessage(
|
||||
text = "Your {} uploaded to '{}'.".format("file was" if len(self._file_upload_job_metadata) <= 1 else "files were", self._library_project_name),
|
||||
title = "Upload successful",
|
||||
lifetime = 30,
|
||||
message_type_str = "POSITIVE"
|
||||
)
|
||||
self._generic_success_message.addAction(
|
||||
|
@ -220,8 +221,8 @@ class DFFileExportAndUploadManager:
|
|||
self._file_upload_job_metadata[filename]["file_upload_failed_message"] = getBackwardsCompatibleMessage(
|
||||
text = "Failed to export the file '{}'. The upload process is aborted.".format(filename),
|
||||
title = "Export error",
|
||||
lifetime = 0,
|
||||
message_type_str = "ERROR"
|
||||
message_type_str = "ERROR",
|
||||
lifetime = 30
|
||||
)
|
||||
self._on_upload_error()
|
||||
self._onFileUploadFinished(filename)
|
||||
|
@ -243,8 +244,8 @@ class DFFileExportAndUploadManager:
|
|||
self._file_upload_job_metadata[filename_3mf]["file_upload_failed_message"] = getBackwardsCompatibleMessage(
|
||||
text = "Failed to upload the file '{}' to '{}'. {}".format(filename_3mf, self._library_project_name, human_readable_error),
|
||||
title = "File upload error",
|
||||
lifetime = 0,
|
||||
message_type_str = "ERROR"
|
||||
message_type_str = "ERROR",
|
||||
lifetime = 30
|
||||
)
|
||||
self._on_upload_error()
|
||||
self._onFileUploadFinished(filename_3mf)
|
||||
|
@ -266,8 +267,8 @@ class DFFileExportAndUploadManager:
|
|||
self._file_upload_job_metadata[filename_ufp]["file_upload_failed_message"] = getBackwardsCompatibleMessage(
|
||||
title = "File upload error",
|
||||
text = "Failed to upload the file '{}' to '{}'. {}".format(filename_ufp, self._library_project_name, human_readable_error),
|
||||
lifetime = 0,
|
||||
message_type_str = "ERROR"
|
||||
message_type_str = "ERROR",
|
||||
lifetime = 30
|
||||
)
|
||||
self._on_upload_error()
|
||||
self._onFileUploadFinished(filename_ufp)
|
||||
|
@ -303,8 +304,8 @@ class DFFileExportAndUploadManager:
|
|||
self._file_upload_job_metadata[filename]["file_upload_failed_message"] = getBackwardsCompatibleMessage(
|
||||
title = "File upload error",
|
||||
text = "Failed to upload the file '{}' to '{}'. {}".format(self._file_name, self._library_project_name, human_readable_error),
|
||||
lifetime = 0,
|
||||
message_type_str = "ERROR"
|
||||
message_type_str = "ERROR",
|
||||
lifetime = 30
|
||||
)
|
||||
|
||||
self._on_upload_error()
|
||||
|
@ -340,13 +341,14 @@ class DFFileExportAndUploadManager:
|
|||
"file_upload_success_message": getBackwardsCompatibleMessage(
|
||||
text = "'{}' was uploaded to '{}'.".format(filename_3mf, self._library_project_name),
|
||||
title = "Upload successful",
|
||||
message_type_str = "POSITIVE"
|
||||
message_type_str = "POSITIVE",
|
||||
lifetime = 30
|
||||
),
|
||||
"file_upload_failed_message": getBackwardsCompatibleMessage(
|
||||
text = "Failed to upload the file '{}' to '{}'.".format(filename_3mf, self._library_project_name),
|
||||
title = "File upload error",
|
||||
lifetime = 0,
|
||||
message_type_str = "ERROR"
|
||||
message_type_str = "ERROR",
|
||||
lifetime = 30
|
||||
)
|
||||
}
|
||||
job_3mf = ExportFileJob(self._file_handlers["3mf"], self._nodes, self._file_name, "3mf")
|
||||
|
@ -363,13 +365,14 @@ class DFFileExportAndUploadManager:
|
|||
"file_upload_success_message": getBackwardsCompatibleMessage(
|
||||
text = "'{}' was uploaded to '{}'.".format(filename_ufp, self._library_project_name),
|
||||
title = "Upload successful",
|
||||
message_type_str = "POSITIVE"
|
||||
message_type_str = "POSITIVE",
|
||||
lifetime = 30,
|
||||
),
|
||||
"file_upload_failed_message": getBackwardsCompatibleMessage(
|
||||
text = "Failed to upload the file '{}' to '{}'.".format(filename_ufp, self._library_project_name),
|
||||
title = "File upload error",
|
||||
lifetime = 0,
|
||||
message_type_str = "ERROR"
|
||||
message_type_str = "ERROR",
|
||||
lifetime = 30
|
||||
)
|
||||
}
|
||||
job_ufp = ExportFileJob(self._file_handlers["ufp"], self._nodes, self._file_name, "ufp")
|
||||
|
|
|
@ -531,8 +531,8 @@ class DigitalFactoryController(QObject):
|
|||
getBackwardsCompatibleMessage(
|
||||
text = "Failed to write to temporary file for '{}'.".format(file_name),
|
||||
title = "File-system error",
|
||||
lifetime = 10,
|
||||
message_type_str="ERROR"
|
||||
message_type_str="ERROR",
|
||||
lifetime = 10
|
||||
).show()
|
||||
return
|
||||
|
||||
|
@ -546,8 +546,8 @@ class DigitalFactoryController(QObject):
|
|||
getBackwardsCompatibleMessage(
|
||||
text = "Failed Digital Library download for '{}'.".format(f),
|
||||
title = "Network error {}".format(error),
|
||||
lifetime = 10,
|
||||
message_type_str="ERROR"
|
||||
message_type_str="ERROR",
|
||||
lifetime = 10
|
||||
).show()
|
||||
|
||||
download_manager = HttpRequestManager.getInstance()
|
||||
|
@ -592,10 +592,12 @@ class DigitalFactoryController(QObject):
|
|||
|
||||
if filename == "":
|
||||
Logger.log("w", "The file name cannot be empty.")
|
||||
getBackwardsCompatibleMessage(text = "Cannot upload file with an empty name to the Digital Library",
|
||||
getBackwardsCompatibleMessage(
|
||||
text = "Cannot upload file with an empty name to the Digital Library",
|
||||
title = "Empty file name provided",
|
||||
lifetime = 0,
|
||||
message_type_str = "ERROR").show()
|
||||
message_type_str = "ERROR",
|
||||
lifetime = 0
|
||||
).show()
|
||||
return
|
||||
|
||||
self._saveFileToSelectedProjectHelper(filename, formats)
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
"author": "Ultimaker B.V.",
|
||||
"version": "1.0.0",
|
||||
"description": "Provides support for reading Ultimaker Format Packages.",
|
||||
"supported_sdk_versions": ["7.6.0"],
|
||||
"supported_sdk_versions": ["7.7.0"],
|
||||
"i18n-catalog": "cura"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue