Browse Source

Added preference to show UFP saving dialog

Changes saving to .ucp to .3mf
saumya.jain 1 year ago
parent
commit
b641741e49

+ 2 - 0
cura/CuraApplication.py

@@ -601,7 +601,9 @@ class CuraApplication(QtApplication):
         preferences.addPreference("mesh/scale_to_fit", False)
         preferences.addPreference("mesh/scale_tiny_meshes", 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_ucp_project_save", False)
         preferences.addPreference("cura/choice_on_profile_override", "always_ask")
         preferences.addPreference("cura/choice_on_open_project", "always_ask")
         preferences.addPreference("cura/use_multi_build_plate", False)

+ 2 - 2
plugins/3MFReader/ThreeMFReader.py

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

+ 2 - 2
plugins/3MFReader/ThreeMFWorkspaceReader.py

@@ -113,7 +113,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
     def __init__(self) -> None:
         super().__init__()
 
-        self._supported_extensions = [".3mf", ".ucp"]
+        self._supported_extensions = [".3mf"]
         self._dialog = WorkspaceDialog()
         self._3mf_mesh_reader = None
         self._container_registry = ContainerRegistry.getInstance()
@@ -236,7 +236,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
 
         # 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
-        is_ucp = file_name.endswith('.ucp')
+        is_ucp = file_name.endswith('.3mf')
 
         #
         # Read definition containers

+ 1 - 1
plugins/3MFReader/plugin.json

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

+ 1 - 1
plugins/3MFWriter/ThreeMFWorkspaceWriter.py

@@ -39,7 +39,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
         is_ucp = False
         if hasattr(self._stream, 'name'):
             # 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:
             self._config_dialog = UCPDialog()

+ 24 - 1
plugins/3MFWriter/UCPDialog.qml

@@ -19,6 +19,21 @@ UM.Dialog
     minimumHeight: UM.Theme.getSize("modal_window_minimum").height
 
     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
     {
@@ -75,7 +90,15 @@ UM.Dialog
             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:
     [
         Cura.TertiaryButton

+ 2 - 2
plugins/3MFWriter/__init__.py

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

+ 14 - 0
resources/qml/Preferences/GeneralPage.qml

@@ -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
             {
                 width: childrenRect.width