diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 58fc9fc394..e8d3556d71 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -839,7 +839,6 @@ class CuraApplication(QtApplication): if diagonal < 1: #No printer added yet. Set a default camera distance for normal-sized printers. diagonal = 375 camera.setPosition(Vector(-80, 250, 700) * diagonal / 375) - camera.setPerspective(True) camera.lookAt(Vector(0, 0, 0)) controller.getScene().setActiveCamera("3d") diff --git a/resources/qml/Actions.qml b/resources/qml/Actions.qml index ce9618a560..71a655c664 100644 --- a/resources/qml/Actions.qml +++ b/resources/qml/Actions.qml @@ -101,7 +101,7 @@ Item Action { id: redoAction; - text: catalog.i18nc("@action:inmenu menubar:edit","&Redo"); + text: catalog.i18nc("@action:inmenu menubar:edit", "&Redo"); iconName: "edit-redo"; shortcut: StandardKey.Redo; onTriggered: UM.OperationStack.redo(); @@ -110,65 +110,65 @@ Item Action { - id: quitAction; - text: catalog.i18nc("@action:inmenu menubar:file","&Quit"); - iconName: "application-exit"; - shortcut: StandardKey.Quit; + id: quitAction + text: catalog.i18nc("@action:inmenu menubar:file","&Quit") + iconName: "application-exit" + shortcut: StandardKey.Quit } Action { - id: view3DCameraAction; - text: catalog.i18nc("@action:inmenu menubar:view","3D View"); - onTriggered: UM.Controller.rotateView("3d", 0); + id: view3DCameraAction + text: catalog.i18nc("@action:inmenu menubar:view", "3D View") + onTriggered: UM.Controller.setCameraRotation("3d", 0) } Action { - id: viewFrontCameraAction; - text: catalog.i18nc("@action:inmenu menubar:view","Front View"); - onTriggered: UM.Controller.rotateView("home", 0); + id: viewFrontCameraAction + text: catalog.i18nc("@action:inmenu menubar:view", "Front View") + onTriggered: UM.Controller.setCameraRotation("home", 0) } Action { - id: viewTopCameraAction; - text: catalog.i18nc("@action:inmenu menubar:view","Top View"); - onTriggered: UM.Controller.rotateView("y", 90); + id: viewTopCameraAction + text: catalog.i18nc("@action:inmenu menubar:view", "Top View") + onTriggered: UM.Controller.setCameraRotation("y", 90) } Action { - id: viewLeftSideCameraAction; - text: catalog.i18nc("@action:inmenu menubar:view","Left Side View"); - onTriggered: UM.Controller.rotateView("x", 90); + id: viewLeftSideCameraAction + text: catalog.i18nc("@action:inmenu menubar:view", "Left Side View") + onTriggered: UM.Controller.setCameraRotation("x", 90) } Action { - id: viewRightSideCameraAction; - text: catalog.i18nc("@action:inmenu menubar:view","Right Side View"); - onTriggered: UM.Controller.rotateView("x", -90); + id: viewRightSideCameraAction + text: catalog.i18nc("@action:inmenu menubar:view", "Right Side View") + onTriggered: UM.Controller.setCameraRotation("x", -90) } Action { - id: preferencesAction; - text: catalog.i18nc("@action:inmenu","Configure Cura..."); - iconName: "configure"; + id: preferencesAction + text: catalog.i18nc("@action:inmenu", "Configure Cura...") + iconName: "configure" } Action { - id: addMachineAction; - text: catalog.i18nc("@action:inmenu menubar:printer","&Add Printer..."); + id: addMachineAction + text: catalog.i18nc("@action:inmenu menubar:printer", "&Add Printer...") } Action { - id: settingsAction; - text: catalog.i18nc("@action:inmenu menubar:printer","Manage Pr&inters..."); - iconName: "configure"; + id: settingsAction + text: catalog.i18nc("@action:inmenu menubar:printer", "Manage Pr&inters...") + iconName: "configure" } Action diff --git a/resources/qml/Preferences/GeneralPage.qml b/resources/qml/Preferences/GeneralPage.qml index 47cc11632c..dd6004eae0 100644 --- a/resources/qml/Preferences/GeneralPage.qml +++ b/resources/qml/Preferences/GeneralPage.qml @@ -95,6 +95,10 @@ UM.PreferencesPage UM.Preferences.resetPreference("view/top_layer_count"); topLayerCountCheckbox.checked = boolCheck(UM.Preferences.getValue("view/top_layer_count")) + UM.Preferences.resetPreference("general/camera_perspective_mode") + var defaultCameraMode = UM.Preferences.getValue("general/camera_perspective_mode") + setDefaultCameraMode(defaultCameraMode) + UM.Preferences.resetPreference("cura/choice_on_profile_override") setDefaultDiscardOrKeepProfile(UM.Preferences.getValue("cura/choice_on_profile_override")) @@ -330,7 +334,8 @@ UM.PreferencesPage } } - UM.TooltipArea { + UM.TooltipArea + { width: childrenRect.width; height: childrenRect.height; text: catalog.i18nc("@info:tooltip", "Moves the camera so the model is in the center of the view when a model is selected") @@ -344,7 +349,8 @@ UM.PreferencesPage } } - UM.TooltipArea { + UM.TooltipArea + { width: childrenRect.width; height: childrenRect.height; text: catalog.i18nc("@info:tooltip", "Should the default zoom behavior of cura be inverted?") @@ -436,6 +442,50 @@ UM.PreferencesPage } } + UM.TooltipArea + { + width: childrenRect.width + height: childrenRect.height + text: catalog.i18nc("@info:tooltip", "What type of camera rendering should be used?") + Column + { + spacing: 4 * screenScaleFactor + + Label + { + text: catalog.i18nc("@window:text", "Camera rendering: ") + } + ComboBox + { + id: cameraComboBox + + model: ListModel + { + id: comboBoxList + + Component.onCompleted: { + append({ text: catalog.i18n("Perspective"), code: "perspective" }) + append({ text: catalog.i18n("Orthogonal"), code: "orthogonal" }) + } + } + + currentIndex: + { + var code = UM.Preferences.getValue("general/camera_perspective_mode"); + for(var i = 0; i < comboBoxList.count; ++i) + { + if(model.get(i).code == code) + { + return i + } + } + return 0 + } + onActivated: UM.Preferences.setValue("general/camera_perspective_mode", model.get(index).code) + } + } + } + Item { //: Spacer diff --git a/resources/qml/ViewOrientationControls.qml b/resources/qml/ViewOrientationControls.qml index 51ed6e3dcb..5750e935f4 100644 --- a/resources/qml/ViewOrientationControls.qml +++ b/resources/qml/ViewOrientationControls.qml @@ -6,7 +6,7 @@ import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 import UM 1.4 as UM - +import Cura 1.1 as Cura // A row of buttons that control the view direction Row { @@ -19,30 +19,30 @@ Row ViewOrientationButton { iconSource: UM.Theme.getIcon("view_3d") - onClicked: UM.Controller.rotateView("3d", 0) + onClicked: Cura.Actions.view3DCamera.trigger() } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_front") - onClicked: UM.Controller.rotateView("home", 0) + onClicked: Cura.Actions.viewFrontCamera.trigger() } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_top") - onClicked: UM.Controller.rotateView("y", 90) + onClicked: Cura.Actions.viewTopCamera.trigger() } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_left") - onClicked: UM.Controller.rotateView("x", 90) + onClicked: Cura.Actions.viewLeftSideCamera.trigger() } ViewOrientationButton { iconSource: UM.Theme.getIcon("view_right") - onClicked: UM.Controller.rotateView("x", -90) + onClicked: Cura.Actions.viewRightSideCamera.trigger() } } diff --git a/tests/TestOAuth2.py b/tests/TestOAuth2.py index fa0639e65a..358ed5afbb 100644 --- a/tests/TestOAuth2.py +++ b/tests/TestOAuth2.py @@ -101,7 +101,7 @@ def test_initialize(): initialize_preferences = MagicMock() authorization_service = AuthorizationService(OAUTH_SETTINGS, original_preference) authorization_service.initialize(initialize_preferences) - assert initialize_preferences.addPreference.called + initialize_preferences.addPreference.assert_called_once_with("test/auth_data", "{}") original_preference.addPreference.assert_not_called()