Added preference to show UFP saving dialog

Changes saving to .ucp to .3mf
This commit is contained in:
saumya.jain 2024-02-16 14:11:07 +01:00
parent 80d7536763
commit b641741e49
8 changed files with 48 additions and 9 deletions

View file

@ -601,7 +601,9 @@ class CuraApplication(QtApplication):
preferences.addPreference("mesh/scale_to_fit", False) preferences.addPreference("mesh/scale_to_fit", False)
preferences.addPreference("mesh/scale_tiny_meshes", True) preferences.addPreference("mesh/scale_tiny_meshes", True)
preferences.addPreference("cura/dialog_on_project_save", True) preferences.addPreference("cura/dialog_on_project_save", True)
preferences.addPreference("cura/dialog_on_ucp_project_save", True)
preferences.addPreference("cura/asked_dialog_on_project_save", False) preferences.addPreference("cura/asked_dialog_on_project_save", False)
preferences.addPreference("cura/asked_dialog_on_ucp_project_save", False)
preferences.addPreference("cura/choice_on_profile_override", "always_ask") preferences.addPreference("cura/choice_on_profile_override", "always_ask")
preferences.addPreference("cura/choice_on_open_project", "always_ask") preferences.addPreference("cura/choice_on_open_project", "always_ask")
preferences.addPreference("cura/use_multi_build_plate", False) preferences.addPreference("cura/use_multi_build_plate", False)

View file

@ -50,11 +50,11 @@ class ThreeMFReader(MeshReader):
MimeType( MimeType(
name="application/x-ucp", name="application/x-ucp",
comment="UCP", comment="UCP",
suffixes=["ucp"] suffixes=["3mf"]
) )
) )
self._supported_extensions = [".3mf", ".ucp"] self._supported_extensions = [".3mf"]
self._root = None self._root = None
self._base_name = "" self._base_name = ""
self._unit = None self._unit = None

View file

@ -113,7 +113,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
def __init__(self) -> None: def __init__(self) -> None:
super().__init__() super().__init__()
self._supported_extensions = [".3mf", ".ucp"] self._supported_extensions = [".3mf"]
self._dialog = WorkspaceDialog() self._dialog = WorkspaceDialog()
self._3mf_mesh_reader = None self._3mf_mesh_reader = None
self._container_registry = ContainerRegistry.getInstance() self._container_registry = ContainerRegistry.getInstance()
@ -236,7 +236,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
# Check whether the file is a UCP, which changes some import options # Check whether the file is a UCP, which changes some import options
#FIXME Instead of this, we should just check for the presence of the user-settings file, whatever the extension #FIXME Instead of this, we should just check for the presence of the user-settings file, whatever the extension
is_ucp = file_name.endswith('.ucp') is_ucp = file_name.endswith('.3mf')
# #
# Read definition containers # Read definition containers

View file

@ -2,7 +2,7 @@
"name": "3MF Reader", "name": "3MF Reader",
"author": "Ultimaker B.V.", "author": "Ultimaker B.V.",
"version": "1.0.1", "version": "1.0.1",
"description": "Provides support for reading 3MF and UCP files.", "description": "Provides support for reading 3MF files.",
"api": 8, "api": 8,
"i18n-catalog": "cura" "i18n-catalog": "cura"
} }

View file

@ -39,7 +39,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
is_ucp = False is_ucp = False
if hasattr(self._stream, 'name'): if hasattr(self._stream, 'name'):
# This only works with local file, but we don't want remote UCP files yet # This only works with local file, but we don't want remote UCP files yet
is_ucp = self._stream.name.endswith('.ucp') is_ucp = self._stream.name.endswith('.3mf')
if is_ucp: if is_ucp:
self._config_dialog = UCPDialog() self._config_dialog = UCPDialog()

View file

@ -19,6 +19,21 @@ UM.Dialog
minimumHeight: UM.Theme.getSize("modal_window_minimum").height minimumHeight: UM.Theme.getSize("modal_window_minimum").height
backgroundColor: UM.Theme.getColor("detail_background") backgroundColor: UM.Theme.getColor("detail_background")
property bool dontShowAgain: true
function storeDontShowAgain()
{
UM.Preferences.setValue("cura/dialog_on_ucp_project_save", !dontShowAgainCheckbox.checked)
UM.Preferences.setValue("asked_dialog_on_ucp_project_save", true)
}
onVisibleChanged:
{
if(visible && UM.Preferences.getValue("cura/asked_dialog_on_ucp_project_save"))
{
dontShowAgain = !UM.Preferences.getValue("cura/dialog_on_ucp_project_save")
}
}
headerComponent: Rectangle headerComponent: Rectangle
{ {
@ -75,7 +90,15 @@ UM.Dialog
delegate: SettingsSelectionGroup { Layout.margins: 0 } delegate: SettingsSelectionGroup { Layout.margins: 0 }
} }
} }
leftButtons:
[
UM.CheckBox
{
id: dontShowAgainCheckbox
text: catalog.i18nc("@action:label", "Don't show project summary on save again")
checked: dontShowAgain
}
]
rightButtons: rightButtons:
[ [
Cura.TertiaryButton Cura.TertiaryButton

View file

@ -34,7 +34,7 @@ def getMetaData():
"mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode "mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode
}, },
{ {
"extension": "ucp", "extension": "3mf",
"description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project"), "description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project"),
"mime_type": "application/x-ucp", "mime_type": "application/x-ucp",
"mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode "mode": ThreeMFWriter.ThreeMFWriter.OutputMode.BinaryMode
@ -50,7 +50,7 @@ def getMetaData():
"mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode "mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode
}, },
{ {
"extension": "ucp", "extension": "3mf",
"description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project"), "description": i18n_catalog.i18nc("@item:inlistbox", "Universal Cura Project"),
"mime_type": "application/x-ucp", "mime_type": "application/x-ucp",
"mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode "mode": ThreeMFWorkspaceWriter.ThreeMFWorkspaceWriter.OutputMode.BinaryMode

View file

@ -735,6 +735,20 @@ UM.PreferencesPage
} }
} }
UM.TooltipArea
{
width: childrenRect.width
height: childrenRect.height
text: catalog.i18nc("@info:tooltip", "Should a summary be shown when saving a UCP project file?")
UM.CheckBox
{
text: catalog.i18nc("@option:check", "Show summary dialog when saving a UCP project")
checked: boolCheck(UM.Preferences.getValue("cura/dialog_on_ucp_project_save"))
onCheckedChanged: UM.Preferences.setValue("cura/dialog_on_ucp_project_save", checked)
}
}
UM.TooltipArea UM.TooltipArea
{ {
width: childrenRect.width width: childrenRect.width