Skip to content

Commit

Permalink
Merge branch 'main' into ja-i18n-improve
Browse files Browse the repository at this point in the history
  • Loading branch information
wawanbreton authored Oct 8, 2024
2 parents 0b11f54 + 96abc03 commit fa34d24
Show file tree
Hide file tree
Showing 7,673 changed files with 63,615 additions and 8,392 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 1 addition & 1 deletion .github/workflows/printer-linter-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: technote-space/get-diff-action@v6
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/printer-linter-pr-diagnose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
echo ${{ github.event.pull_request.head.repo.full_name }} > printer-linter-result/pr-head-repo.txt
echo ${{ github.event.pull_request.head.sha }} > printer-linter-result/pr-head-sha.txt
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: printer-linter-result
path: printer-linter-result/
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/release-process_release-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ on:
required: true
type: string

publish_release_description:
description: 'Create the GitHub release (if existing, the description will be overridden based on the changelog)'
required: true
type: boolean

jobs:
parse-version:
name: Parse input version string
Expand Down Expand Up @@ -153,10 +158,12 @@ jobs:
ref: ${{ needs.parse-version.outputs.branch_name }}

- name: Extract changelog
if: ${{ inputs.publish_release_description }}
run: python ./scripts/extract_changelog.py --version ${{ needs.parse-version.outputs.version_major }}.${{ needs.parse-version.outputs.version_minor }}.${{ needs.parse-version.outputs.version_patch }} --changelog ./resources/texts/change_log.txt > formatted_changelog.txt

- name: Create release
uses: notpeelz/action-gh-create-release@v5.0.1
if: ${{ inputs.publish_release_description }}
with:
target: ${{ needs.create-tags.outputs.main_commit }}
tag: ${{ inputs.cura_version }}
Expand Down
2 changes: 1 addition & 1 deletion conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ requirements:
- "pynest2d/5.3.0"
- "native_cad_plugin/2.0.0"
requirements_internal:
- "fdm_materials/(latest)@internal/testing"
- "fdm_materials/5.8.1"
- "cura_private_data/(latest)@internal/testing"
urls:
default:
Expand Down
1 change: 1 addition & 0 deletions cura/API/Account.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def _onLoginStateChanged(self, logged_in: bool = False, error_message: Optional[

def _onProfileChanged(self, profile: Optional[UserProfile]) -> None:
self._user_profile = profile
self._updatePermissions()
self.userProfileChanged.emit()

def _sync(self) -> None:
Expand Down
2 changes: 1 addition & 1 deletion cura/CuraApplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class CuraApplication(QtApplication):
# SettingVersion represents the set of settings available in the machine/extruder definitions.
# You need to make sure that this version number needs to be increased if there is any non-backwards-compatible
# changes of the settings.
SettingVersion = 23
SettingVersion = 24

Created = False

Expand Down
1 change: 1 addition & 0 deletions cura/Machines/MachineNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, container_id: str) -> None:
self.preferred_variant_name = my_metadata.get("preferred_variant_name", "")
self.preferred_material = my_metadata.get("preferred_material", "")
self.preferred_quality_type = my_metadata.get("preferred_quality_type", "")
self.supports_abstract_color = parseBool(my_metadata.get("supports_abstract_color", "false"))

self._loadAll()

Expand Down
7 changes: 3 additions & 4 deletions cura/Machines/Models/QualityManagementModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,12 @@ def renameQualityChangesGroup(self, quality_changes_group: "QualityChangesGroup"
# have no container for the global stack, because "my_profile" just got renamed to "my_new_profile". This results
# in crashes because the rest of the system assumes that all data in a QualityChangesGroup will be correct.
#
# Renaming the container for the global stack in the end seems to be ok, because the assumption is mostly based
# on the quality changes container for the global stack.
# This is why we use the "supress_signals" flag for the set name. This basically makes the change silent.
for metadata in quality_changes_group.metadata_per_extruder.values():
extruder_container = cast(InstanceContainer, container_registry.findContainers(id = metadata["id"])[0])
extruder_container.setName(new_name)
extruder_container.setName(new_name, supress_signals=True)
global_container = cast(InstanceContainer, container_registry.findContainers(id = quality_changes_group.metadata_for_global["id"])[0])
global_container.setName(new_name)
global_container.setName(new_name, supress_signals=True)

quality_changes_group.name = new_name

Expand Down
4 changes: 4 additions & 0 deletions cura/Machines/VariantNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ def _loadAll(self) -> None:
filtered_materials = [material for material in materials if not self.machine.isExcludedMaterialBaseFile(material["id"])]

for material in filtered_materials:
if material.get("abstract_color", False) and not self.machine.supports_abstract_color:
continue # do not show abstract color profiles if the machine does not support them
base_file = material["base_file"]
if base_file not in self.materials:
self.materials[base_file] = MaterialNode(material["id"], variant = self)
Expand Down Expand Up @@ -126,6 +128,8 @@ def _materialAdded(self, container: ContainerInterface) -> None:
return # We won't add any materials.
material_definition = container.getMetaDataEntry("definition")

if (not self.machine.supports_abstract_color) and container.getMetaDataEntry("abstract_color", False):
return
base_file = container.getMetaDataEntry("base_file")
if self.machine.isExcludedMaterialBaseFile(base_file):
return # Material is forbidden for this printer.
Expand Down
10 changes: 6 additions & 4 deletions cura/PrinterOutput/FormatMaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ class FormatMaps:

# A map from the material-name in their native file-formats to some info, including the internal name we use.
MATERIAL_MAP = {
"abs": {"name": "ABS", "guid": "2780b345-577b-4a24-a2c5-12e6aad3e690"},
"abs": {"name": "ABS", "guid": "e0f1d581-cc6b-4e36-8f3c-3f5601ecba5f"},
"abs-cf10": {"name": "ABS-CF", "guid": "495a0ce5-9daf-4a16-b7b2-06856d82394d"},
"abs-wss1": {"name": "ABS-R", "guid": "88c8919c-6a09-471a-b7b6-e801263d862d"},
"asa": {"name": "ASA", "guid": "f79bc612-21eb-482e-ad6c-87d75bdde066"},
"nylon12-cf": {"name": "Nylon 12 CF", "guid": "3c6f2877-71cc-4760-84e6-4b89ab243e3b"},
"nylon": {"name": "Nylon", "guid": "283d439a-3490-4481-920c-c51d8cdecf9c"},
"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": "69386c85-5b6c-421a-bec5-aeb1fb33f060"},
"petg": {"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"},
Expand All @@ -44,7 +45,8 @@ class FormatMaps:
"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": "de031137-a8ca-4a72-bd1b-17bb964033ad"}
"im-pla": {"name": "Tough", "guid": "96fca5d9-0371-4516-9e96-8e8182677f3c"}
# /!\ When changing this list, make sure the changes are reported accordingly on Digital Factory
}

__inverse_printer_name: Optional[Dict[str, str]] = None
Expand Down
3 changes: 2 additions & 1 deletion cura/Settings/CuraContainerStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from PyQt6.QtCore import pyqtProperty, pyqtSignal, QObject

from UM.Application import Application
from UM.Decorators import override
from UM.Decorators import CachedMemberFunctions, override
from UM.FlameProfiler import pyqtSlot
from UM.Logger import Logger
from UM.Settings.ContainerStack import ContainerStack, InvalidContainerStackError
Expand Down Expand Up @@ -237,6 +237,7 @@ def setProperty(self, key: str, property_name: str, property_value: Any, contain
:param new_value: The new value to set the property to.
"""

CachedMemberFunctions.clearInstanceCache(self)
container_index = _ContainerIndexes.UserChanges
self._containers[container_index].setProperty(key, property_name, property_value, container, set_from_cache)

Expand Down
3 changes: 2 additions & 1 deletion cura/Settings/ExtruderStack.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from PyQt6.QtCore import pyqtProperty, pyqtSignal

from UM.Decorators import override
from UM.Decorators import CachedMemberFunctions, override
from UM.MimeTypeDatabase import MimeType, MimeTypeDatabase
from UM.Settings.ContainerStack import ContainerStack
from UM.Settings.ContainerRegistry import ContainerRegistry
Expand Down Expand Up @@ -86,6 +86,7 @@ def getCompatibleMaterialDiameter(self) -> float:
def setCompatibleMaterialDiameter(self, value: float) -> None:
old_approximate_diameter = self.getApproximateMaterialDiameter()
if self.getCompatibleMaterialDiameter() != value:
CachedMemberFunctions.clearInstanceCache(self)
self.definitionChanges.setProperty("material_diameter", "value", value)
self.compatibleMaterialDiameterChanged.emit()

Expand Down
1 change: 1 addition & 0 deletions packaging/NSIS/Ultimaker-Cura.nsi.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ CreateShortCut "$SMPROGRAMS\{{ app_name }}\UltiMaker Cura website.lnk" "$INSTDIR
WriteRegStr ${REG_ROOT} "${REG_APP_PATH}" "" "$INSTDIR\${MAIN_APP_EXE}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayName" "${APP_NAME}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "QuietUninstallString" '"$INSTDIR\uninstall.exe" /S'
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayIcon" "$INSTDIR\${MAIN_APP_EXE}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "DisplayVersion" "${VERSION}"
WriteRegStr ${REG_ROOT} "${UNINSTALL_PATH}" "Publisher" "${COMP_NAME}"
Expand Down
25 changes: 22 additions & 3 deletions plugins/3MFWriter/ThreeMFWorkspaceWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
from threading import Lock
import zipfile
from typing import Dict, Any
from pathlib import Path
from zipfile import ZipFile

from UM.Application import Application
from UM.Logger import Logger
from UM.PluginRegistry import PluginRegistry
from UM.Preferences import Preferences
from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.Workspace.WorkspaceWriter import WorkspaceWriter
Expand All @@ -33,7 +36,7 @@ def setExportModel(self, model: SettingsExportModel) -> None:
if self._ucp_model != model:
self._ucp_model = model

def _write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode):
def _write(self, stream, nodes, mode, include_log):
application = Application.getInstance()
machine_manager = application.getMachineManager()

Expand Down Expand Up @@ -79,6 +82,11 @@ def _write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode):
if self._ucp_model is not None:
user_settings_data = self._getUserSettings(self._ucp_model)
ThreeMFWriter._storeMetadataJson(user_settings_data, archive, USER_SETTINGS_PATH)

# Write log file
if include_log:
ThreeMFWorkspaceWriter._writeLogFile(archive)

except PermissionError:
self.setInformation(catalog.i18nc("@error:zip", "No permission to write the workspace here."))
Logger.error("No permission to write workspace to this stream.")
Expand Down Expand Up @@ -125,8 +133,8 @@ def _write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode):

return True

def write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode):
success = self._write(stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode)
def write(self, stream, nodes, mode=WorkspaceWriter.OutputMode.BinaryMode, **kwargs):
success = self._write(stream, nodes, WorkspaceWriter.OutputMode.BinaryMode, kwargs.get("include_log", False))
self._ucp_model = None
return success

Expand Down Expand Up @@ -191,6 +199,17 @@ def _writeContainerToArchive(container, archive):
Logger.error("File became inaccessible while writing to it: {archive_filename}".format(archive_filename = archive.fp.name))
return

@staticmethod
def _writeLogFile(archive: ZipFile) -> None:
"""Helper function that writes the Cura log file to the archive.
:param archive: The archive to write to.
"""
file_logger = PluginRegistry.getInstance().getPluginObject("FileLogger")
file_logger.flush()
for file_path in file_logger.getFilesPaths():
archive.write(file_path, arcname=f"log/{Path(file_path).name}")

@staticmethod
def _getUserSettings(model: SettingsExportModel) -> Dict[str, Dict[str, Any]]:
user_settings = {}
Expand Down
19 changes: 17 additions & 2 deletions plugins/CuraEngineBackend/CuraEngineBackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ def __init__(self) -> None:
self._slicing_error_message.actionTriggered.connect(self._reportBackendError)

self._resetLastSliceTimeStats()
self._snapshot: Optional[QImage] = None
self._snapshot: Optional[QImage] = None
self._last_socket_error: Optional[Arcus.Error] = None

application.initializationFinished.connect(self.initialize)

Expand Down Expand Up @@ -569,7 +570,20 @@ def _onStartSliceCompleted(self, job: StartSliceJob) -> None:
return

# Preparation completed, send it to the backend.
self._socket.sendMessage(job.getSliceMessage())
immediate_success = self._socket.sendMessage(job.getSliceMessage())
if (not CuraApplication.getInstance().getUseExternalBackend()) and (not immediate_success):
if self._last_socket_error is not None and self._last_socket_error.getErrorCode() == Arcus.ErrorCode.MessageTooBigError:
error_txt = catalog.i18nc("@info:status", "Unable to send the model data to the engine. Please try to use a less detailed model, or reduce the number of instances.")
else:
error_txt = catalog.i18nc("@info:status", "Unable to send the model data to the engine. Please try again, or contact support.")

self._error_message = Message(error_txt,
title=catalog.i18nc("@info:title", "Unable to slice"),
message_type=Message.MessageType.WARNING)
self._error_message.show()
self.setState(BackendState.Error)
self.backendError.emit(job)
return

# Notify the user that it's now up to the backend to do its job
self.setState(BackendState.Processing)
Expand Down Expand Up @@ -691,6 +705,7 @@ def _onSocketError(self, error: Arcus.Error) -> None:
if error.getErrorCode() == Arcus.ErrorCode.Debug:
return

self._last_socket_error = error
self._terminate()
self._createSocket()

Expand Down
Loading

0 comments on commit fa34d24

Please sign in to comment.