Merge remote-tracking branch 'origin/master' into CURA-6856_signed_plugins_and_packages

This commit is contained in:
Lipu Fei 2019-11-06 15:54:19 +01:00
commit 36b924154b
5 changed files with 139 additions and 131 deletions

View File

@ -1,8 +1,11 @@
import collections import collections
from typing import Dict, Optional
from UM.i18n import i18nCatalog from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura") catalog = i18nCatalog("cura")
intent_translations = collections.OrderedDict() # type: "collections.OrderedDict[str, Dict[str, Optional[str]]]"
intent_translations = collections.OrderedDict() # type: collections.OrderedDict[str, Dict[str, Optional[str]]]
intent_translations["default"] = { intent_translations["default"] = {
"name": catalog.i18nc("@label", "Default") "name": catalog.i18nc("@label", "Default")
} }

View File

@ -72,7 +72,6 @@
"zyyx_pro_flex", "zyyx_pro_flex",
"zyyx_pro_pla" "zyyx_pro_pla"
], ],
"machine_extruder_trains": "machine_extruder_trains":
{ {
"0": "leapfrog_bolt_pro_extruder_right", "0": "leapfrog_bolt_pro_extruder_right",
@ -107,7 +106,6 @@
"machine_start_gcode": {"default_value": "G90\nG28 X0 Y0 Z0\nG1 Z5 F1000\nG92 E0\nG1 Y-32 F12000\nG1 E15 F1000\nG1 E45 F150\nG4 S5"}, "machine_start_gcode": {"default_value": "G90\nG28 X0 Y0 Z0\nG1 Z5 F1000\nG92 E0\nG1 Y-32 F12000\nG1 E15 F1000\nG1 E45 F150\nG4 S5"},
"machine_end_gcode": {"default_value": "G92 E0\nG1 E-3 F300\nM104 S0 T0\nM104 S0 T1\nM140 S0\nG28 X0 Y0\nM84"}, "machine_end_gcode": {"default_value": "G92 E0\nG1 E-3 F300\nM104 S0 T0\nM104 S0 T1\nM140 S0\nG28 X0 Y0\nM84"},
"prime_tower_enable": { "resolve": "extruders_enabled_count > 1"}, "prime_tower_enable": { "resolve": "extruders_enabled_count > 1"},
"prime_tower_circular": {"default_value": false},
"prime_tower_position_x": {"value": "169" }, "prime_tower_position_x": {"value": "169" },
"prime_tower_position_y": {"value": "25" }, "prime_tower_position_y": {"value": "25" },
"speed_travel": { "value": "200" }, "speed_travel": { "value": "200" },

View File

@ -1,5 +1,4 @@
{ {
"id": "leapfrog_bolt_pro_extruder_left",
"version": 2, "version": 2,
"name": "Left extruder", "name": "Left extruder",
"inherits": "fdmextruder", "inherits": "fdmextruder",
@ -7,7 +6,6 @@
"machine": "leapfrog_bolt_pro", "machine": "leapfrog_bolt_pro",
"position": "1" "position": "1"
}, },
"overrides": { "overrides": {
"extruder_nr": { "extruder_nr": {
"default_value": 1, "default_value": 1,

View File

@ -1,5 +1,4 @@
{ {
"id": "leapfrog_bolt_pro_extruder_right",
"version": 2, "version": 2,
"name": "Right extruder", "name": "Right extruder",
"inherits": "fdmextruder", "inherits": "fdmextruder",
@ -7,7 +6,6 @@
"machine": "leapfrog_bolt_pro", "machine": "leapfrog_bolt_pro",
"position": "0" "position": "0"
}, },
"overrides": { "overrides": {
"extruder_nr": { "extruder_nr": {
"default_value": 0, "default_value": 0,

View File

@ -3,11 +3,12 @@
import json # To check files for unnecessarily overridden properties. import json # To check files for unnecessarily overridden properties.
import os import os
import os.path
import pytest #This module contains automated tests. import pytest #This module contains automated tests.
from typing import Any, Dict from typing import Any, Dict
import uuid import uuid
from unittest.mock import patch, MagicMock
import UM.Settings.ContainerRegistry #To create empty instance containers. import UM.Settings.ContainerRegistry #To create empty instance containers.
import UM.Settings.ContainerStack #To set the container registry the container stacks use. import UM.Settings.ContainerStack #To set the container registry the container stacks use.
from UM.Settings.DefinitionContainer import DefinitionContainer #To check against the class of DefinitionContainer. from UM.Settings.DefinitionContainer import DefinitionContainer #To check against the class of DefinitionContainer.
@ -24,6 +25,10 @@ definition_filepaths = machine_filepaths + extruder_filepaths
all_meshes = os.listdir(os.path.join(os.path.dirname(__file__), "..", "..", "resources", "meshes")) all_meshes = os.listdir(os.path.join(os.path.dirname(__file__), "..", "..", "resources", "meshes"))
all_images = os.listdir(os.path.join(os.path.dirname(__file__), "..", "..", "resources", "images")) all_images = os.listdir(os.path.join(os.path.dirname(__file__), "..", "..", "resources", "images"))
# Loading definition files needs a functioning ContainerRegistry
cr = UM.Settings.ContainerRegistry.ContainerRegistry(None)
@pytest.fixture @pytest.fixture
def definition_container(): def definition_container():
uid = str(uuid.uuid4()) uid = str(uuid.uuid4())
@ -39,8 +44,14 @@ def test_validateMachineDefinitionContainer(file_path, definition_container):
if file_name == "fdmprinter.def.json" or file_name == "fdmextruder.def.json": if file_name == "fdmprinter.def.json" or file_name == "fdmextruder.def.json":
return # Stop checking, these are root files. return # Stop checking, these are root files.
from UM.VersionUpgradeManager import FilesDataUpdateResult
mocked_vum = MagicMock()
mocked_vum.updateFilesData = lambda ct, v, fdl, fnl: FilesDataUpdateResult(ct, v, fdl, fnl)
with patch("UM.VersionUpgradeManager.VersionUpgradeManager.getInstance", MagicMock(return_value = mocked_vum)):
assertIsDefinitionValid(definition_container, file_path) assertIsDefinitionValid(definition_container, file_path)
def assertIsDefinitionValid(definition_container, file_path): def assertIsDefinitionValid(definition_container, file_path):
with open(file_path, encoding = "utf-8") as data: with open(file_path, encoding = "utf-8") as data:
json = data.read() json = data.read()