From 31e20e78b6a3f94db08cc1f1b0115ef80eccaa08 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 2 Apr 2019 07:14:26 +0000 Subject: [PATCH 01/18] Use GitLab CI --- .gitlab-ci.yml | 12 +++++++++++ CMakeLists.txt | 46 ++++++++++++++++++++++++++++++++----------- cmake/CuraTests.cmake | 24 ++++++++++++++++------ docker/build.sh | 41 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 105 insertions(+), 18 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100755 docker/build.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000..f4a4d0771a --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,12 @@ +image: registry.gitlab.com/ultimaker/cura/cura-build-environment:centos7 + +stages: + - build + +build-and-test: + stage: build + script: + - docker/build.sh + artifacts: + paths: + - build diff --git a/CMakeLists.txt b/CMakeLists.txt index be6c9d938e..8e9d4a843d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,11 +1,10 @@ -project(cura NONE) -cmake_minimum_required(VERSION 2.8.12) - -set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/ - ${CMAKE_MODULE_PATH}) +project(cura) +cmake_minimum_required(VERSION 3.6) include(GNUInstallDirs) +list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) + set(URANIUM_DIR "${CMAKE_SOURCE_DIR}/../Uranium" CACHE DIRECTORY "The location of the Uranium repository") set(URANIUM_SCRIPTS_DIR "${URANIUM_DIR}/scripts" CACHE DIRECTORY "The location of the scripts directory of the Uranium repository") @@ -28,6 +27,29 @@ set(CURA_CLOUD_API_VERSION "" CACHE STRING "Alternative Cura cloud API version") configure_file(${CMAKE_SOURCE_DIR}/cura.desktop.in ${CMAKE_BINARY_DIR}/cura.desktop @ONLY) configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY) + +# FIXME: Remove the code for CMake <3.12 once we have switched over completely. +# FindPython3 is a new module since CMake 3.12. It deprecates FindPythonInterp and FindPythonLibs. The FindPython3 +# module is copied from the CMake repository here so in CMake <3.12 we can still use it. +if(${CMAKE_VERSION} VERSION_LESS 3.12) + # Use FindPythonInterp and FindPythonLibs for CMake <3.12 + find_package(PythonInterp 3 REQUIRED) + find_package(PythonLibs 3 REQUIRED) + + set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) + set(Python3_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) + set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) + + set(Python3_VERSION ${PYTHON_VERSION_STRING}) + set(Python3_VERSION_MAJOR ${PYTHON_VERSION_MAJOR}) + set(Python3_VERSION_MINOR ${PYTHON_VERSION_MINOR}) + set(Python3_VERSION_PATCH ${PYTHON_VERSION_PATCH}) +else() + # Use FindPython3 for CMake >=3.12 + find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +endif() + + if(NOT ${URANIUM_DIR} STREQUAL "") set(CMAKE_MODULE_PATH "${URANIUM_DIR}/cmake") endif() @@ -40,12 +62,12 @@ if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "") CREATE_TRANSLATION_TARGETS() endif() -find_package(PythonInterp 3.5.0 REQUIRED) install(DIRECTORY resources DESTINATION ${CMAKE_INSTALL_DATADIR}/cura) install(DIRECTORY plugins DESTINATION lib${LIB_SUFFIX}/cura) + if(NOT APPLE AND NOT WIN32) install(FILES cura_app.py DESTINATION ${CMAKE_INSTALL_BINDIR} @@ -53,16 +75,16 @@ if(NOT APPLE AND NOT WIN32) RENAME cura) if(EXISTS /etc/debian_version) install(DIRECTORY cura - DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}/dist-packages + DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}/dist-packages FILES_MATCHING PATTERN *.py) install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py - DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}/dist-packages/cura) + DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}/dist-packages/cura) else() install(DIRECTORY cura - DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages + DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages FILES_MATCHING PATTERN *.py) install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py - DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/cura) + DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/cura) endif() install(FILES ${CMAKE_BINARY_DIR}/cura.desktop DESTINATION ${CMAKE_INSTALL_DATADIR}/applications) @@ -78,8 +100,8 @@ else() DESTINATION ${CMAKE_INSTALL_BINDIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) install(DIRECTORY cura - DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages + DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages FILES_MATCHING PATTERN *.py) install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.py - DESTINATION lib${LIB_SUFFIX}/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/cura) + DESTINATION lib${LIB_SUFFIX}/python${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}/site-packages/cura) endif() diff --git a/cmake/CuraTests.cmake b/cmake/CuraTests.cmake index b6d04de036..1a1a1c9f29 100644 --- a/cmake/CuraTests.cmake +++ b/cmake/CuraTests.cmake @@ -1,10 +1,22 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. -enable_testing() +include(CTest) include(CMakeParseArguments) -find_package(PythonInterp 3.5.0 REQUIRED) +# FIXME: Remove the code for CMake <3.12 once we have switched over completely. +# FindPython3 is a new module since CMake 3.12. It deprecates FindPythonInterp and FindPythonLibs. The FindPython3 +# module is copied from the CMake repository here so in CMake <3.12 we can still use it. +if(${CMAKE_VERSION} VERSION_LESS 3.12) + # Use FindPythonInterp and FindPythonLibs for CMake <3.12 + find_package(PythonInterp 3 REQUIRED) + find_package(PythonLibs 3 REQUIRED) + + set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) +else() + # Use FindPython3 for CMake >=3.12 + find_package(Python3 REQUIRED COMPONENTS Interpreter Development) +endif() add_custom_target(test-verbose COMMAND ${CMAKE_CTEST_COMMAND} --verbose) @@ -36,7 +48,7 @@ function(cura_add_test) if (NOT ${test_exists}) add_test( NAME ${_NAME} - COMMAND ${PYTHON_EXECUTABLE} -m pytest --verbose --full-trace --capture=no --no-print-log --junitxml=${CMAKE_BINARY_DIR}/junit-${_NAME}.xml ${_DIRECTORY} + COMMAND ${Python3_EXECUTABLE} -m pytest --verbose --full-trace --capture=no --no-print-log --junitxml=${CMAKE_BINARY_DIR}/junit-${_NAME}.xml ${_DIRECTORY} ) set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT LANG=C) set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT "PYTHONPATH=${_PYTHONPATH}") @@ -59,13 +71,13 @@ endforeach() #Add code style test. add_test( NAME "code-style" - COMMAND ${PYTHON_EXECUTABLE} run_mypy.py + COMMAND ${Python3_EXECUTABLE} run_mypy.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} ) #Add test for whether the shortcut alt-keys are unique in every translation. add_test( NAME "shortcut-keys" - COMMAND ${PYTHON_EXECUTABLE} scripts/check_shortcut_keys.py + COMMAND ${Python3_EXECUTABLE} scripts/check_shortcut_keys.py WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -) \ No newline at end of file +) diff --git a/docker/build.sh b/docker/build.sh new file mode 100755 index 0000000000..db895ce19b --- /dev/null +++ b/docker/build.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# Abort at the first error. +set -e + +SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" +PROJECT_DIR="$( cd "${SCRIPT_DIR}/.." && pwd )" + +# Make sure that environment variables are set properly +source /opt/rh/devtoolset-7/enable +export PATH="${CURA_BUILD_ENV_PATH}/bin:${PATH}" +export PKG_CONFIG_PATH="${CURA_BUILD_ENV_PATH}/lib/pkgconfig:${PKG_CONFIG_PATH}" + +cd "${PROJECT_DIR}" + +# +# Clone Uranium and set PYTHONPATH first +# + +# Check the branch to use: +# 1. Use the Uranium branch with the branch same if it exists. +# 2. Otherwise, use the default branch name "master" +URANIUM_BRANCH="${CI_COMMIT_REF_NAME:-master}" +output="$(git ls-remote --heads https://github.com/Ultimaker/Uranium.git "${URANIUM_BRANCH}")" +if [ -z "${output}" ]; then + URANIUM_BRANCH="master" +fi + +git clone --depth=1 -b "${URANIUM_BRANCH}" https://github.com/Ultimaker/Uranium.git "${PROJECT_DIR}"/Uranium +export PYTHONPATH="${PROJECT_DIR}/Uranium:.:${PYTHONPATH}" + +mkdir build +cd build +cmake3 \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_PREFIX_PATH="${CURA_BUILD_ENV_PATH}" \ + -DURANIUM_DIR="${PROJECT_DIR}/Uranium" \ + -DBUILD_TESTS=ON \ + .. +make +ctest3 --output-on-failure -T Test From dd19d7d1a9067f39989ab7fbb0d1efed9bed8504 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Tue, 2 Apr 2019 07:43:41 +0000 Subject: [PATCH 02/18] Fix typing --- plugins/GCodeReader/FlavorParser.py | 23 +++++++++++-------- .../PostProcessingPlugin.py | 2 +- .../src/Cloud/CloudOutputDevice.py | 11 +++++---- .../src/ClusterUM3OutputDevice.py | 9 ++++---- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/plugins/GCodeReader/FlavorParser.py b/plugins/GCodeReader/FlavorParser.py index f8618712a1..4c88e5c953 100644 --- a/plugins/GCodeReader/FlavorParser.py +++ b/plugins/GCodeReader/FlavorParser.py @@ -1,31 +1,33 @@ # Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. +import math +import re +from typing import Dict, List, NamedTuple, Optional, Union + +import numpy + from UM.Backend import Backend from UM.Job import Job from UM.Logger import Logger from UM.Math.Vector import Vector from UM.Message import Message -from cura.Scene.CuraSceneNode import CuraSceneNode from UM.i18n import i18nCatalog -catalog = i18nCatalog("cura") - from cura.CuraApplication import CuraApplication from cura.LayerDataBuilder import LayerDataBuilder from cura.LayerDataDecorator import LayerDataDecorator from cura.LayerPolygon import LayerPolygon +from cura.Scene.CuraSceneNode import CuraSceneNode from cura.Scene.GCodeListDecorator import GCodeListDecorator from cura.Settings.ExtruderManager import ExtruderManager -import numpy -import math -import re -from typing import Dict, List, NamedTuple, Optional, Union +catalog = i18nCatalog("cura") PositionOptional = NamedTuple("Position", [("x", Optional[float]), ("y", Optional[float]), ("z", Optional[float]), ("f", Optional[float]), ("e", Optional[float])]) Position = NamedTuple("Position", [("x", float), ("y", float), ("z", float), ("f", float), ("e", List[float])]) + ## This parser is intended to interpret the common firmware codes among all the # different flavors class FlavorParser: @@ -33,7 +35,7 @@ class FlavorParser: def __init__(self) -> None: CuraApplication.getInstance().hideMessageSignal.connect(self._onHideMessage) self._cancelled = False - self._message = None + self._message = None # type: Optional[Message] self._layer_number = 0 self._extruder_number = 0 self._clearValues() @@ -425,7 +427,8 @@ class FlavorParser: if line.startswith("M"): M = self._getInt(line, "M") - self.processMCode(M, line, current_position, current_path) + if M is not None: + self.processMCode(M, line, current_position, current_path) # "Flush" leftovers. Last layer paths are still stored if len(current_path) > 1: @@ -463,7 +466,7 @@ class FlavorParser: Logger.log("w", "File doesn't contain any valid layers") settings = CuraApplication.getInstance().getGlobalContainerStack() - if not settings.getProperty("machine_center_is_zero", "value"): + if settings is not None and not settings.getProperty("machine_center_is_zero", "value"): machine_width = settings.getProperty("machine_width", "value") machine_depth = settings.getProperty("machine_depth", "value") scene_node.setPosition(Vector(-machine_width / 2, 0, machine_depth / 2)) diff --git a/plugins/PostProcessingPlugin/PostProcessingPlugin.py b/plugins/PostProcessingPlugin/PostProcessingPlugin.py index 78f9cc0516..123733b863 100644 --- a/plugins/PostProcessingPlugin/PostProcessingPlugin.py +++ b/plugins/PostProcessingPlugin/PostProcessingPlugin.py @@ -162,7 +162,7 @@ class PostProcessingPlugin(QObject, Extension): loaded_script = importlib.util.module_from_spec(spec) if spec.loader is None: continue - spec.loader.exec_module(loaded_script) + spec.loader.exec_module(loaded_script) # type: ignore sys.modules[script_name] = loaded_script #TODO: This could be a security risk. Overwrite any module with a user-provided name? loaded_class = getattr(loaded_script, script_name) diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py index 0c044bbb56..5421de0f2f 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDevice.py @@ -85,10 +85,11 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice): # We use the Cura Connect monitor tab to get most functionality right away. if PluginRegistry.getInstance() is not None: - self._monitor_view_qml_path = os.path.join( - PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"), - "resources", "qml", "MonitorStage.qml" - ) + plugin_path = PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting") + if plugin_path is None: + Logger.log("e", "Cloud not find plugin path for plugin UM3NetworkPrnting") + raise RuntimeError("Cloud not find plugin path for plugin UM3NetworkPrnting") + self._monitor_view_qml_path = os.path.join(plugin_path, "resources", "qml", "MonitorStage.qml") # Trigger the printersChanged signal when the private signal is triggered. self.printersChanged.connect(self._clusterPrintersChanged) @@ -149,7 +150,7 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice): # the host name should then be "ultimakersystem-aabbccdd0011" if network_key.startswith(self.clusterData.host_name): return True - + # However, for manually added printers, the local IP address is used in lieu of a proper # network key, so check for that as well if self.clusterData.host_internal_ip is not None and network_key.find(self.clusterData.host_internal_ip): diff --git a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py index da63f11158..556ae5f61a 100644 --- a/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py +++ b/plugins/UM3NetworkPrinting/src/ClusterUM3OutputDevice.py @@ -66,10 +66,11 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice): self._received_print_jobs = False # type: bool if PluginRegistry.getInstance() is not None: - self._monitor_view_qml_path = os.path.join( - PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"), - "resources", "qml", "MonitorStage.qml" - ) + plugin_path = PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting") + if plugin_path is None: + Logger.log("e", "Cloud not find plugin path for plugin UM3NetworkPrnting") + raise RuntimeError("Cloud not find plugin path for plugin UM3NetworkPrnting") + self._monitor_view_qml_path = os.path.join(plugin_path, "resources", "qml", "MonitorStage.qml") # Trigger the printersChanged signal when the private signal is triggered self.printersChanged.connect(self._clusterPrintersChanged) From d57b2640d934908598a94c35bda1c1b8ecaa03ca Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 3 Apr 2019 08:26:37 +0000 Subject: [PATCH 03/18] Output Uranium branch in use --- docker/build.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/build.sh b/docker/build.sh index db895ce19b..eb20b18c0d 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -23,9 +23,11 @@ cd "${PROJECT_DIR}" URANIUM_BRANCH="${CI_COMMIT_REF_NAME:-master}" output="$(git ls-remote --heads https://github.com/Ultimaker/Uranium.git "${URANIUM_BRANCH}")" if [ -z "${output}" ]; then + echo "Could not find Uranium banch ${URANIUM_BRANCH}, fallback to use master." URANIUM_BRANCH="master" fi +echo "Using Uranium branch ${URANIUM_BRANCH} ..." git clone --depth=1 -b "${URANIUM_BRANCH}" https://github.com/Ultimaker/Uranium.git "${PROJECT_DIR}"/Uranium export PYTHONPATH="${PROJECT_DIR}/Uranium:.:${PYTHONPATH}" From fe21d67b8894ae2bb5e87bcc69698ccb81901b19 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 3 Apr 2019 08:35:11 +0000 Subject: [PATCH 04/18] Fix CI on hal9000 --- CMakeLists.txt | 3 --- cmake/CuraTests.cmake | 1 - 2 files changed, 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8e9d4a843d..ba427a745d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,11 +34,8 @@ configure_file(cura/CuraVersion.py.in CuraVersion.py @ONLY) if(${CMAKE_VERSION} VERSION_LESS 3.12) # Use FindPythonInterp and FindPythonLibs for CMake <3.12 find_package(PythonInterp 3 REQUIRED) - find_package(PythonLibs 3 REQUIRED) set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) - set(Python3_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) set(Python3_VERSION ${PYTHON_VERSION_STRING}) set(Python3_VERSION_MAJOR ${PYTHON_VERSION_MAJOR}) diff --git a/cmake/CuraTests.cmake b/cmake/CuraTests.cmake index 1a1a1c9f29..c0762e2b91 100644 --- a/cmake/CuraTests.cmake +++ b/cmake/CuraTests.cmake @@ -10,7 +10,6 @@ include(CMakeParseArguments) if(${CMAKE_VERSION} VERSION_LESS 3.12) # Use FindPythonInterp and FindPythonLibs for CMake <3.12 find_package(PythonInterp 3 REQUIRED) - find_package(PythonLibs 3 REQUIRED) set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE}) else() From 01c0fe1ffbb7ba5258324e54130154b8b88d40dc Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 10 Apr 2019 10:52:08 +0200 Subject: [PATCH 05/18] Fix update should show logic CURA-6447 --- cura/UI/WelcomePagesModel.py | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index b465e9f252..4663ebadc4 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -202,29 +202,31 @@ class WelcomePagesModel(ListModel): # FIXME: HACKs for optimization that we don't update the model every time the active machine gets changed. def _onActiveMachineChanged(self) -> None: self._application.getMachineManager().globalContainerChanged.disconnect(self._onActiveMachineChanged) - self.initialize() + self._initialize(update_should_show_flag = False) def initialize(self) -> None: self._application.getMachineManager().globalContainerChanged.connect(self._onActiveMachineChanged) self._initialize() - def _initialize(self) -> None: - has_active_machine = self._application.getMachineManager().activeMachine is not None - has_app_just_upgraded = self._application.hasJustUpgradedToNewVersion() + def _initialize(self, update_should_show_flag: bool = True) -> None: + show_whatsnew_only = False + if update_should_show_flag: + has_active_machine = self._application.getMachineManager().activeMachine is not None + has_app_just_upgraded = self._application.hasJustUpgradedToNewVersion() - # Only show the what's new dialog if there's no machine and we have just upgraded - show_complete_flow = not has_active_machine - show_whatsnew_only = has_active_machine and has_app_just_upgraded + # Only show the what's new dialog if there's no machine and we have just upgraded + show_complete_flow = not has_active_machine + show_whatsnew_only = has_active_machine and has_app_just_upgraded - # FIXME: This is a hack. Because of the circular dependency between MachineManager, ExtruderManager, and - # possibly some others, setting the initial active machine is not done when the MachineManager gets initialized. - # So at this point, we don't know if there will be an active machine or not. It could be that the active machine - # files are corrupted so we cannot rely on Preferences either. This makes sure that once the active machine - # gets changed, this model updates the flags, so it can decide whether to show the welcome flow or not. - should_show_welcome_flow = show_complete_flow or show_whatsnew_only - if should_show_welcome_flow != self._should_show_welcome_flow: - self._should_show_welcome_flow = should_show_welcome_flow - self.shouldShowWelcomeFlowChanged.emit() + # FIXME: This is a hack. Because of the circular dependency between MachineManager, ExtruderManager, and + # possibly some others, setting the initial active machine is not done when the MachineManager gets initialized. + # So at this point, we don't know if there will be an active machine or not. It could be that the active machine + # files are corrupted so we cannot rely on Preferences either. This makes sure that once the active machine + # gets changed, this model updates the flags, so it can decide whether to show the welcome flow or not. + should_show_welcome_flow = show_complete_flow or show_whatsnew_only + if should_show_welcome_flow != self._should_show_welcome_flow: + self._should_show_welcome_flow = should_show_welcome_flow + self.shouldShowWelcomeFlowChanged.emit() # All pages all_pages_list = [{"id": "welcome", From a32488895b8502671e3e380cb7af74f07735d6d0 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 11 Apr 2019 12:08:18 +0200 Subject: [PATCH 06/18] Add renderType to labels Otherwise it becomes unreadable on macOS. Contributes to CURA-6435. --- .../qml/WelcomePages/AddPrinterByIpContent.qml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 9376909070..6b1e759fe6 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -61,6 +61,7 @@ Item anchors.top: parent.top font: UM.Theme.getFont("default") + renderType: Text.NativeRendering text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.") } @@ -138,6 +139,7 @@ Item anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width font: UM.Theme.getFont("default") + renderType: Text.NativeRendering visible: { @@ -170,6 +172,7 @@ Item id: printerNameLabel anchors.top: parent.top font: UM.Theme.getFont("large") + renderType: Text.NativeRendering text: "???" } @@ -182,14 +185,14 @@ Item columns: 2 columnSpacing: UM.Theme.getSize("default_margin").width - Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Type") } - Label { id: typeText; font: UM.Theme.getFont("default"); text: "?" } + Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Type"); renderType: Text.NativeRendering } + Label { id: typeText; font: UM.Theme.getFont("default"); text: "?"; renderType: Text.NativeRendering } - Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Firmware version") } - Label { id: firmwareText; font: UM.Theme.getFont("default"); text: "0.0.0.0" } + Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Firmware version"); renderType: Text.NativeRendering } + Label { id: firmwareText; font: UM.Theme.getFont("default"); text: "0.0.0.0"; renderType: Text.NativeRendering } - Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Address") } - Label { id: addressText; font: UM.Theme.getFont("default"); text: "0.0.0.0" } + Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Address"); renderType: Text.NativeRendering } + Label { id: addressText; font: UM.Theme.getFont("default"); text: "0.0.0.0"; renderType: Text.NativeRendering } Connections { From aabcd71b727e912e38efc92a2061ff32e5b6852f Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Thu, 11 Apr 2019 14:17:10 +0200 Subject: [PATCH 07/18] Use the 'busy' property of the ActionButton Instead of creating a new BusyIndicator, use the existing one. Contributes to CURA-6435. --- resources/qml/WelcomePages/AddPrinterByIpContent.qml | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 6b1e759fe6..293b8c4e81 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -107,17 +107,7 @@ Item UM.OutputDeviceManager.addManualDevice(hostnameField.text, hostnameField.text); } } - - BusyIndicator - { - anchors.fill: parent - running: - { - ! parent.enabled && - ! addPrinterByIpScreen.hasSentRequest && - ! addPrinterByIpScreen.haveConnection - } - } + busy: !enabled && !addPrinterByIpScreen.hasSentRequest && !addPrinterByIpScreen.haveConnection Connections { From 6169d1ad5cef7e70f7121b033fb34559e39fcef6 Mon Sep 17 00:00:00 2001 From: Diego Prado Gesto Date: Fri, 12 Apr 2019 16:16:10 +0200 Subject: [PATCH 08/18] Change a label Contributes to CURA-6435. --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 2feff668e7..6f70830bee 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -200,7 +200,7 @@ Item Label { - text: catalog.i18nc("@label", "Printer Name") + text: catalog.i18nc("@label", "Printer name") anchors.verticalCenter: parent.verticalCenter font: UM.Theme.getFont("medium") verticalAlignment: Text.AlignVCenter From 325e60d8211959c5915980e4ade4b3311deb5cc7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 16 Apr 2019 15:28:32 +0200 Subject: [PATCH 09/18] Correct renamed welcome check function Contributes to issue CURA-6435. --- cura/UI/WelcomePagesModel.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/UI/WelcomePagesModel.py b/cura/UI/WelcomePagesModel.py index 4663ebadc4..10ae9dabf5 100644 --- a/cura/UI/WelcomePagesModel.py +++ b/cura/UI/WelcomePagesModel.py @@ -212,7 +212,7 @@ class WelcomePagesModel(ListModel): show_whatsnew_only = False if update_should_show_flag: has_active_machine = self._application.getMachineManager().activeMachine is not None - has_app_just_upgraded = self._application.hasJustUpgradedToNewVersion() + has_app_just_upgraded = self._application.hasJustUpdatedFromOldVersion() # Only show the what's new dialog if there's no machine and we have just upgraded show_complete_flow = not has_active_machine From 96e10ee00c74954c113d8de6b0c34c7ea419dbaf Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 17 Apr 2019 08:25:30 +0200 Subject: [PATCH 10/18] Add max length to machine name textbox CURA-6435 --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 6f70830bee..e0c1067602 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -213,6 +213,7 @@ Item anchors.verticalCenter: parent.verticalCenter width: (parent.width / 2) | 0 placeholderText: catalog.i18nc("@text", "Please give your printer a name") + maximumLength: 40 // Make sure that the fill is not empty validator: RegExpValidator { regExp: /.+/ } From 9b603d1f4b7c0bd78ce73386b7642786616f7777 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 17 Apr 2019 08:31:25 +0200 Subject: [PATCH 11/18] Use Cura.MachineNameValidator CURA-6435 --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index e0c1067602..d38cc5f777 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -214,9 +214,11 @@ Item width: (parent.width / 2) | 0 placeholderText: catalog.i18nc("@text", "Please give your printer a name") maximumLength: 40 - - // Make sure that the fill is not empty - validator: RegExpValidator { regExp: /.+/ } + validator: RegExpValidator + { + regExp: printerNameTextField.machineNameValidator.machineNameRegex + } + property var machineNameValidator: Cura.MachineNameValidator { } } } } From 904a8ab26cdde062007b7e00d75317f62bb60fe4 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Wed, 17 Apr 2019 08:41:13 +0200 Subject: [PATCH 12/18] Fix theming CURA-6435 --- .../MachineSettingsPrinterTab.qml | 2 + .../BedLevelMachineAction.qml | 7 ++- .../UM2UpgradeSelectionMachineAction.qml | 1 + .../UMOUpgradeSelectionMachineAction.qml | 1 + .../MachineSettings/ComboBoxWithOptions.qml | 1 + .../qml/MachineSettings/GcodeTextArea.qml | 6 ++- .../NumericTextFieldWithUnit.qml | 2 + .../qml/MachineSettings/SimpleCheckBox.qml | 1 + .../AddLocalPrinterScrollView.qml | 2 + .../WelcomePages/AddPrinterByIpContent.qml | 54 ++++++++++++++++--- resources/qml/WelcomePages/CloudContent.qml | 2 +- .../WelcomePages/DataCollectionsContent.qml | 1 + resources/qml/WelcomePages/DropDownHeader.qml | 2 +- .../qml/WelcomePages/UserAgreementContent.qml | 1 + resources/qml/WelcomePages/WelcomeContent.qml | 1 + resources/qml/Widgets/CheckBox.qml | 1 + resources/qml/Widgets/RadioButton.qml | 1 + resources/qml/Widgets/ScrollableTextArea.qml | 2 + resources/qml/Widgets/TextField.qml | 3 ++ 19 files changed, 81 insertions(+), 10 deletions(-) diff --git a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml index 3287643286..007db41f2b 100644 --- a/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml +++ b/plugins/MachineSettingsAction/MachineSettingsPrinterTab.qml @@ -57,6 +57,7 @@ Item { text: catalog.i18nc("@title:label", "Printer Settings") font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } @@ -172,6 +173,7 @@ Item { text: catalog.i18nc("@title:label", "Printhead Settings") font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } diff --git a/plugins/UltimakerMachineActions/BedLevelMachineAction.qml b/plugins/UltimakerMachineActions/BedLevelMachineAction.qml index dac545990f..a9f7e93d44 100644 --- a/plugins/UltimakerMachineActions/BedLevelMachineAction.qml +++ b/plugins/UltimakerMachineActions/BedLevelMachineAction.qml @@ -29,7 +29,8 @@ Cura.MachineAction width: parent.width text: catalog.i18nc("@title", "Build Plate Leveling") wrapMode: Text.WordWrap - font.pointSize: 18 + font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } @@ -41,6 +42,8 @@ Cura.MachineAction width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label", "To make sure your prints will come out great, you can now adjust your buildplate. When you click 'Move to Next Position' the nozzle will move to the different positions that can be adjusted.") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } @@ -52,6 +55,8 @@ Cura.MachineAction width: parent.width wrapMode: Text.WordWrap text: catalog.i18nc("@label", "For every position; insert a piece of paper under the nozzle and adjust the print build plate height. The print build plate height is right when the paper is slightly gripped by the tip of the nozzle.") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } diff --git a/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml b/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml index 0aef5e08e1..13525f6eb3 100644 --- a/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml +++ b/plugins/UltimakerMachineActions/UM2UpgradeSelectionMachineAction.qml @@ -29,6 +29,7 @@ Cura.MachineAction wrapMode: Text.WordWrap text: catalog.i18nc("@label", "Please select any upgrades made to this Ultimaker 2.") font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } diff --git a/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml b/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml index b0abad0fcf..565ba2fa0e 100644 --- a/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml +++ b/plugins/UltimakerMachineActions/UMOUpgradeSelectionMachineAction.qml @@ -29,6 +29,7 @@ Cura.MachineAction wrapMode: Text.WordWrap text: catalog.i18nc("@label","Please select any upgrades made to this Ultimaker Original") font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } diff --git a/resources/qml/MachineSettings/ComboBoxWithOptions.qml b/resources/qml/MachineSettings/ComboBoxWithOptions.qml index bf56d1d58e..fbb05c23b1 100644 --- a/resources/qml/MachineSettings/ComboBoxWithOptions.qml +++ b/resources/qml/MachineSettings/ComboBoxWithOptions.qml @@ -59,6 +59,7 @@ UM.TooltipArea anchors.verticalCenter: comboBox.verticalCenter visible: text != "" font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } diff --git a/resources/qml/MachineSettings/GcodeTextArea.qml b/resources/qml/MachineSettings/GcodeTextArea.qml index eb20cdc856..d1f8f51f01 100644 --- a/resources/qml/MachineSettings/GcodeTextArea.qml +++ b/resources/qml/MachineSettings/GcodeTextArea.qml @@ -41,6 +41,7 @@ UM.TooltipArea anchors.top: parent.top anchors.left: parent.left font: UM.Theme.getFont("medium_bold") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } @@ -59,13 +60,16 @@ UM.TooltipArea hoverEnabled: true selectByMouse: true + text: (propertyProvider.properties.value) ? propertyProvider.properties.value : "" font: UM.Theme.getFont("fixed") renderType: Text.NativeRendering - text: (propertyProvider.properties.value) ? propertyProvider.properties.value : "" + color: UM.Theme.getColor("text") wrapMode: TextEdit.NoWrap background: Rectangle { + color: UM.Theme.getColor("main_background") + border.color: { if (!gcodeTextArea.enabled) diff --git a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml index c6872617bc..5921a39933 100644 --- a/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml +++ b/resources/qml/MachineSettings/NumericTextFieldWithUnit.qml @@ -66,6 +66,7 @@ UM.TooltipArea anchors.verticalCenter: textFieldWithUnit.verticalCenter visible: text != "" font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } @@ -135,6 +136,7 @@ UM.TooltipArea hoverEnabled: true selectByMouse: true font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering // When the textbox gets focused by TAB, select all text diff --git a/resources/qml/MachineSettings/SimpleCheckBox.qml b/resources/qml/MachineSettings/SimpleCheckBox.qml index d2edc28487..49ff9fd6e9 100644 --- a/resources/qml/MachineSettings/SimpleCheckBox.qml +++ b/resources/qml/MachineSettings/SimpleCheckBox.qml @@ -53,6 +53,7 @@ UM.TooltipArea anchors.verticalCenter: checkBox.verticalCenter visible: text != "" font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index d38cc5f777..6f991ea0b3 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -142,6 +142,7 @@ Item verticalAlignment: Text.AlignVCenter text: button.text font: UM.Theme.getFont("default_bold") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } } @@ -203,6 +204,7 @@ Item text: catalog.i18nc("@label", "Printer name") anchors.verticalCenter: parent.verticalCenter font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") verticalAlignment: Text.AlignVCenter renderType: Text.NativeRendering } diff --git a/resources/qml/WelcomePages/AddPrinterByIpContent.qml b/resources/qml/WelcomePages/AddPrinterByIpContent.qml index 293b8c4e81..f1b315697a 100644 --- a/resources/qml/WelcomePages/AddPrinterByIpContent.qml +++ b/resources/qml/WelcomePages/AddPrinterByIpContent.qml @@ -61,6 +61,7 @@ Item anchors.top: parent.top font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.") } @@ -129,6 +130,7 @@ Item anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering visible: @@ -162,6 +164,7 @@ Item id: printerNameLabel anchors.top: parent.top font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering text: "???" @@ -175,14 +178,53 @@ Item columns: 2 columnSpacing: UM.Theme.getSize("default_margin").width - Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Type"); renderType: Text.NativeRendering } - Label { id: typeText; font: UM.Theme.getFont("default"); text: "?"; renderType: Text.NativeRendering } + Label + { + text: catalog.i18nc("@label", "Type") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } + Label + { + id: typeText + text: "?" + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } - Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Firmware version"); renderType: Text.NativeRendering } - Label { id: firmwareText; font: UM.Theme.getFont("default"); text: "0.0.0.0"; renderType: Text.NativeRendering } + Label + { + text: catalog.i18nc("@label", "Firmware version") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } + Label + { + id: firmwareText + text: "0.0.0.0" + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } - Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Address"); renderType: Text.NativeRendering } - Label { id: addressText; font: UM.Theme.getFont("default"); text: "0.0.0.0"; renderType: Text.NativeRendering } + Label + { + text: catalog.i18nc("@label", "Address") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } + Label + { + id: addressText + text: "0.0.0.0" + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + renderType: Text.NativeRendering + } Connections { diff --git a/resources/qml/WelcomePages/CloudContent.qml b/resources/qml/WelcomePages/CloudContent.qml index 6074c06eac..bb1498ebd5 100644 --- a/resources/qml/WelcomePages/CloudContent.qml +++ b/resources/qml/WelcomePages/CloudContent.qml @@ -52,7 +52,6 @@ Item topMargin: UM.Theme.getSize("default_margin").height } - // Pictures and texts are arranged using Columns with spacing. The whole picture and text area is centered in // the cloud contents area. Column @@ -105,6 +104,7 @@ Item } textFormat: Text.RichText font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } } diff --git a/resources/qml/WelcomePages/DataCollectionsContent.qml b/resources/qml/WelcomePages/DataCollectionsContent.qml index 610ce889d6..a2e54c1849 100644 --- a/resources/qml/WelcomePages/DataCollectionsContent.qml +++ b/resources/qml/WelcomePages/DataCollectionsContent.qml @@ -71,6 +71,7 @@ Item textFormat: Text.RichText wrapMode: Text.WordWrap font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering MouseArea diff --git a/resources/qml/WelcomePages/DropDownHeader.qml b/resources/qml/WelcomePages/DropDownHeader.qml index a712382850..88da32c879 100644 --- a/resources/qml/WelcomePages/DropDownHeader.qml +++ b/resources/qml/WelcomePages/DropDownHeader.qml @@ -21,7 +21,7 @@ Cura.RoundedRectangle border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") - color: hovered ? UM.Theme.getColor("secondary_button_hover") : UM.Theme.getColor("secondary_button") + color: UM.Theme.getColor("secondary") radius: UM.Theme.getSize("default_radius").width cornerSide: contentShown ? Cura.RoundedRectangle.Direction.Up : Cura.RoundedRectangle.Direction.All diff --git a/resources/qml/WelcomePages/UserAgreementContent.qml b/resources/qml/WelcomePages/UserAgreementContent.qml index 2c8196f0e1..c6fb03ccd4 100644 --- a/resources/qml/WelcomePages/UserAgreementContent.qml +++ b/resources/qml/WelcomePages/UserAgreementContent.qml @@ -44,6 +44,7 @@ Item textFormat: Text.RichText wrapMode: Text.WordWrap font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } diff --git a/resources/qml/WelcomePages/WelcomeContent.qml b/resources/qml/WelcomePages/WelcomeContent.qml index b59c91a0b7..0099c3db3d 100644 --- a/resources/qml/WelcomePages/WelcomeContent.qml +++ b/resources/qml/WelcomePages/WelcomeContent.qml @@ -46,6 +46,7 @@ Item horizontalAlignment: Text.AlignHCenter text: catalog.i18nc("@text", "Please follow these steps to set up\nUltimaker Cura. This will only take a few moments.") font: UM.Theme.getFont("medium") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } diff --git a/resources/qml/Widgets/CheckBox.qml b/resources/qml/Widgets/CheckBox.qml index c7536da6d3..1de0e4addd 100644 --- a/resources/qml/Widgets/CheckBox.qml +++ b/resources/qml/Widgets/CheckBox.qml @@ -70,6 +70,7 @@ CheckBox leftPadding: control.indicator.width + control.spacing text: control.text font: control.font + color: UM.Theme.getColor("text") renderType: Text.NativeRendering verticalAlignment: Text.AlignVCenter } diff --git a/resources/qml/Widgets/RadioButton.qml b/resources/qml/Widgets/RadioButton.qml index b101b3739b..13aee7ba90 100644 --- a/resources/qml/Widgets/RadioButton.qml +++ b/resources/qml/Widgets/RadioButton.qml @@ -49,6 +49,7 @@ RadioButton leftPadding: radioButton.indicator.width + radioButton.spacing text: radioButton.text font: radioButton.font + color: UM.Theme.getColor("text") renderType: Text.NativeRendering } } diff --git a/resources/qml/Widgets/ScrollableTextArea.qml b/resources/qml/Widgets/ScrollableTextArea.qml index 249eca5bd6..b806087f9a 100644 --- a/resources/qml/Widgets/ScrollableTextArea.qml +++ b/resources/qml/Widgets/ScrollableTextArea.qml @@ -19,6 +19,7 @@ ScrollView background: Rectangle // Border { + color: UM.Theme.getColor("main_background") border.color: UM.Theme.getColor("lining") border.width: UM.Theme.getSize("default_lining").width } @@ -27,6 +28,7 @@ ScrollView { id: _textArea font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") textFormat: TextEdit.PlainText renderType: Text.NativeRendering selectByMouse: true diff --git a/resources/qml/Widgets/TextField.qml b/resources/qml/Widgets/TextField.qml index c15d3d0c2d..28074d4415 100644 --- a/resources/qml/Widgets/TextField.qml +++ b/resources/qml/Widgets/TextField.qml @@ -20,6 +20,7 @@ TextField hoverEnabled: true selectByMouse: true font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") renderType: Text.NativeRendering states: [ @@ -49,6 +50,8 @@ TextField { id: backgroundRectangle + color: UM.Theme.getColor("main_background") + anchors.margins: Math.round(UM.Theme.getSize("default_lining").width) radius: UM.Theme.getSize("setting_control_radius").width From 5c28de05e1d536f876e7f3d6b00578bbbfe715aa Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 17 Apr 2019 16:40:05 +0200 Subject: [PATCH 13/18] Workaround for ListView-cache-bug in Qt. [CURA-6435] --- resources/qml/WelcomePages/AddLocalPrinterScrollView.qml | 2 ++ resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml index 6f991ea0b3..cb0bad67ea 100644 --- a/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddLocalPrinterScrollView.qml @@ -85,6 +85,8 @@ Item { id: machineList + cacheBuffer: 0 // Workaround for https://bugreports.qt.io/browse/QTBUG-49224 + model: UM.DefinitionContainersModel { id: machineDefinitionsModel diff --git a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml index 884bd0a70e..117f8a59d7 100644 --- a/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml +++ b/resources/qml/WelcomePages/AddNetworkPrinterScrollView.qml @@ -72,6 +72,8 @@ Item section.criteria: ViewSection.FullString section.delegate: sectionHeading + cacheBuffer: 0 // Workaround for https://bugreports.qt.io/browse/QTBUG-49224 + Component.onCompleted: { // Select the first one that's not "unknown" by default. From 36cefcf0a313bc0db207539ff9b29d1aef03446a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 17 Apr 2019 17:10:25 +0200 Subject: [PATCH 14/18] Give more verbose output if a test failed (or succeeded) We want to know what exactly failed. Contributes to issue CURA-6188. --- docker/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/build.sh b/docker/build.sh index eb20b18c0d..88fec8b869 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -40,4 +40,4 @@ cmake3 \ -DBUILD_TESTS=ON \ .. make -ctest3 --output-on-failure -T Test +ctest3 --verbose --output-on-failure -T Test From bcfb2c02e50edac71f9077b71af3cff9af31866a Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 17 Apr 2019 17:45:11 +0200 Subject: [PATCH 15/18] Fix dark-theme and arrow for add-printer-dialog. [CURA-6435] --- resources/themes/cura-dark/theme.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/themes/cura-dark/theme.json b/resources/themes/cura-dark/theme.json index a5e35e1c02..84f06bee0e 100644 --- a/resources/themes/cura-dark/theme.json +++ b/resources/themes/cura-dark/theme.json @@ -94,8 +94,8 @@ "action_button_active": [39, 44, 48, 30], "action_button_active_text": [255, 255, 255, 255], "action_button_active_border": [255, 255, 255, 100], - "action_button_disabled": [39, 44, 48, 255], - "action_button_disabled_text": [255, 255, 255, 80], + "action_button_disabled": [19, 24, 28, 255], + "action_button_disabled_text": [200, 200, 200, 80], "action_button_disabled_border": [255, 255, 255, 30], "scrollbar_background": [39, 44, 48, 0], From b5d4ef61f5aee9a84e1973b7e295eae5a4a77645 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 17 Apr 2019 18:10:26 +0200 Subject: [PATCH 16/18] Add cancel-button and fix window-size (add printer). [CURA-6435] --- resources/qml/Cura.qml | 2 ++ resources/qml/WelcomePages/DropDownWidget.qml | 2 +- resources/qml/WelcomePages/WizardDialog.qml | 19 +++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index f5cbe8ad53..e640b25b24 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -794,6 +794,7 @@ UM.MainWindow title: catalog.i18nc("@title:window", "Add Printer") model: CuraApplication.getAddPrinterPagesModel() progressBarVisible: false + hasCancelButton: true } Cura.WizardDialog @@ -802,6 +803,7 @@ UM.MainWindow title: catalog.i18nc("@title:window", "What's New") model: CuraApplication.getWhatsNewPagesModel() progressBarVisible: false + hasCancelButton: false } Connections diff --git a/resources/qml/WelcomePages/DropDownWidget.qml b/resources/qml/WelcomePages/DropDownWidget.qml index 7251e8c520..a54424b7cf 100644 --- a/resources/qml/WelcomePages/DropDownWidget.qml +++ b/resources/qml/WelcomePages/DropDownWidget.qml @@ -49,7 +49,7 @@ Item anchors.left: parent.left anchors.right: parent.right height: UM.Theme.getSize("expandable_component_content_header").height - rightIconSource: contentShown ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_right") + rightIconSource: contentShown ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left") contentShown: base.contentShown } diff --git a/resources/qml/WelcomePages/WizardDialog.qml b/resources/qml/WelcomePages/WizardDialog.qml index 4a0867c9a2..31240b1ef5 100644 --- a/resources/qml/WelcomePages/WizardDialog.qml +++ b/resources/qml/WelcomePages/WizardDialog.qml @@ -24,11 +24,14 @@ Window minimumWidth: 580 * screenScaleFactor minimumHeight: 600 * screenScaleFactor + maximumWidth: minimumWidth + maximumHeight: minimumHeight color: UM.Theme.getColor("main_background") property var model: null // Needs to be set by whoever is using this dialog. property alias progressBarVisible: wizardPanel.progressBarVisible + property alias hasCancelButton: cancelButton.visible onVisibilityChanged: { @@ -51,4 +54,20 @@ Window target: model onAllFinished: dialog.hide() } + + Cura.SecondaryButton + { + id: cancelButton + + text: catalog.i18nc("@button", "Cancel") + + visible: false + + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.margins: UM.Theme.getSize("default_margin").width + + enabled: true + onClicked: dialog.visible = false + } } From 56cec02d4494627696ccb87ce9fcd24df9ae489b Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 18 Apr 2019 07:38:00 +0200 Subject: [PATCH 17/18] Fix tests --- tests/Machines/Models/TestDiscoveredPrintersModel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Machines/Models/TestDiscoveredPrintersModel.py b/tests/Machines/Models/TestDiscoveredPrintersModel.py index 4ccc3ba523..28be2536a0 100644 --- a/tests/Machines/Models/TestDiscoveredPrintersModel.py +++ b/tests/Machines/Models/TestDiscoveredPrintersModel.py @@ -1,4 +1,4 @@ -from unittest.mock import MagicMock +from unittest.mock import MagicMock, PropertyMock import pytest @@ -12,6 +12,8 @@ def discovered_printer_model(application) -> DiscoveredPrintersModel: def test_discoveredPrinters(discovered_printer_model): mocked_device = MagicMock() + cluster_size = PropertyMock(return_value = 1) + type(mocked_device).clusterSize = cluster_size mocked_callback = MagicMock() discovered_printer_model.addDiscoveredPrinter("ip", "key", "name", mocked_callback, "machine_type", mocked_device) From 98c4b7508f6b9b9f5774b40e975b2fac45a77a82 Mon Sep 17 00:00:00 2001 From: Lipu Fei Date: Thu, 18 Apr 2019 06:18:11 +0000 Subject: [PATCH 18/18] Fix typing --- plugins/UFPReader/UFPReader.py | 4 ++-- .../UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/UFPReader/UFPReader.py b/plugins/UFPReader/UFPReader.py index 275726b25b..18527e6450 100644 --- a/plugins/UFPReader/UFPReader.py +++ b/plugins/UFPReader/UFPReader.py @@ -38,5 +38,5 @@ class UFPReader(MeshReader): # Open the GCodeReader to parse the data gcode_reader = PluginRegistry.getInstance().getPluginObject("GCodeReader") # type: ignore - gcode_reader.preReadFromStream(gcode_stream) - return gcode_reader.readFromStream(gcode_stream) + gcode_reader.preReadFromStream(gcode_stream) # type: ignore + return gcode_reader.readFromStream(gcode_stream) # type: ignore diff --git a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py index 680caa568a..67245eb357 100644 --- a/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py +++ b/plugins/UM3NetworkPrinting/src/Cloud/CloudOutputDeviceManager.py @@ -32,8 +32,8 @@ class CloudOutputDeviceManager: # The translation catalog for this device. I18N_CATALOG = i18nCatalog("cura") - addedCloudCluster = Signal(CloudOutputDevice) - removedCloudCluster = Signal(CloudOutputDevice) + addedCloudCluster = Signal() + removedCloudCluster = Signal() def __init__(self) -> None: # Persistent dict containing the remote clusters for the authenticated user.