Skip to content

Commit

Permalink
Merge branch 'CURA-11189-reset-intents' of github.com:Ultimaker/Cura …
Browse files Browse the repository at this point in the history
…into 5.5
  • Loading branch information
nallath committed Oct 24, 2023
2 parents 996bea1 + fa1f5a7 commit 7afcf16
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
10 changes: 10 additions & 0 deletions cura/Settings/MachineManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -1700,6 +1700,16 @@ def setIntentByCategory(self, intent_category: str) -> None:
else: # No intent had the correct category.
extruder.intent = empty_intent_container

@pyqtSlot()
def resetIntents(self) -> None:
"""Reset the intent category of the current printer.
"""
global_stack = self._application.getGlobalContainerStack()
if global_stack is None:
return
for extruder in global_stack.extruderList:
extruder.intent = empty_intent_container

def activeQualityGroup(self) -> Optional["QualityGroup"]:
"""Get the currently activated quality group.
Expand Down
4 changes: 3 additions & 1 deletion plugins/3MFReader/ThreeMFWorkspaceReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,9 @@ def _updateActiveMachine(self, global_stack):
available_intent_category_list = IntentManager.getInstance().currentAvailableIntentCategories()
if self._intent_category_to_apply is not None and self._intent_category_to_apply in available_intent_category_list:
machine_manager.setIntentByCategory(self._intent_category_to_apply)

else:
# if no intent is provided, reset to the default (balanced) intent
machine_manager.resetIntents()
# Notify everything/one that is to notify about changes.
global_stack.containersChanged.emit(global_stack.getTop())

Expand Down
20 changes: 12 additions & 8 deletions plugins/3MFReader/WorkspaceDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ def __init__(self, parent = None) -> None:
self._qml_url = "WorkspaceDialog.qml"
self._lock = threading.Lock()
self._default_strategy = None
self._result = {"machine": self._default_strategy,
"quality_changes": self._default_strategy,
"definition_changes": self._default_strategy,
"material": self._default_strategy}
self._result = {
"machine": self._default_strategy,
"quality_changes": self._default_strategy,
"definition_changes": self._default_strategy,
"material": self._default_strategy,
}
self._override_machine = None
self._visible = False
self.showDialogSignal.connect(self.__show)
Expand Down Expand Up @@ -347,10 +349,12 @@ def show(self) -> None:
if threading.current_thread() != threading.main_thread():
self._lock.acquire()
# Reset the result
self._result = {"machine": self._default_strategy,
"quality_changes": self._default_strategy,
"definition_changes": self._default_strategy,
"material": self._default_strategy}
self._result = {
"machine": self._default_strategy,
"quality_changes": self._default_strategy,
"definition_changes": self._default_strategy,
"material": self._default_strategy,
}
self._visible = True
self.showDialogSignal.emit()

Expand Down

0 comments on commit 7afcf16

Please sign in to comment.