Browse Source

Remove hard-coded account URLs in QMLs

CURA-6117
Lipu Fei 6 years ago
parent
commit
3b3baeac03

+ 9 - 11
cura/CuraApplication.py

@@ -117,7 +117,7 @@ from cura.ObjectsModel import ObjectsModel
 from cura.PrinterOutputDevice import PrinterOutputDevice
 from cura.PrinterOutput.NetworkMJPGImage import NetworkMJPGImage
 
-from cura import ApplicationMetadata
+from cura import ApplicationMetadata, UltimakerCloudAuthentication
 
 from UM.FlameProfiler import pyqtSlot
 from UM.Decorators import override
@@ -132,16 +132,6 @@ if TYPE_CHECKING:
 numpy.seterr(all = "ignore")
 
 
-try:
-    from cura.CuraVersion import CuraAppDisplayName, CuraVersion, CuraBuildType, CuraDebugMode, CuraSDKVersion  # type: ignore
-except ImportError:
-    CuraAppDisplayName = "Ultimaker Cura"
-    CuraVersion = "master"  # [CodeStyle: Reflecting imported value]
-    CuraBuildType = ""
-    CuraDebugMode = False
-    CuraSDKVersion = "6.0.0"
-
-
 class CuraApplication(QtApplication):
     # SettingVersion represents the set of settings available in the machine/extruder definitions.
     # You need to make sure that this version number needs to be increased if there is any non-backwards-compatible
@@ -266,6 +256,14 @@ class CuraApplication(QtApplication):
         from cura.CuraPackageManager import CuraPackageManager
         self._package_manager_class = CuraPackageManager
 
+    @pyqtProperty(str, constant=True)
+    def ultimakerCloudApiRootUrl(self) -> str:
+        return UltimakerCloudAuthentication.CuraCloudAPIRoot
+
+    @pyqtProperty(str, constant = True)
+    def ultimakerCloudAccountRootUrl(self) -> str:
+        return UltimakerCloudAuthentication.CuraCloudAccountAPIRoot
+
     # Adds command line options to the command line parser. This should be called after the application is created and
     # before the pre-start.
     def addCommandLineOptions(self):

+ 1 - 1
resources/qml/Account/GeneralOperations.qml

@@ -16,7 +16,7 @@ Row
         width: UM.Theme.getSize("account_button").width
         height: UM.Theme.getSize("account_button").height
         text: catalog.i18nc("@button", "Create account")
-        onClicked: Qt.openUrlExternally("https://account.ultimaker.com/app/create")
+        onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl + "/app/create")
         fixedWidthMode: true
     }
 

+ 1 - 1
resources/qml/Account/UserOperations.qml

@@ -16,7 +16,7 @@ Row
         width: UM.Theme.getSize("account_button").width
         height: UM.Theme.getSize("account_button").height
         text: catalog.i18nc("@button", "Manage account")
-        onClicked: Qt.openUrlExternally("https://account.ultimaker.com")
+        onClicked: Qt.openUrlExternally(CuraApplication.ultimakerCloudAccountRootUrl)
         fixedWidthMode: true
     }