mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-14 02:07:51 -06:00
Add documentation
Contributes to issue CURA-8055.
This commit is contained in:
parent
66b2825a66
commit
e9031f1aff
1 changed files with 11 additions and 0 deletions
|
@ -290,12 +290,23 @@ class MaterialManagementModel(QObject):
|
||||||
outputDevicesChanged = pyqtSignal() # Triggered when adding or removing removable drives.
|
outputDevicesChanged = pyqtSignal() # Triggered when adding or removing removable drives.
|
||||||
@pyqtProperty(QUrl, notify = outputDevicesChanged)
|
@pyqtProperty(QUrl, notify = outputDevicesChanged)
|
||||||
def preferredExportAllPath(self) -> QUrl:
|
def preferredExportAllPath(self) -> QUrl:
|
||||||
|
"""
|
||||||
|
Get the preferred path to export materials to.
|
||||||
|
|
||||||
|
If there is a removable drive, that should be the preferred path. Otherwise it should be the most recent local
|
||||||
|
file path.
|
||||||
|
:return: The preferred path to export all materials to.
|
||||||
|
"""
|
||||||
if self._preferred_export_all_path is None: # Not initialised yet. Can happen when output devices changed before class got created.
|
if self._preferred_export_all_path is None: # Not initialised yet. Can happen when output devices changed before class got created.
|
||||||
self._onOutputDevicesChanged()
|
self._onOutputDevicesChanged()
|
||||||
return self._preferred_export_all_path
|
return self._preferred_export_all_path
|
||||||
|
|
||||||
@pyqtSlot(QUrl)
|
@pyqtSlot(QUrl)
|
||||||
def exportAll(self, file_path: QUrl) -> None:
|
def exportAll(self, file_path: QUrl) -> None:
|
||||||
|
"""
|
||||||
|
Export all materials to a certain file path.
|
||||||
|
:param file_path: The path to export the materials to.
|
||||||
|
"""
|
||||||
registry = CuraContainerRegistry.getInstance()
|
registry = CuraContainerRegistry.getInstance()
|
||||||
|
|
||||||
archive = zipfile.ZipFile(file_path.toLocalFile(), "w")
|
archive = zipfile.ZipFile(file_path.toLocalFile(), "w")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue