Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/5.9'
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton committed Nov 7, 2024
2 parents a1029d8 + dcbd40c commit 94b8728
Show file tree
Hide file tree
Showing 27 changed files with 1,093 additions and 971 deletions.
13 changes: 13 additions & 0 deletions conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,19 @@ pyinstaller:
Windows: "./icons/Cura.ico"
Macos: "./icons/cura.icns"
Linux: "./icons/cura-128.png"
blacklist:
- [ "assimp" ]
- [ "qt", "charts" ]
- [ "qt", "coap" ]
- [ "qt", "data", "vis" ]
- [ "qt", "lab", "animat" ]
- [ "qt", "mqtt" ]
- [ "qt", "net", "auth" ]
- [ "qt", "quick3d" ]
- [ "qt", "timeline" ]
- [ "qt", "virt", "key" ]
- [ "qt", "wayland", "compos" ]
- [ "qt", "5", "compat" ]
pycharm_targets:
- jinja_path: .run_templates/pycharm_cura_run.run.xml.jinja
module_name: Cura
Expand Down
79 changes: 78 additions & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,62 @@ def _generate_cura_version(self, location):
python_installs=self._python_installs(),
))

def _delete_unwanted_binaries(self, root):
dynamic_binary_file_exts = [".so", ".dylib", ".dll", ".pyd", ".pyi"]
prohibited = [
"qt5compat",
"qtcharts",
"qtcoap",
"qtdatavis3d",
"qtlottie",
"qtmqtt",
"qtnetworkauth",
"qtquick3d",
"qtquick3dphysics",
"qtquicktimeline",
"qtvirtualkeyboard",
"qtwayland"
]
forbiddens = [x.encode() for x in prohibited]
to_remove_files = []
to_remove_dirs = []
for root, dir_, files in os.walk(root):
for filename in files:
if not any([(x in filename) for x in dynamic_binary_file_exts]):
continue
pathname = os.path.join(root, filename)
still_exist = True
for forbidden in prohibited:
if forbidden.lower() in str(pathname).lower():
to_remove_files.append(pathname)
still_exist = False
break
if not still_exist:
continue
with open(pathname, "rb") as file:
bytez = file.read().lower()
for forbidden in forbiddens:
if bytez.find(forbidden) >= 0:
to_remove_files.append(pathname)
for dirname in dir_:
for forbidden in prohibited:
if forbidden.lower() == str(dirname).lower():
pathname = os.path.join(root, dirname)
to_remove_dirs.append(pathname)
break
for file in to_remove_files:
try:
os.remove(file)
print(f"deleted file: {file}")
except Exception as ex:
print(f"WARNING: Attempt to delete file {file} results in: {str(ex)}")
for dir_ in to_remove_dirs:
try:
rmdir(self, dir_)
print(f"deleted dir_: {dir_}")
except Exception as ex:
print(f"WARNING: Attempt to delete folder {dir_} results in: {str(ex)}")

def _generate_pyinstaller_spec(self, location, entrypoint_location, icon_path, entitlements_file):
pyinstaller_metadata = self.conan_data["pyinstaller"]
datas = []
Expand Down Expand Up @@ -281,13 +337,27 @@ def _generate_pyinstaller_spec(self, location, entrypoint_location, icon_path, e
version = self.conf.get("user.cura:version", default = self.version, check_type = str)
cura_version = Version(version)

# filter all binary files in binaries on the blacklist
blacklist = pyinstaller_metadata["blacklist"]
filtered_binaries = [b for b in binaries if not any([all([(part in b[0].lower()) for part in parts]) for parts in blacklist])]

# In case the installer isn't actually pyinstaller (Windows at the moment), outright remove the offending files:
specifically_delete = set(binaries) - set(filtered_binaries)
for (unwanted_path, _) in specifically_delete:
try:
os.remove(unwanted_path)
print(f"delete: {unwanted_path}")
except Exception as ex:
print(f"WARNING: Attempt to delete binary {unwanted_path} results in: {str(ex)}")

# Write the actual file:
with open(os.path.join(location, "UltiMaker-Cura.spec"), "w") as f:
f.write(pyinstaller.render(
name = str(self.options.display_name).replace(" ", "-"),
display_name = self._app_name,
entrypoint = entrypoint_location,
datas = datas,
binaries = binaries,
binaries = filtered_binaries,
venv_script_path = str(self._script_dir),
hiddenimports = pyinstaller_metadata["hiddenimports"],
collect_all = pyinstaller_metadata["collect_all"],
Expand Down Expand Up @@ -405,8 +475,10 @@ def generate(self):

for dependency in self.dependencies.host.values():
for bindir in dependency.cpp_info.bindirs:
self._delete_unwanted_binaries(bindir)
copy(self, "*.dll", bindir, str(self._site_packages), keep_path = False)
for libdir in dependency.cpp_info.libdirs:
self._delete_unwanted_binaries(libdir)
copy(self, "*.pyd", libdir, str(self._site_packages), keep_path = False)
copy(self, "*.pyi", libdir, str(self._site_packages), keep_path = False)
copy(self, "*.dylib", libdir, str(self._base_dir.joinpath("lib")), keep_path = False)
Expand Down Expand Up @@ -496,6 +568,11 @@ def deploy(self):

self._generate_cura_version(os.path.join(self._site_packages, "cura"))

self._delete_unwanted_binaries(self._site_packages)
self._delete_unwanted_binaries(self.package_folder)
self._delete_unwanted_binaries(self._base_dir)
self._delete_unwanted_binaries(self._share_dir)

entitlements_file = "'{}'".format(Path(self.cpp_info.res_paths[2], "MacOS", "cura.entitlements"))
self._generate_pyinstaller_spec(location = self._base_dir,
entrypoint_location = "'{}'".format(os.path.join(self.package_folder, self.cpp_info.bindirs[0], self.conan_data["pyinstaller"]["runinfo"]["entrypoint"])).replace("\\", "\\\\"),
Expand Down
10 changes: 2 additions & 8 deletions cura/PrinterOutput/FormatMaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,12 @@ class FormatMaps:
"asa": {"name": "ASA", "guid": "f79bc612-21eb-482e-ad6c-87d75bdde066"},
"nylon12-cf": {"name": "Nylon 12 CF", "guid": "3c6f2877-71cc-4760-84e6-4b89ab243e3b"},
"nylon-cf": {"name": "Nylon CF", "guid": "17abb865-ca73-4ccd-aeda-38e294c9c60b"},
"nylon": {"name": "Nylon", "guid": "9475b03d-fd19-48a2-b7b5-be1fb46abb02"},
"pc": {"name": "PC", "guid": "62414577-94d1-490d-b1e4-7ef3ec40db02"},
"petg": {"name": "PETG", "guid": "2d004bbd-d1bb-47f8-beac-b066702d5273"},
"pet": {"name": "PETG", "guid": "2d004bbd-d1bb-47f8-beac-b066702d5273"},
"pla": {"name": "PLA", "guid": "abb9c58e-1f56-48d1-bd8f-055fde3a5b56"},
"pva": {"name": "PVA", "guid": "add51ef2-86eb-4c39-afd5-5586564f0715"},
"wss1": {"name": "RapidRinse", "guid": "a140ef8f-4f26-4e73-abe0-cfc29d6d1024"},
"sr30": {"name": "SR-30", "guid": "77873465-83a9-4283-bc44-4e542b8eb3eb"},
"bvoh": {"name": "BVOH", "guid": "923e604c-8432-4b09-96aa-9bbbd42207f4"},
"cpe": {"name": "CPE", "guid": "da1872c1-b991-4795-80ad-bdac0f131726"},
"hips": {"name": "HIPS", "guid": "a468d86a-220c-47eb-99a5-bbb47e514eb0"},
"tpu": {"name": "TPU 95A", "guid": "19baa6a9-94ff-478b-b4a1-8157b74358d2"},
"im-pla": {"name": "Tough", "guid": "96fca5d9-0371-4516-9e96-8e8182677f3c"}
"im-pla": {"name": "Tough", "guid": "de031137-a8ca-4a72-bd1b-17bb964033ad"}
# /!\ When changing this list, make sure the changes are reported accordingly on Digital Factory
}

Expand Down
15 changes: 10 additions & 5 deletions plugins/DigitalLibrary/src/DigitalFactoryApiClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def getListOfFilesInProject(self, library_project_id: str, on_finished: Callable
url = "{}/projects/{}/files".format(self.CURA_API_ROOT, library_project_id)
self._http.get(url,
scope = self._scope,
callback = self._parseCallback(on_finished, DigitalFactoryFileResponse, failed),
callback = self._parseCallback(on_finished, DigitalFactoryFileResponse, failed, default_values = {'username': ''}),
error_callback = failed,
timeout = self.DEFAULT_REQUEST_TIMEOUT)

Expand All @@ -205,7 +205,8 @@ def _parseCallback(self,
Callable[[List[CloudApiClientModel]], Any]],
model: Type[CloudApiClientModel],
on_error: Optional[Callable] = None,
pagination_manager: Optional[PaginationManager] = None) -> Callable[[QNetworkReply], None]:
pagination_manager: Optional[PaginationManager] = None,
default_values: Dict[str, str] = None) -> Callable[[QNetworkReply], None]:

"""
Creates a callback function so that it includes the parsing of the response into the correct model.
Expand Down Expand Up @@ -234,7 +235,7 @@ def parse(reply: QNetworkReply) -> None:
if status_code >= 300 and on_error is not None:
on_error()
else:
self._parseModels(response, on_finished, model, pagination_manager = pagination_manager)
self._parseModels(response, on_finished, model, pagination_manager = pagination_manager, default_values = default_values)

self._anti_gc_callbacks.append(parse)
return parse
Expand Down Expand Up @@ -262,7 +263,8 @@ def _parseModels(self,
on_finished: Union[Callable[[CloudApiClientModel], Any],
Callable[[List[CloudApiClientModel]], Any]],
model_class: Type[CloudApiClientModel],
pagination_manager: Optional[PaginationManager] = None) -> None:
pagination_manager: Optional[PaginationManager] = None,
default_values: Dict[str, str] = None) -> None:
"""Parses the given models and calls the correct callback depending on the result.
:param response: The response from the server, after being converted to a dict.
Expand All @@ -279,7 +281,10 @@ def _parseModels(self,
if "links" in response and pagination_manager:
pagination_manager.setLinks(response["links"])
if isinstance(data, list):
results = [model_class(**c) for c in data] # type: List[CloudApiClientModel]
results = [] # type: List[CloudApiClientModel]
for model_data in data:
complete_model_data = (default_values | model_data) if default_values is not None else model_data
results.append(model_class(**complete_model_data))
on_finished_list = cast(Callable[[List[CloudApiClientModel]], Any], on_finished)
on_finished_list(results)
else:
Expand Down
2 changes: 1 addition & 1 deletion plugins/MakerbotWriter/MakerbotWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def _getMeta(self, root_nodes: List[SceneNode]) -> Tuple[Dict[str, any], str]:
meta["preferences"] = dict()
bounds = application.getBuildVolume().getBoundingBox()
meta["preferences"]["instance0"] = {
"machineBounds": [bounds.right, bounds.back, bounds.left, bounds.front] if bounds is not None else None,
"machineBounds": [bounds.right, bounds.front, bounds.left, bounds.back] if bounds is not None else None,
"printMode": CuraApplication.getInstance().getIntentManager().currentIntentCategory,
}

Expand Down
10 changes: 0 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,6 @@ PyQt6-Qt6==6.6.0 \
--hash=sha256:8cb30d64a4d32465ea1686bc827cbe452225fb387c4873356b0fa7b9ae63534f \
--hash=sha256:a151f34712cd645111e89cb30b02e5fb69c9dcc3603ab3c03a561e874bd7cbcf \
--hash=sha256:e5483ae04bf107411c7469f1be9f9e2eb9840303e788b3ac524fe30af90d45f4
PyQt6-NetworkAuth==6.6.0 \
--hash=sha256:7b90b81792fe53105287c8cbb5e4b22bc44a482268ffb7d3e33f852807f86182 \
--hash=sha256:c7e2335159aa795e2fe6fb069ccce6308672ab80f26c50fab57caf957371cbb5 \
--hash=sha256:cdfc0bfaea16a9e09f075bdafefb996aa9fdec392052ba4fb3cbac233c1958fb \
--hash=sha256:f60ff9a62f5129dc2a9d4c495fb47f9a03e4dfb666b50fb7d61f46e89bf7b6a2
PyQt6-NetworkAuth-Qt6==6.6.0 \
--hash=sha256:481d9093e1fb1ac6843d8beabcd359cc34b74b9a2cbb3e2b68d96bd3f178d4e0 \
--hash=sha256:4cc48fd375730a0ba5fbed9d64abb2914f587377560a78a63aff893f9e276a45 \
--hash=sha256:5006deabf55304d4a3e0b3c954f93e5835546b11e789d14653a2493d12d3a063 \
--hash=sha256:bcd56bfc892fec961c51eba3c0bf32ba8317a762d9e254d3830569611ed569d6

certifi==2023.5.7; \
--hash=sha256:c6c2e98f5c7869efca1f8916fed228dd91539f9f1b444c314c06eef02980c716
Expand Down
2 changes: 1 addition & 1 deletion resources/conandata.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version: "5.9.0-beta.1"
version: "5.9.0-beta.2"
4 changes: 1 addition & 3 deletions resources/definitions/eazao_m500.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"manufacturer": "Eazao",
"file_formats": "text/x-gcode",
"has_machine_quality": false,
"has_materials": false,
"machine_extruder_trains": { "0": "eazao_m500_extruder_0" },
"preferred_material": "eazao_clay",
"preferred_quality_type": "normal"
},
"overrides":
Expand All @@ -19,7 +19,6 @@
"acceleration_travel": { "value": 300 },
"adhesion_type": { "default_value": "'none'" },
"bottom_layers": { "value": 2 },
"cool_fan_enabled": { "value": false },
"infill_sparse_density": { "value": 0 },
"initial_bottom_layers": { "value": 2 },
"jerk_print": { "value": 10 },
Expand Down Expand Up @@ -58,7 +57,6 @@
"retraction_amount": { "value": 7 },
"retraction_combing": { "value": "'noskin'" },
"retraction_count_max": { "value": 100 },
"retraction_enable": { "value": false },
"retraction_extrusion_window": { "value": 10 },
"retraction_hop": { "value": 0.2 },
"speed_print": { "value": 20.0 },
Expand Down
4 changes: 1 addition & 3 deletions resources/definitions/eazao_m600.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"manufacturer": "Eazao",
"file_formats": "text/x-gcode",
"has_machine_quality": false,
"has_materials": false,
"machine_extruder_trains": { "0": "eazao_m600_extruder_0" },
"preferred_material": "eazao_clay",
"preferred_quality_type": "normal"
},
"overrides":
Expand All @@ -19,7 +19,6 @@
"acceleration_travel": { "value": 300 },
"adhesion_type": { "default_value": "'none'" },
"bottom_layers": { "value": 2 },
"cool_fan_enabled": { "value": false },
"infill_sparse_density": { "value": 0 },
"initial_bottom_layers": { "value": 2 },
"jerk_print": { "value": 10 },
Expand Down Expand Up @@ -58,7 +57,6 @@
"retraction_amount": { "value": 7 },
"retraction_combing": { "value": "'noskin'" },
"retraction_count_max": { "value": 100 },
"retraction_enable": { "value": false },
"retraction_extrusion_window": { "value": 10 },
"retraction_hop": { "value": 0.2 },
"speed_print": { "value": 20.0 },
Expand Down
4 changes: 1 addition & 3 deletions resources/definitions/eazao_m700.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"manufacturer": "Eazao",
"file_formats": "text/x-gcode",
"has_machine_quality": false,
"has_materials": false,
"machine_extruder_trains": { "0": "eazao_m700_extruder_0" },
"preferred_material": "eazao_clay",
"preferred_quality_type": "normal"
},
"overrides":
Expand All @@ -19,7 +19,6 @@
"acceleration_travel": { "value": 300 },
"adhesion_type": { "default_value": "none" },
"bottom_layers": { "value": 2 },
"cool_fan_enabled": { "value": false },
"infill_sparse_density": { "value": 0 },
"initial_bottom_layers": { "value": 2 },
"jerk_print": { "value": 10 },
Expand Down Expand Up @@ -58,7 +57,6 @@
"retraction_amount": { "value": 7 },
"retraction_combing": { "value": "'noskin'" },
"retraction_count_max": { "value": 100 },
"retraction_enable": { "value": false },
"retraction_extrusion_window": { "value": 10 },
"retraction_hop": { "value": 0.2 },
"speed_print": { "value": 20.0 },
Expand Down
4 changes: 1 addition & 3 deletions resources/definitions/eazao_potter.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"manufacturer": "Eazao",
"file_formats": "text/x-gcode",
"has_machine_quality": false,
"has_materials": false,
"machine_extruder_trains": { "0": "eazao_potter_extruder_0" },
"preferred_material": "eazao_clay",
"preferred_quality_type": "normal"
},
"overrides":
Expand All @@ -19,7 +19,6 @@
"acceleration_travel": { "value": 300 },
"adhesion_type": { "default_value": "'none'" },
"bottom_layers": { "value": 3 },
"cool_fan_enabled": { "value": false },
"infill_sparse_density": { "value": 0 },
"initial_bottom_layers": { "value": 3 },
"jerk_print": { "value": 10 },
Expand Down Expand Up @@ -58,7 +57,6 @@
"retraction_amount": { "value": 7 },
"retraction_combing": { "value": "'noskin'" },
"retraction_count_max": { "value": 100 },
"retraction_enable": { "value": false },
"retraction_extrusion_window": { "value": 10 },
"retraction_hop": { "value": 0.2 },
"speed_print": { "value": 25.0 },
Expand Down
5 changes: 1 addition & 4 deletions resources/definitions/eazao_zero.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"manufacturer": "Eazao",
"file_formats": "text/x-gcode",
"has_machine_quality": false,
"has_materials": false,
"machine_extruder_trains": { "0": "eazao_zero_extruder_0" },
"preferred_material": "eazao_clay",
"preferred_quality_type": "normal"
},
"overrides":
Expand All @@ -20,7 +20,6 @@
"acceleration_travel": { "value": 300 },
"adhesion_type": { "default_value": "none" },
"bottom_layers": { "value": 3 },
"cool_fan_enabled": { "value": false },
"infill_sparse_density": { "value": 0 },
"initial_bottom_layers": { "value": 3 },
"jerk_print": { "value": 10 },
Expand Down Expand Up @@ -58,9 +57,7 @@
"optimize_wall_printing_order": { "value": "True" },
"retraction_amount": { "value": 7 },
"retraction_combing": { "value": "'noskin'" },
"retraction_combing_max_distance": { "value": 0 },
"retraction_count_max": { "value": 100 },
"retraction_enable": { "value": false },
"retraction_extrusion_window": { "value": 10 },
"retraction_hop": { "value": 0.2 },
"speed_print": { "value": 25.0 },
Expand Down
4 changes: 2 additions & 2 deletions resources/definitions/fdmprinter.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -8997,7 +8997,7 @@
"type": "float",
"default_value": 20.0,
"minimum_value": 1.0,
"maximum_value": 1000.0,
"maximum_value": 100000.0,
"unit": "mm/s\u00b2",
"limit_to_extruder": "wall_0_extruder_nr",
"settable_per_extruder": true,
Expand All @@ -9024,7 +9024,7 @@
"type": "float",
"default_value": 20.0,
"minimum_value": 1.0,
"maximum_value": 1000.0,
"maximum_value": 100000.0,
"unit": "mm/s\u00b2",
"limit_to_extruder": "wall_0_extruder_nr",
"settable_per_extruder": true,
Expand Down
1 change: 1 addition & 0 deletions resources/definitions/ultimaker_method.def.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"chromatik_",
"3D-Fuel_",
"bestfilament_",
"eazao_",
"emotiontech_",
"eryone_",
"eSUN_",
Expand Down
Loading

0 comments on commit 94b8728

Please sign in to comment.