mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 12:46:01 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
39072a1498
1
.gitignore
vendored
1
.gitignore
vendored
@ -71,3 +71,4 @@ run.sh
|
|||||||
.scannerwork/
|
.scannerwork/
|
||||||
CuraEngine
|
CuraEngine
|
||||||
|
|
||||||
|
/.coverage
|
||||||
|
12
.gitlab-ci.yml
Normal file
12
.gitlab-ci.yml
Normal file
@ -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
|
@ -1,11 +1,10 @@
|
|||||||
project(cura NONE)
|
project(cura)
|
||||||
cmake_minimum_required(VERSION 2.8.12)
|
cmake_minimum_required(VERSION 3.6)
|
||||||
|
|
||||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/
|
|
||||||
${CMAKE_MODULE_PATH})
|
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
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_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")
|
set(URANIUM_SCRIPTS_DIR "${URANIUM_DIR}/scripts" CACHE DIRECTORY "The location of the scripts directory of the Uranium repository")
|
||||||
|
|
||||||
@ -28,6 +27,26 @@ 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(${CMAKE_SOURCE_DIR}/cura.desktop.in ${CMAKE_BINARY_DIR}/cura.desktop @ONLY)
|
||||||
configure_file(cura/CuraVersion.py.in CuraVersion.py @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)
|
||||||
|
|
||||||
|
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||||
|
|
||||||
|
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 "")
|
if(NOT ${URANIUM_DIR} STREQUAL "")
|
||||||
set(CMAKE_MODULE_PATH "${URANIUM_DIR}/cmake")
|
set(CMAKE_MODULE_PATH "${URANIUM_DIR}/cmake")
|
||||||
endif()
|
endif()
|
||||||
@ -40,12 +59,12 @@ if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "")
|
|||||||
CREATE_TRANSLATION_TARGETS()
|
CREATE_TRANSLATION_TARGETS()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(PythonInterp 3.5.0 REQUIRED)
|
|
||||||
|
|
||||||
install(DIRECTORY resources
|
install(DIRECTORY resources
|
||||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/cura)
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/cura)
|
||||||
install(DIRECTORY plugins
|
install(DIRECTORY plugins
|
||||||
DESTINATION lib${LIB_SUFFIX}/cura)
|
DESTINATION lib${LIB_SUFFIX}/cura)
|
||||||
|
|
||||||
if(NOT APPLE AND NOT WIN32)
|
if(NOT APPLE AND NOT WIN32)
|
||||||
install(FILES cura_app.py
|
install(FILES cura_app.py
|
||||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
@ -53,16 +72,16 @@ if(NOT APPLE AND NOT WIN32)
|
|||||||
RENAME cura)
|
RENAME cura)
|
||||||
if(EXISTS /etc/debian_version)
|
if(EXISTS /etc/debian_version)
|
||||||
install(DIRECTORY cura
|
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)
|
FILES_MATCHING PATTERN *.py)
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.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()
|
else()
|
||||||
install(DIRECTORY cura
|
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)
|
FILES_MATCHING PATTERN *.py)
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.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()
|
endif()
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/cura.desktop
|
install(FILES ${CMAKE_BINARY_DIR}/cura.desktop
|
||||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
||||||
@ -78,8 +97,8 @@ else()
|
|||||||
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
|
||||||
install(DIRECTORY cura
|
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)
|
FILES_MATCHING PATTERN *.py)
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/CuraVersion.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()
|
endif()
|
||||||
|
@ -1,10 +1,21 @@
|
|||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
enable_testing()
|
include(CTest)
|
||||||
include(CMakeParseArguments)
|
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)
|
||||||
|
|
||||||
|
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)
|
add_custom_target(test-verbose COMMAND ${CMAKE_CTEST_COMMAND} --verbose)
|
||||||
|
|
||||||
@ -36,7 +47,7 @@ function(cura_add_test)
|
|||||||
if (NOT ${test_exists})
|
if (NOT ${test_exists})
|
||||||
add_test(
|
add_test(
|
||||||
NAME ${_NAME}
|
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 LANG=C)
|
||||||
set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT "PYTHONPATH=${_PYTHONPATH}")
|
set_tests_properties(${_NAME} PROPERTIES ENVIRONMENT "PYTHONPATH=${_PYTHONPATH}")
|
||||||
@ -59,13 +70,13 @@ endforeach()
|
|||||||
#Add code style test.
|
#Add code style test.
|
||||||
add_test(
|
add_test(
|
||||||
NAME "code-style"
|
NAME "code-style"
|
||||||
COMMAND ${PYTHON_EXECUTABLE} run_mypy.py
|
COMMAND ${Python3_EXECUTABLE} run_mypy.py
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
#Add test for whether the shortcut alt-keys are unique in every translation.
|
#Add test for whether the shortcut alt-keys are unique in every translation.
|
||||||
add_test(
|
add_test(
|
||||||
NAME "shortcut-keys"
|
NAME "shortcut-keys"
|
||||||
COMMAND ${PYTHON_EXECUTABLE} scripts/check_shortcut_keys.py
|
COMMAND ${Python3_EXECUTABLE} scripts/check_shortcut_keys.py
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
@ -59,6 +59,10 @@ class WelcomePagesModel(ListModel):
|
|||||||
# Store all the previous page indices so it can go back.
|
# Store all the previous page indices so it can go back.
|
||||||
self._previous_page_indices_stack = deque() # type: deque
|
self._previous_page_indices_stack = deque() # type: deque
|
||||||
|
|
||||||
|
# If the welcome flow should be shown. It can show the complete flow or just the changelog depending on the
|
||||||
|
# specific case. See initialize() for how this variable is set.
|
||||||
|
self._should_show_welcome_flow = False
|
||||||
|
|
||||||
allFinished = pyqtSignal() # emitted when all steps have been finished
|
allFinished = pyqtSignal() # emitted when all steps have been finished
|
||||||
currentPageIndexChanged = pyqtSignal()
|
currentPageIndexChanged = pyqtSignal()
|
||||||
|
|
||||||
@ -174,6 +178,12 @@ class WelcomePagesModel(ListModel):
|
|||||||
|
|
||||||
self.currentPageIndexChanged.emit()
|
self.currentPageIndexChanged.emit()
|
||||||
|
|
||||||
|
shouldShowWelcomeFlowChanged = pyqtSignal()
|
||||||
|
|
||||||
|
@pyqtProperty(bool, notify = shouldShowWelcomeFlowChanged)
|
||||||
|
def shouldShowWelcomeFlow(self) -> bool:
|
||||||
|
return self._should_show_welcome_flow
|
||||||
|
|
||||||
# Gets the page index with the given page ID. If the page ID doesn't exist, returns None.
|
# Gets the page index with the given page ID. If the page ID doesn't exist, returns None.
|
||||||
def getPageIndexById(self, page_id: str) -> Optional[int]:
|
def getPageIndexById(self, page_id: str) -> Optional[int]:
|
||||||
page_idx = None
|
page_idx = None
|
||||||
@ -189,7 +199,35 @@ class WelcomePagesModel(ListModel):
|
|||||||
return QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles,
|
return QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles,
|
||||||
os.path.join("WelcomePages", page_filename)))
|
os.path.join("WelcomePages", page_filename)))
|
||||||
|
|
||||||
|
# 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(update_should_show_flag = False)
|
||||||
|
|
||||||
def initialize(self) -> None:
|
def initialize(self) -> None:
|
||||||
|
self._application.getMachineManager().globalContainerChanged.connect(self._onActiveMachineChanged)
|
||||||
|
self._initialize()
|
||||||
|
|
||||||
|
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.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
|
||||||
|
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()
|
||||||
|
|
||||||
# All pages
|
# All pages
|
||||||
all_pages_list = [{"id": "welcome",
|
all_pages_list = [{"id": "welcome",
|
||||||
"page_url": self._getBuiltinWelcomePagePath("WelcomeContent.qml"),
|
"page_url": self._getBuiltinWelcomePagePath("WelcomeContent.qml"),
|
||||||
@ -221,7 +259,11 @@ class WelcomePagesModel(ListModel):
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
self._pages = all_pages_list
|
pages_to_show = all_pages_list
|
||||||
|
if show_whatsnew_only:
|
||||||
|
pages_to_show = list(filter(lambda x: x["id"] == "whats_new", all_pages_list))
|
||||||
|
|
||||||
|
self._pages = pages_to_show
|
||||||
self.setItems(self._pages)
|
self.setItems(self._pages)
|
||||||
|
|
||||||
# For convenience, inject the default "next" button text to each item if it's not present.
|
# For convenience, inject the default "next" button text to each item if it's not present.
|
||||||
|
43
docker/build.sh
Executable file
43
docker/build.sh
Executable file
@ -0,0 +1,43 @@
|
|||||||
|
#!/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
|
||||||
|
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}"
|
||||||
|
|
||||||
|
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 --verbose --output-on-failure -T Test
|
@ -1,31 +1,33 @@
|
|||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2018 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# 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.Backend import Backend
|
||||||
from UM.Job import Job
|
from UM.Job import Job
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
from UM.Math.Vector import Vector
|
from UM.Math.Vector import Vector
|
||||||
from UM.Message import Message
|
from UM.Message import Message
|
||||||
from cura.Scene.CuraSceneNode import CuraSceneNode
|
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
|
|
||||||
catalog = i18nCatalog("cura")
|
|
||||||
|
|
||||||
from cura.CuraApplication import CuraApplication
|
from cura.CuraApplication import CuraApplication
|
||||||
from cura.LayerDataBuilder import LayerDataBuilder
|
from cura.LayerDataBuilder import LayerDataBuilder
|
||||||
from cura.LayerDataDecorator import LayerDataDecorator
|
from cura.LayerDataDecorator import LayerDataDecorator
|
||||||
from cura.LayerPolygon import LayerPolygon
|
from cura.LayerPolygon import LayerPolygon
|
||||||
|
from cura.Scene.CuraSceneNode import CuraSceneNode
|
||||||
from cura.Scene.GCodeListDecorator import GCodeListDecorator
|
from cura.Scene.GCodeListDecorator import GCodeListDecorator
|
||||||
from cura.Settings.ExtruderManager import ExtruderManager
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
|
|
||||||
import numpy
|
catalog = i18nCatalog("cura")
|
||||||
import math
|
|
||||||
import re
|
|
||||||
from typing import Dict, List, NamedTuple, Optional, Union
|
|
||||||
|
|
||||||
PositionOptional = NamedTuple("Position", [("x", Optional[float]), ("y", Optional[float]), ("z", Optional[float]), ("f", Optional[float]), ("e", Optional[float])])
|
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])])
|
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
|
## This parser is intended to interpret the common firmware codes among all the
|
||||||
# different flavors
|
# different flavors
|
||||||
class FlavorParser:
|
class FlavorParser:
|
||||||
@ -33,7 +35,7 @@ class FlavorParser:
|
|||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
CuraApplication.getInstance().hideMessageSignal.connect(self._onHideMessage)
|
CuraApplication.getInstance().hideMessageSignal.connect(self._onHideMessage)
|
||||||
self._cancelled = False
|
self._cancelled = False
|
||||||
self._message = None
|
self._message = None # type: Optional[Message]
|
||||||
self._layer_number = 0
|
self._layer_number = 0
|
||||||
self._extruder_number = 0
|
self._extruder_number = 0
|
||||||
self._clearValues()
|
self._clearValues()
|
||||||
@ -425,7 +427,8 @@ class FlavorParser:
|
|||||||
|
|
||||||
if line.startswith("M"):
|
if line.startswith("M"):
|
||||||
M = self._getInt(line, "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
|
# "Flush" leftovers. Last layer paths are still stored
|
||||||
if len(current_path) > 1:
|
if len(current_path) > 1:
|
||||||
@ -463,7 +466,7 @@ class FlavorParser:
|
|||||||
Logger.log("w", "File doesn't contain any valid layers")
|
Logger.log("w", "File doesn't contain any valid layers")
|
||||||
|
|
||||||
settings = CuraApplication.getInstance().getGlobalContainerStack()
|
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_width = settings.getProperty("machine_width", "value")
|
||||||
machine_depth = settings.getProperty("machine_depth", "value")
|
machine_depth = settings.getProperty("machine_depth", "value")
|
||||||
scene_node.setPosition(Vector(-machine_width / 2, 0, machine_depth / 2))
|
scene_node.setPosition(Vector(-machine_width / 2, 0, machine_depth / 2))
|
||||||
|
@ -57,6 +57,7 @@ Item
|
|||||||
{
|
{
|
||||||
text: catalog.i18nc("@title:label", "Printer Settings")
|
text: catalog.i18nc("@title:label", "Printer Settings")
|
||||||
font: UM.Theme.getFont("medium_bold")
|
font: UM.Theme.getFont("medium_bold")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,6 +173,7 @@ Item
|
|||||||
{
|
{
|
||||||
text: catalog.i18nc("@title:label", "Printhead Settings")
|
text: catalog.i18nc("@title:label", "Printhead Settings")
|
||||||
font: UM.Theme.getFont("medium_bold")
|
font: UM.Theme.getFont("medium_bold")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class PostProcessingPlugin(QObject, Extension):
|
|||||||
loaded_script = importlib.util.module_from_spec(spec)
|
loaded_script = importlib.util.module_from_spec(spec)
|
||||||
if spec.loader is None:
|
if spec.loader is None:
|
||||||
continue
|
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?
|
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)
|
loaded_class = getattr(loaded_script, script_name)
|
||||||
|
@ -38,5 +38,5 @@ class UFPReader(MeshReader):
|
|||||||
|
|
||||||
# Open the GCodeReader to parse the data
|
# Open the GCodeReader to parse the data
|
||||||
gcode_reader = PluginRegistry.getInstance().getPluginObject("GCodeReader") # type: ignore
|
gcode_reader = PluginRegistry.getInstance().getPluginObject("GCodeReader") # type: ignore
|
||||||
gcode_reader.preReadFromStream(gcode_stream)
|
gcode_reader.preReadFromStream(gcode_stream) # type: ignore
|
||||||
return gcode_reader.readFromStream(gcode_stream)
|
return gcode_reader.readFromStream(gcode_stream) # type: ignore
|
||||||
|
@ -85,10 +85,11 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
|
|||||||
|
|
||||||
# We use the Cura Connect monitor tab to get most functionality right away.
|
# We use the Cura Connect monitor tab to get most functionality right away.
|
||||||
if PluginRegistry.getInstance() is not None:
|
if PluginRegistry.getInstance() is not None:
|
||||||
self._monitor_view_qml_path = os.path.join(
|
plugin_path = PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting")
|
||||||
PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"),
|
if plugin_path is None:
|
||||||
"resources", "qml", "MonitorStage.qml"
|
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.
|
# Trigger the printersChanged signal when the private signal is triggered.
|
||||||
self.printersChanged.connect(self._clusterPrintersChanged)
|
self.printersChanged.connect(self._clusterPrintersChanged)
|
||||||
@ -149,7 +150,7 @@ class CloudOutputDevice(NetworkedPrinterOutputDevice):
|
|||||||
# the host name should then be "ultimakersystem-aabbccdd0011"
|
# the host name should then be "ultimakersystem-aabbccdd0011"
|
||||||
if network_key.startswith(self.clusterData.host_name):
|
if network_key.startswith(self.clusterData.host_name):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# However, for manually added printers, the local IP address is used in lieu of a proper
|
# However, for manually added printers, the local IP address is used in lieu of a proper
|
||||||
# network key, so check for that as well
|
# 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):
|
if self.clusterData.host_internal_ip is not None and network_key.find(self.clusterData.host_internal_ip):
|
||||||
|
@ -32,8 +32,8 @@ class CloudOutputDeviceManager:
|
|||||||
# The translation catalog for this device.
|
# The translation catalog for this device.
|
||||||
I18N_CATALOG = i18nCatalog("cura")
|
I18N_CATALOG = i18nCatalog("cura")
|
||||||
|
|
||||||
addedCloudCluster = Signal(CloudOutputDevice)
|
addedCloudCluster = Signal()
|
||||||
removedCloudCluster = Signal(CloudOutputDevice)
|
removedCloudCluster = Signal()
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
# Persistent dict containing the remote clusters for the authenticated user.
|
# Persistent dict containing the remote clusters for the authenticated user.
|
||||||
|
@ -66,10 +66,11 @@ class ClusterUM3OutputDevice(NetworkedPrinterOutputDevice):
|
|||||||
self._received_print_jobs = False # type: bool
|
self._received_print_jobs = False # type: bool
|
||||||
|
|
||||||
if PluginRegistry.getInstance() is not None:
|
if PluginRegistry.getInstance() is not None:
|
||||||
self._monitor_view_qml_path = os.path.join(
|
plugin_path = PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting")
|
||||||
PluginRegistry.getInstance().getPluginPath("UM3NetworkPrinting"),
|
if plugin_path is None:
|
||||||
"resources", "qml", "MonitorStage.qml"
|
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
|
# Trigger the printersChanged signal when the private signal is triggered
|
||||||
self.printersChanged.connect(self._clusterPrintersChanged)
|
self.printersChanged.connect(self._clusterPrintersChanged)
|
||||||
|
@ -29,7 +29,8 @@ Cura.MachineAction
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
text: catalog.i18nc("@title", "Build Plate Leveling")
|
text: catalog.i18nc("@title", "Build Plate Leveling")
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
font.pointSize: 18
|
font: UM.Theme.getFont("medium")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,6 +42,8 @@ Cura.MachineAction
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
wrapMode: Text.WordWrap
|
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.")
|
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
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +55,8 @@ Cura.MachineAction
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
wrapMode: Text.WordWrap
|
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.")
|
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
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ Cura.MachineAction
|
|||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
text: catalog.i18nc("@label", "Please select any upgrades made to this Ultimaker 2.")
|
text: catalog.i18nc("@label", "Please select any upgrades made to this Ultimaker 2.")
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@ Cura.MachineAction
|
|||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
text: catalog.i18nc("@label","Please select any upgrades made to this Ultimaker Original")
|
text: catalog.i18nc("@label","Please select any upgrades made to this Ultimaker Original")
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,6 +794,7 @@ UM.MainWindow
|
|||||||
title: catalog.i18nc("@title:window", "Add Printer")
|
title: catalog.i18nc("@title:window", "Add Printer")
|
||||||
model: CuraApplication.getAddPrinterPagesModel()
|
model: CuraApplication.getAddPrinterPagesModel()
|
||||||
progressBarVisible: false
|
progressBarVisible: false
|
||||||
|
hasCancelButton: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.WizardDialog
|
Cura.WizardDialog
|
||||||
@ -802,6 +803,7 @@ UM.MainWindow
|
|||||||
title: catalog.i18nc("@title:window", "What's New")
|
title: catalog.i18nc("@title:window", "What's New")
|
||||||
model: CuraApplication.getWhatsNewPagesModel()
|
model: CuraApplication.getWhatsNewPagesModel()
|
||||||
progressBarVisible: false
|
progressBarVisible: false
|
||||||
|
hasCancelButton: false
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
|
@ -59,6 +59,7 @@ UM.TooltipArea
|
|||||||
anchors.verticalCenter: comboBox.verticalCenter
|
anchors.verticalCenter: comboBox.verticalCenter
|
||||||
visible: text != ""
|
visible: text != ""
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ UM.TooltipArea
|
|||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
font: UM.Theme.getFont("medium_bold")
|
font: UM.Theme.getFont("medium_bold")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,13 +60,16 @@ UM.TooltipArea
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
|
|
||||||
|
text: (propertyProvider.properties.value) ? propertyProvider.properties.value : ""
|
||||||
font: UM.Theme.getFont("fixed")
|
font: UM.Theme.getFont("fixed")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
text: (propertyProvider.properties.value) ? propertyProvider.properties.value : ""
|
color: UM.Theme.getColor("text")
|
||||||
wrapMode: TextEdit.NoWrap
|
wrapMode: TextEdit.NoWrap
|
||||||
|
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
{
|
{
|
||||||
|
color: UM.Theme.getColor("main_background")
|
||||||
|
|
||||||
border.color:
|
border.color:
|
||||||
{
|
{
|
||||||
if (!gcodeTextArea.enabled)
|
if (!gcodeTextArea.enabled)
|
||||||
|
@ -66,6 +66,7 @@ UM.TooltipArea
|
|||||||
anchors.verticalCenter: textFieldWithUnit.verticalCenter
|
anchors.verticalCenter: textFieldWithUnit.verticalCenter
|
||||||
visible: text != ""
|
visible: text != ""
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,6 +136,7 @@ UM.TooltipArea
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
|
||||||
// When the textbox gets focused by TAB, select all text
|
// When the textbox gets focused by TAB, select all text
|
||||||
|
@ -53,6 +53,7 @@ UM.TooltipArea
|
|||||||
anchors.verticalCenter: checkBox.verticalCenter
|
anchors.verticalCenter: checkBox.verticalCenter
|
||||||
visible: text != ""
|
visible: text != ""
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +85,8 @@ Item
|
|||||||
{
|
{
|
||||||
id: machineList
|
id: machineList
|
||||||
|
|
||||||
|
cacheBuffer: 0 // Workaround for https://bugreports.qt.io/browse/QTBUG-49224
|
||||||
|
|
||||||
model: UM.DefinitionContainersModel
|
model: UM.DefinitionContainersModel
|
||||||
{
|
{
|
||||||
id: machineDefinitionsModel
|
id: machineDefinitionsModel
|
||||||
@ -142,6 +144,7 @@ Item
|
|||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
text: button.text
|
text: button.text
|
||||||
font: UM.Theme.getFont("default_bold")
|
font: UM.Theme.getFont("default_bold")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,9 +203,10 @@ Item
|
|||||||
|
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Printer Name")
|
text: catalog.i18nc("@label", "Printer name")
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
@ -213,9 +217,12 @@ Item
|
|||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: (parent.width / 2) | 0
|
width: (parent.width / 2) | 0
|
||||||
placeholderText: catalog.i18nc("@text", "Please give your printer a name")
|
placeholderText: catalog.i18nc("@text", "Please give your printer a name")
|
||||||
|
maximumLength: 40
|
||||||
// Make sure that the fill is not empty
|
validator: RegExpValidator
|
||||||
validator: RegExpValidator { regExp: /.+/ }
|
{
|
||||||
|
regExp: printerNameTextField.machineNameValidator.machineNameRegex
|
||||||
|
}
|
||||||
|
property var machineNameValidator: Cura.MachineNameValidator { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -72,6 +72,8 @@ Item
|
|||||||
section.criteria: ViewSection.FullString
|
section.criteria: ViewSection.FullString
|
||||||
section.delegate: sectionHeading
|
section.delegate: sectionHeading
|
||||||
|
|
||||||
|
cacheBuffer: 0 // Workaround for https://bugreports.qt.io/browse/QTBUG-49224
|
||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
// Select the first one that's not "unknown" by default.
|
// Select the first one that's not "unknown" by default.
|
||||||
|
@ -61,6 +61,7 @@ Item
|
|||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
text: catalog.i18nc("@label", "Enter the IP address or hostname of your printer on the network.")
|
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.top: parent.top
|
||||||
anchors.margins: UM.Theme.getSize("default_margin").width
|
anchors.margins: UM.Theme.getSize("default_margin").width
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
|
||||||
visible:
|
visible:
|
||||||
@ -162,6 +164,7 @@ Item
|
|||||||
id: printerNameLabel
|
id: printerNameLabel
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
font: UM.Theme.getFont("large")
|
font: UM.Theme.getFont("large")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
|
||||||
text: "???"
|
text: "???"
|
||||||
@ -175,14 +178,53 @@ Item
|
|||||||
columns: 2
|
columns: 2
|
||||||
columnSpacing: UM.Theme.getSize("default_margin").width
|
columnSpacing: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
Label { font: UM.Theme.getFont("default"); text: catalog.i18nc("@label", "Type"); renderType: Text.NativeRendering }
|
Label
|
||||||
Label { id: typeText; font: UM.Theme.getFont("default"); text: "?"; renderType: Text.NativeRendering }
|
{
|
||||||
|
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
|
||||||
Label { id: firmwareText; font: UM.Theme.getFont("default"); text: "0.0.0.0"; renderType: Text.NativeRendering }
|
{
|
||||||
|
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
|
||||||
Label { id: addressText; font: UM.Theme.getFont("default"); text: "0.0.0.0"; renderType: Text.NativeRendering }
|
{
|
||||||
|
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
|
Connections
|
||||||
{
|
{
|
||||||
|
@ -52,7 +52,6 @@ Item
|
|||||||
topMargin: UM.Theme.getSize("default_margin").height
|
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
|
// Pictures and texts are arranged using Columns with spacing. The whole picture and text area is centered in
|
||||||
// the cloud contents area.
|
// the cloud contents area.
|
||||||
Column
|
Column
|
||||||
@ -105,6 +104,7 @@ Item
|
|||||||
}
|
}
|
||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,6 +71,7 @@ Item
|
|||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
font: UM.Theme.getFont("medium")
|
font: UM.Theme.getFont("medium")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
|
||||||
MouseArea
|
MouseArea
|
||||||
|
@ -21,7 +21,7 @@ Cura.RoundedRectangle
|
|||||||
|
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: UM.Theme.getColor("lining")
|
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
|
radius: UM.Theme.getSize("default_radius").width
|
||||||
|
|
||||||
cornerSide: contentShown ? Cura.RoundedRectangle.Direction.Up : Cura.RoundedRectangle.Direction.All
|
cornerSide: contentShown ? Cura.RoundedRectangle.Direction.Up : Cura.RoundedRectangle.Direction.All
|
||||||
|
@ -49,7 +49,7 @@ Item
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
height: UM.Theme.getSize("expandable_component_content_header").height
|
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
|
contentShown: base.contentShown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ Item
|
|||||||
textFormat: Text.RichText
|
textFormat: Text.RichText
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,6 +46,7 @@ Item
|
|||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: catalog.i18nc("@text", "Please follow these steps to set up\nUltimaker Cura. This will only take a few moments.")
|
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")
|
font: UM.Theme.getFont("medium")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,11 +24,14 @@ Window
|
|||||||
|
|
||||||
minimumWidth: 580 * screenScaleFactor
|
minimumWidth: 580 * screenScaleFactor
|
||||||
minimumHeight: 600 * screenScaleFactor
|
minimumHeight: 600 * screenScaleFactor
|
||||||
|
maximumWidth: minimumWidth
|
||||||
|
maximumHeight: minimumHeight
|
||||||
|
|
||||||
color: UM.Theme.getColor("main_background")
|
color: UM.Theme.getColor("main_background")
|
||||||
|
|
||||||
property var model: null // Needs to be set by whoever is using this dialog.
|
property var model: null // Needs to be set by whoever is using this dialog.
|
||||||
property alias progressBarVisible: wizardPanel.progressBarVisible
|
property alias progressBarVisible: wizardPanel.progressBarVisible
|
||||||
|
property alias hasCancelButton: cancelButton.visible
|
||||||
|
|
||||||
onVisibilityChanged:
|
onVisibilityChanged:
|
||||||
{
|
{
|
||||||
@ -51,4 +54,20 @@ Window
|
|||||||
target: model
|
target: model
|
||||||
onAllFinished: dialog.hide()
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,7 @@ CheckBox
|
|||||||
leftPadding: control.indicator.width + control.spacing
|
leftPadding: control.indicator.width + control.spacing
|
||||||
text: control.text
|
text: control.text
|
||||||
font: control.font
|
font: control.font
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,7 @@ RadioButton
|
|||||||
leftPadding: radioButton.indicator.width + radioButton.spacing
|
leftPadding: radioButton.indicator.width + radioButton.spacing
|
||||||
text: radioButton.text
|
text: radioButton.text
|
||||||
font: radioButton.font
|
font: radioButton.font
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ ScrollView
|
|||||||
|
|
||||||
background: Rectangle // Border
|
background: Rectangle // Border
|
||||||
{
|
{
|
||||||
|
color: UM.Theme.getColor("main_background")
|
||||||
border.color: UM.Theme.getColor("lining")
|
border.color: UM.Theme.getColor("lining")
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
}
|
}
|
||||||
@ -27,6 +28,7 @@ ScrollView
|
|||||||
{
|
{
|
||||||
id: _textArea
|
id: _textArea
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
textFormat: TextEdit.PlainText
|
textFormat: TextEdit.PlainText
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
|
@ -20,6 +20,7 @@ TextField
|
|||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
selectByMouse: true
|
selectByMouse: true
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
|
color: UM.Theme.getColor("text")
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
|
|
||||||
states: [
|
states: [
|
||||||
@ -49,6 +50,8 @@ TextField
|
|||||||
{
|
{
|
||||||
id: backgroundRectangle
|
id: backgroundRectangle
|
||||||
|
|
||||||
|
color: UM.Theme.getColor("main_background")
|
||||||
|
|
||||||
anchors.margins: Math.round(UM.Theme.getSize("default_lining").width)
|
anchors.margins: Math.round(UM.Theme.getSize("default_lining").width)
|
||||||
radius: UM.Theme.getSize("setting_control_radius").width
|
radius: UM.Theme.getSize("setting_control_radius").width
|
||||||
|
|
||||||
|
@ -94,8 +94,8 @@
|
|||||||
"action_button_active": [39, 44, 48, 30],
|
"action_button_active": [39, 44, 48, 30],
|
||||||
"action_button_active_text": [255, 255, 255, 255],
|
"action_button_active_text": [255, 255, 255, 255],
|
||||||
"action_button_active_border": [255, 255, 255, 100],
|
"action_button_active_border": [255, 255, 255, 100],
|
||||||
"action_button_disabled": [39, 44, 48, 255],
|
"action_button_disabled": [19, 24, 28, 255],
|
||||||
"action_button_disabled_text": [255, 255, 255, 80],
|
"action_button_disabled_text": [200, 200, 200, 80],
|
||||||
"action_button_disabled_border": [255, 255, 255, 30],
|
"action_button_disabled_border": [255, 255, 255, 30],
|
||||||
|
|
||||||
"scrollbar_background": [39, 44, 48, 0],
|
"scrollbar_background": [39, 44, 48, 0],
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock, PropertyMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@ -12,6 +12,8 @@ def discovered_printer_model(application) -> DiscoveredPrintersModel:
|
|||||||
|
|
||||||
def test_discoveredPrinters(discovered_printer_model):
|
def test_discoveredPrinters(discovered_printer_model):
|
||||||
mocked_device = MagicMock()
|
mocked_device = MagicMock()
|
||||||
|
cluster_size = PropertyMock(return_value = 1)
|
||||||
|
type(mocked_device).clusterSize = cluster_size
|
||||||
|
|
||||||
mocked_callback = MagicMock()
|
mocked_callback = MagicMock()
|
||||||
discovered_printer_model.addDiscoveredPrinter("ip", "key", "name", mocked_callback, "machine_type", mocked_device)
|
discovered_printer_model.addDiscoveredPrinter("ip", "key", "name", mocked_callback, "machine_type", mocked_device)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user