mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 23:15:52 +08:00
Merge branch '4.0' of github.com:Ultimaker/Cura
This commit is contained in:
commit
15563a756f
@ -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):
|
||||
|
@ -15,6 +15,9 @@ from ...src.Cloud.Models.CloudError import CloudError
|
||||
from .Fixtures import readFixture, parseFixture
|
||||
from .NetworkManagerMock import NetworkManagerMock
|
||||
|
||||
import pytest
|
||||
pytestmark = pytest.mark.skip("Tests failing due to incorrect paths in patch")
|
||||
|
||||
|
||||
class TestCloudApiClient(TestCase):
|
||||
maxDiff = None
|
||||
@ -28,7 +31,7 @@ class TestCloudApiClient(TestCase):
|
||||
self.account.isLoggedIn.return_value = True
|
||||
|
||||
self.network = NetworkManagerMock()
|
||||
with patch("plugins.UM3NetworkPrinting.src.Cloud.CloudApiClient.QNetworkAccessManager", return_value = self.network):
|
||||
with patch("CloudApiClient.QNetworkAccessManager", return_value = self.network):
|
||||
self.api = CloudApiClient(self.account, self._errorHandler)
|
||||
|
||||
def test_getClusters(self):
|
||||
|
@ -13,6 +13,9 @@ from ...src.Cloud.Models.CloudClusterResponse import CloudClusterResponse
|
||||
from .Fixtures import readFixture, parseFixture
|
||||
from .NetworkManagerMock import NetworkManagerMock
|
||||
|
||||
import pytest
|
||||
pytestmark = pytest.mark.skip("Tests failing due to incorrect paths in patch")
|
||||
|
||||
|
||||
class TestCloudOutputDevice(TestCase):
|
||||
maxDiff = None
|
||||
@ -41,7 +44,7 @@ class TestCloudOutputDevice(TestCase):
|
||||
self.network = NetworkManagerMock()
|
||||
self.account = MagicMock(isLoggedIn=True, accessToken="TestAccessToken")
|
||||
self.onError = MagicMock()
|
||||
with patch("plugins.UM3NetworkPrinting.src.Cloud.CloudApiClient.QNetworkAccessManager",
|
||||
with patch("CloudApiClient.QNetworkAccessManager",
|
||||
return_value = self.network):
|
||||
self._api = CloudApiClient(self.account, self.onError)
|
||||
|
||||
|
@ -9,6 +9,9 @@ from ...src.Cloud.CloudOutputDeviceManager import CloudOutputDeviceManager
|
||||
from .Fixtures import parseFixture, readFixture
|
||||
from .NetworkManagerMock import NetworkManagerMock, FakeSignal
|
||||
|
||||
import pytest
|
||||
pytestmark = pytest.mark.skip("Tests failing due to incorrect paths in patch")
|
||||
|
||||
|
||||
class TestCloudOutputDeviceManager(TestCase):
|
||||
maxDiff = None
|
||||
@ -28,10 +31,8 @@ class TestCloudOutputDeviceManager(TestCase):
|
||||
|
||||
self.network = NetworkManagerMock()
|
||||
self.timer = MagicMock(timeout = FakeSignal())
|
||||
with patch("plugins.UM3NetworkPrinting.src.Cloud.CloudApiClient.QNetworkAccessManager",
|
||||
return_value = self.network), \
|
||||
patch("plugins.UM3NetworkPrinting.src.Cloud.CloudOutputDeviceManager.QTimer",
|
||||
return_value = self.timer):
|
||||
with patch("CloudApiClient.QNetworkAccessManager", return_value = self.network), \
|
||||
patch("CloudOutputDeviceManager.QTimer", return_value = self.timer):
|
||||
self.manager = CloudOutputDeviceManager()
|
||||
self.clusters_response = parseFixture("getClusters")
|
||||
self.network.prepareReply("GET", self.URL, 200, readFixture("getClusters"))
|
||||
@ -114,7 +115,7 @@ class TestCloudOutputDeviceManager(TestCase):
|
||||
|
||||
active_machine_mock.setMetaDataEntry.assert_called_with("um_cloud_cluster_id", cluster2["cluster_id"])
|
||||
|
||||
@patch("plugins.UM3NetworkPrinting.src.Cloud.CloudOutputDeviceManager.Message")
|
||||
@patch("CloudOutputDeviceManager.Message")
|
||||
def test_api_error(self, message_mock):
|
||||
self.clusters_response = {
|
||||
"errors": [{"id": "notFound", "title": "Not found!", "http_status": "404", "code": "notFound"}]
|
||||
|
@ -1,7 +1,6 @@
|
||||
# Copyright (c) 2018 Ultimaker B.V.
|
||||
# Copyright (c) 2018 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
import copy
|
||||
import io
|
||||
import json
|
||||
from unittest import TestCase, mock
|
||||
@ -14,7 +13,7 @@ from UM.Application import Application
|
||||
from cura.Machines.MaterialGroup import MaterialGroup
|
||||
from cura.Machines.MaterialNode import MaterialNode
|
||||
|
||||
from plugins.UM3NetworkPrinting.src.SendMaterialJob import SendMaterialJob
|
||||
from ..src.SendMaterialJob import SendMaterialJob
|
||||
|
||||
_FILES_MAP = {"generic_pla_white": "/materials/generic_pla_white.xml.fdm_material",
|
||||
"generic_pla_black": "/materials/generic_pla_black.xml.fdm_material",
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user