mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Show error when we don't have permission to write workspace
Fixes several Sentry issues, among which Cura-EG.
This commit is contained in:
parent
be85e6d75e
commit
f34edd6bec
1 changed files with 19 additions and 10 deletions
|
@ -10,6 +10,8 @@ from UM.Logger import Logger
|
||||||
from UM.Preferences import Preferences
|
from UM.Preferences import Preferences
|
||||||
from UM.Settings.ContainerRegistry import ContainerRegistry
|
from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
from UM.Workspace.WorkspaceWriter import WorkspaceWriter
|
from UM.Workspace.WorkspaceWriter import WorkspaceWriter
|
||||||
|
from UM.i18n import i18nCatalog
|
||||||
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
from cura.Utils.Threading import call_on_qt_thread
|
from cura.Utils.Threading import call_on_qt_thread
|
||||||
|
|
||||||
|
@ -26,6 +28,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
||||||
mesh_writer = application.getMeshFileHandler().getWriter("3MFWriter")
|
mesh_writer = application.getMeshFileHandler().getWriter("3MFWriter")
|
||||||
|
|
||||||
if not mesh_writer: # We need to have the 3mf mesh writer, otherwise we can't save the entire workspace
|
if not mesh_writer: # We need to have the 3mf mesh writer, otherwise we can't save the entire workspace
|
||||||
|
self.setInformation(catalog.i18nc("@error:zip", "3MF Writer plug-in is corrupt."))
|
||||||
Logger.error("3MF Writer class is unavailable. Can't write workspace.")
|
Logger.error("3MF Writer class is unavailable. Can't write workspace.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -39,6 +42,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
||||||
|
|
||||||
global_stack = machine_manager.activeMachine
|
global_stack = machine_manager.activeMachine
|
||||||
|
|
||||||
|
try:
|
||||||
# Add global container stack data to the archive.
|
# Add global container stack data to the archive.
|
||||||
self._writeContainerToArchive(global_stack, archive)
|
self._writeContainerToArchive(global_stack, archive)
|
||||||
|
|
||||||
|
@ -51,6 +55,10 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
||||||
self._writeContainerToArchive(extruder_stack, archive)
|
self._writeContainerToArchive(extruder_stack, archive)
|
||||||
for container in extruder_stack.getContainers():
|
for container in extruder_stack.getContainers():
|
||||||
self._writeContainerToArchive(container, archive)
|
self._writeContainerToArchive(container, archive)
|
||||||
|
except PermissionError:
|
||||||
|
self.setInformation(catalog.i18nc("@error:zip", "No permission to write the workspace here."))
|
||||||
|
Logger.error("No permission to write workspace to this stream.")
|
||||||
|
return False
|
||||||
|
|
||||||
# Write preferences to archive
|
# Write preferences to archive
|
||||||
original_preferences = Application.getInstance().getPreferences() #Copy only the preferences that we use to the workspace.
|
original_preferences = Application.getInstance().getPreferences() #Copy only the preferences that we use to the workspace.
|
||||||
|
@ -81,6 +89,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
|
||||||
# Close the archive & reset states.
|
# Close the archive & reset states.
|
||||||
archive.close()
|
archive.close()
|
||||||
except PermissionError:
|
except PermissionError:
|
||||||
|
self.setInformation(catalog.i18nc("@error:zip", "No permission to write the workspace here."))
|
||||||
Logger.error("No permission to write workspace to this stream.")
|
Logger.error("No permission to write workspace to this stream.")
|
||||||
return False
|
return False
|
||||||
mesh_writer.setStoreArchive(False)
|
mesh_writer.setStoreArchive(False)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue