Browse Source

Remove UserAgreement-plugin in favour of Welcome-Pages. [CURA-6057]

Remco Burema 6 years ago
parent
commit
5b31feebba

+ 3 - 1
cura/CuraApplication.py

@@ -456,7 +456,7 @@ class CuraApplication(QtApplication):
             # Misc.:
             "ConsoleLogger", #You want to be able to read the log if something goes wrong.
             "CuraEngineBackend", #Cura is useless without this one since you can't slice.
-            "UserAgreement", #Our lawyers want every user to see this at least once.
+            # NOTE: User-Agreement is part of the 'onboarding flow' now (See Welcome Pages).
             "FileLogger", #You want to be able to read the log if something goes wrong.
             "XmlMaterialProfile", #Cura crashes without this one.
             "Toolbox", #This contains the interface to enable/disable plug-ins, so if you disable it you can't enable it back.
@@ -528,6 +528,8 @@ class CuraApplication(QtApplication):
         preferences.addPreference("cura/expanded_brands", "")
         preferences.addPreference("cura/expanded_types", "")
 
+        preferences.addPreference("general/accepted_user_agreement", False)
+
         for key in [
             "dialog_load_path",  # dialog_save_path is in LocalFileOutputDevicePlugin
             "dialog_profile_path",

+ 0 - 47
plugins/UserAgreement/UserAgreement.py

@@ -1,47 +0,0 @@
-# Copyright (c) 2017 Ultimaker B.V.
-# Cura is released under the terms of the LGPLv3 or higher.
-
-import os
-
-from PyQt5.QtCore import QObject, pyqtSlot
-
-from UM.Extension import Extension
-from UM.Logger import Logger
-
-
-class UserAgreement(QObject, Extension):
-    def __init__(self, application):
-        super(UserAgreement, self).__init__()
-        self._application = application
-        self._user_agreement_window = None
-        self._user_agreement_context = None
-        self._application.engineCreatedSignal.connect(self._onEngineCreated)
-
-        self._application.getPreferences().addPreference("general/accepted_user_agreement", False)
-
-    def _onEngineCreated(self):
-        if not self._application.getPreferences().getValue("general/accepted_user_agreement"):
-            self.showUserAgreement()
-
-    def showUserAgreement(self):
-        # if not self._user_agreement_window:
-        #     self.createUserAgreementWindow()
-        #
-        # self._user_agreement_window.show()
-        pass
-
-    @pyqtSlot(bool)
-    def didAgree(self, user_choice):
-        if user_choice:
-            Logger.log("i", "User agreed to the user agreement")
-            self._application.getPreferences().setValue("general/accepted_user_agreement", True)
-            self._user_agreement_window.hide()
-        else:
-            Logger.log("i", "User did NOT agree to the user agreement")
-            self._application.getPreferences().setValue("general/accepted_user_agreement", False)
-            self._application.quit()
-        self._application.setNeedToShowUserAgreement(False)
-
-    def createUserAgreementWindow(self):
-        path = os.path.join(self._application.getPluginRegistry().getPluginPath(self.getPluginId()), "UserAgreement.qml")
-        self._user_agreement_window = self._application.createQmlComponent(path, {"manager": self})

+ 0 - 63
plugins/UserAgreement/UserAgreement.qml

@@ -1,63 +0,0 @@
-// Copyright (c) 2017 Ultimaker B.V.
-// Cura is released under the terms of the LGPLv3 or higher.
-
-import QtQuick 2.2
-import QtQuick.Controls 1.4
-
-import UM 1.3 as UM
-
-UM.Dialog
-{
-    id: baseDialog
-    minimumWidth: Math.round(UM.Theme.getSize("modal_window_minimum").width * 0.75)
-    minimumHeight: Math.round(UM.Theme.getSize("modal_window_minimum").height * 0.5)
-    width: minimumWidth
-    height: minimumHeight
-    title: catalog.i18nc("@title:window", "User Agreement")
-
-    TextArea
-    {
-        anchors.top: parent.top
-        width: parent.width
-        anchors.bottom: buttonRow.top
-        text: ' <center><h3>DISCLAIMER BY ULTIMAKER</h3></center>
-                <p>PLEASE READ THIS DISCLAIMER CAREFULLY.</p>
-                <p>EXCEPT WHEN OTHERWISE STATED IN WRITING, ULTIMAKER PROVIDES ANY ULTIMAKER SOFTWARE OR THIRD PARTY SOFTWARE “AS IS” WITHOUT WARRANTY OF ANY KIND. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF ULTIMAKER SOFTWARE IS WITH YOU.</p>
-                <p>UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, IN NO EVENT WILL ULTIMAKER BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE ANY ULTIMAKER SOFTWARE OR THIRD PARTY SOFTWARE.</p>
-                '
-        readOnly: true;
-        textFormat: TextEdit.RichText
-    }
-
-    Item
-    {
-        id: buttonRow
-        anchors.bottom: parent.bottom
-        width: parent.width
-        anchors.bottomMargin: UM.Theme.getSize("default_margin").height
-
-        UM.I18nCatalog { id: catalog; name: "cura" }
-
-        Button
-        {
-            anchors.right: parent.right
-            text: catalog.i18nc("@action:button", "I understand and agree")
-            onClicked: {
-                baseDialog.accepted()
-            }
-        }
-
-        Button
-        {
-            anchors.left: parent.left
-            text: catalog.i18nc("@action:button", "I don't agree")
-            onClicked: {
-                baseDialog.rejected()
-            }
-        }
-    }
-
-    onAccepted: manager.didAgree(true)
-    onRejected: manager.didAgree(false)
-    onClosing: manager.didAgree(false)
-}

+ 0 - 10
plugins/UserAgreement/__init__.py

@@ -1,10 +0,0 @@
-# Copyright (c) 2017 Ultimaker B.V.
-# Cura is released under the terms of the LGPLv3 or higher.
-
-from . import UserAgreement
-
-def getMetaData():
-    return {}
-
-def register(app):
-    return {"extension": UserAgreement.UserAgreement(app)}

+ 0 - 8
plugins/UserAgreement/plugin.json

@@ -1,8 +0,0 @@
-{
-    "name": "UserAgreement",
-    "author": "Ultimaker B.V.",
-    "version": "1.0.1",
-    "description": "Ask the user once if he/she agrees with our license.",
-    "api": "6.0",
-    "i18n-catalog": "cura"
-}

+ 0 - 17
resources/bundled_packages/cura.json

@@ -560,23 +560,6 @@
             }
         }
     },
-    "UserAgreement": {
-        "package_info": {
-            "package_id": "UserAgreement",
-            "package_type": "plugin",
-            "display_name": "User Agreement",
-            "description": "Ask the user once if he/she agrees with our license.",
-            "package_version": "1.0.1",
-            "sdk_version": "6.0",
-            "website": "https://ultimaker.com",
-            "author": {
-                "author_id": "UltimakerPackages",
-                "display_name": "Ultimaker B.V.",
-                "email": "plugins@ultimaker.com",
-                "website": "https://ultimaker.com"
-            }
-        }
-    },
     "VersionUpgrade21to22": {
         "package_info": {
             "package_id": "VersionUpgrade21to22",

+ 5 - 10
resources/qml/Cura.qml

@@ -90,6 +90,11 @@ UM.MainWindow
             welcomeDialog.currentStep = 0;
             welcomeDialog.show();
         }
+        else
+        {
+            welcomeDialog.hide()
+            welcomeDialog.visible = false;
+        }
     }
 
     Item
@@ -845,16 +850,6 @@ UM.MainWindow
             {
                 base.visible = true;
             }
-
-            // check later if the user agreement dialog has been closed
-            if (CuraApplication.needToShowUserAgreement)
-            {
-                restart();
-            }
-            else if(Cura.MachineManager.activeMachine == null)
-            {
-                addMachineDialog.open();
-            }
         }
     }