mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Seperate the init of jobs and starting
This makes it a lot easier to test them CURA-7959
This commit is contained in:
parent
cf8113608f
commit
7979483e48
3 changed files with 28 additions and 4 deletions
|
@ -44,7 +44,7 @@ class DFFileExportAndUploadManager:
|
|||
self._library_project_id = library_project_id # type: str
|
||||
self._library_project_name = library_project_name # type: str
|
||||
self._file_name = file_name # type: str
|
||||
|
||||
self._upload_jobs = [] # type: List[ExportFileJob]
|
||||
self._formats = formats # type: List[str]
|
||||
self._api = DigitalFactoryApiClient(application = CuraApplication.getInstance(), on_error = lambda error: Logger.log("e", str(error)))
|
||||
|
||||
|
@ -81,6 +81,8 @@ class DFFileExportAndUploadManager:
|
|||
)
|
||||
self._generic_success_message.actionTriggered.connect(self._onMessageActionTriggered)
|
||||
|
||||
|
||||
|
||||
def _onCuraProjectFileExported(self, job: ExportFileJob) -> None:
|
||||
"""Handler for when the DF Library workspace file (3MF) has been created locally.
|
||||
|
||||
|
@ -318,8 +320,13 @@ class DFFileExportAndUploadManager:
|
|||
QDesktopServices.openUrl(QUrl(project_url))
|
||||
message.hide()
|
||||
|
||||
def start(self) -> None:
|
||||
for job in self._upload_jobs:
|
||||
job.start()
|
||||
|
||||
def initializeFileUploadJobMetadata(self) -> Dict[str, Any]:
|
||||
metadata = {}
|
||||
self._upload_jobs = []
|
||||
if "3mf" in self._formats and "3mf" in self._file_handlers and self._file_handlers["3mf"]:
|
||||
filename_3mf = self._file_name + ".3mf"
|
||||
metadata[filename_3mf] = {
|
||||
|
@ -340,7 +347,7 @@ class DFFileExportAndUploadManager:
|
|||
}
|
||||
job_3mf = ExportFileJob(self._file_handlers["3mf"], self._nodes, self._file_name, "3mf")
|
||||
job_3mf.finished.connect(self._onCuraProjectFileExported)
|
||||
job_3mf.start()
|
||||
self._upload_jobs.append(job_3mf)
|
||||
|
||||
if "ufp" in self._formats and "ufp" in self._file_handlers and self._file_handlers["ufp"]:
|
||||
filename_ufp = self._file_name + ".ufp"
|
||||
|
@ -362,5 +369,5 @@ class DFFileExportAndUploadManager:
|
|||
}
|
||||
job_ufp = ExportFileJob(self._file_handlers["ufp"], self._nodes, self._file_name, "ufp")
|
||||
job_ufp.finished.connect(self._onPrintFileExported)
|
||||
job_ufp.start()
|
||||
self._upload_jobs.append(job_ufp)
|
||||
return metadata
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue