mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Merge branch 'CURA-6800_project_file_intent' of github.com:Ultimaker/Cura into feature_intent
This commit is contained in:
commit
56c7fb9f7d
5 changed files with 76 additions and 12 deletions
|
@ -613,8 +613,8 @@ class MachineManager(QObject):
|
||||||
return False
|
return False
|
||||||
return Util.parseBool(global_container_stack.quality.getMetaDataEntry("is_experimental", False))
|
return Util.parseBool(global_container_stack.quality.getMetaDataEntry("is_experimental", False))
|
||||||
|
|
||||||
@pyqtProperty(str, notify=activeIntentChanged)
|
@pyqtProperty(str, notify = activeIntentChanged)
|
||||||
def activeIntentCategory(self):
|
def activeIntentCategory(self) -> str:
|
||||||
global_container_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
|
global_container_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()
|
||||||
|
|
||||||
if not global_container_stack:
|
if not global_container_stack:
|
||||||
|
|
|
@ -24,11 +24,11 @@ from UM.Job import Job
|
||||||
from UM.Preferences import Preferences
|
from UM.Preferences import Preferences
|
||||||
|
|
||||||
from cura.Machines.ContainerTree import ContainerTree
|
from cura.Machines.ContainerTree import ContainerTree
|
||||||
from cura.Machines.VariantType import VariantType
|
|
||||||
from cura.Settings.CuraStackBuilder import CuraStackBuilder
|
from cura.Settings.CuraStackBuilder import CuraStackBuilder
|
||||||
from cura.Settings.ExtruderManager import ExtruderManager
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
from cura.Settings.ExtruderStack import ExtruderStack
|
from cura.Settings.ExtruderStack import ExtruderStack
|
||||||
from cura.Settings.GlobalStack import GlobalStack
|
from cura.Settings.GlobalStack import GlobalStack
|
||||||
|
from cura.Settings.IntentManager import IntentManager
|
||||||
from cura.Settings.CuraContainerStack import _ContainerIndexes
|
from cura.Settings.CuraContainerStack import _ContainerIndexes
|
||||||
from cura.CuraApplication import CuraApplication
|
from cura.CuraApplication import CuraApplication
|
||||||
from cura.Utils.Threading import call_on_qt_thread
|
from cura.Utils.Threading import call_on_qt_thread
|
||||||
|
@ -65,6 +65,7 @@ class MachineInfo:
|
||||||
self.metadata_dict = {} # type: Dict[str, str]
|
self.metadata_dict = {} # type: Dict[str, str]
|
||||||
|
|
||||||
self.quality_type = None
|
self.quality_type = None
|
||||||
|
self.intent_category = None
|
||||||
self.custom_quality_name = None
|
self.custom_quality_name = None
|
||||||
self.quality_changes_info = None
|
self.quality_changes_info = None
|
||||||
self.variant_info = None
|
self.variant_info = None
|
||||||
|
@ -84,6 +85,7 @@ class ExtruderInfo:
|
||||||
|
|
||||||
self.definition_changes_info = None
|
self.definition_changes_info = None
|
||||||
self.user_changes_info = None
|
self.user_changes_info = None
|
||||||
|
self.intent_info = None
|
||||||
|
|
||||||
|
|
||||||
## Base implementation for reading 3MF workspace files.
|
## Base implementation for reading 3MF workspace files.
|
||||||
|
@ -266,6 +268,8 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
instance_container_files = [name for name in cura_file_names if name.endswith(self._instance_container_suffix)]
|
instance_container_files = [name for name in cura_file_names if name.endswith(self._instance_container_suffix)]
|
||||||
quality_name = ""
|
quality_name = ""
|
||||||
custom_quality_name = ""
|
custom_quality_name = ""
|
||||||
|
intent_name = ""
|
||||||
|
intent_category = ""
|
||||||
num_settings_overridden_by_quality_changes = 0 # How many settings are changed by the quality changes
|
num_settings_overridden_by_quality_changes = 0 # How many settings are changed by the quality changes
|
||||||
num_user_settings = 0
|
num_user_settings = 0
|
||||||
quality_changes_conflict = False
|
quality_changes_conflict = False
|
||||||
|
@ -323,6 +327,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
elif container_type == "quality":
|
elif container_type == "quality":
|
||||||
if not quality_name:
|
if not quality_name:
|
||||||
quality_name = parser["general"]["name"]
|
quality_name = parser["general"]["name"]
|
||||||
|
elif container_type == "intent":
|
||||||
|
if not intent_name:
|
||||||
|
intent_name = parser["general"]["name"]
|
||||||
|
intent_category = parser["metadata"]["intent_category"]
|
||||||
elif container_type == "user":
|
elif container_type == "user":
|
||||||
num_user_settings += len(parser["values"])
|
num_user_settings += len(parser["values"])
|
||||||
elif container_type in self._ignored_instance_container_types:
|
elif container_type in self._ignored_instance_container_types:
|
||||||
|
@ -444,6 +452,10 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
extruder_info.user_changes_info = instance_container_info_dict[user_changes_id]
|
extruder_info.user_changes_info = instance_container_info_dict[user_changes_id]
|
||||||
self._machine_info.extruder_info_dict[position] = extruder_info
|
self._machine_info.extruder_info_dict[position] = extruder_info
|
||||||
|
|
||||||
|
intent_id = parser["containers"][str(_ContainerIndexes.Intent)]
|
||||||
|
if intent_id not in ("empty", "empty_intent"):
|
||||||
|
extruder_info.intent_info = instance_container_info_dict[intent_id]
|
||||||
|
|
||||||
if not machine_conflict and containers_found_dict["machine"]:
|
if not machine_conflict and containers_found_dict["machine"]:
|
||||||
if position not in global_stack.extruders:
|
if position not in global_stack.extruders:
|
||||||
continue
|
continue
|
||||||
|
@ -508,6 +520,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
self._machine_info.definition_id = machine_definition_id
|
self._machine_info.definition_id = machine_definition_id
|
||||||
self._machine_info.quality_type = quality_type
|
self._machine_info.quality_type = quality_type
|
||||||
self._machine_info.custom_quality_name = quality_name
|
self._machine_info.custom_quality_name = quality_name
|
||||||
|
self._machine_info.intent_category = intent_category
|
||||||
|
|
||||||
if machine_conflict and not self._is_same_machine_type:
|
if machine_conflict and not self._is_same_machine_type:
|
||||||
machine_conflict = False
|
machine_conflict = False
|
||||||
|
@ -528,6 +541,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
self._dialog.setNumVisibleSettings(num_visible_settings)
|
self._dialog.setNumVisibleSettings(num_visible_settings)
|
||||||
self._dialog.setQualityName(quality_name)
|
self._dialog.setQualityName(quality_name)
|
||||||
self._dialog.setQualityType(quality_type)
|
self._dialog.setQualityType(quality_type)
|
||||||
|
self._dialog.setIntentName(intent_name)
|
||||||
self._dialog.setNumSettingsOverriddenByQualityChanges(num_settings_overridden_by_quality_changes)
|
self._dialog.setNumSettingsOverriddenByQualityChanges(num_settings_overridden_by_quality_changes)
|
||||||
self._dialog.setNumUserSettings(num_user_settings)
|
self._dialog.setNumUserSettings(num_user_settings)
|
||||||
self._dialog.setActiveMode(active_mode)
|
self._dialog.setActiveMode(active_mode)
|
||||||
|
@ -965,10 +979,12 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
# prepare the quality to select
|
# prepare the quality to select
|
||||||
self._quality_changes_to_apply = None
|
self._quality_changes_to_apply = None
|
||||||
self._quality_type_to_apply = None
|
self._quality_type_to_apply = None
|
||||||
|
self._intent_category_to_apply = None
|
||||||
if self._machine_info.quality_changes_info is not None:
|
if self._machine_info.quality_changes_info is not None:
|
||||||
self._quality_changes_to_apply = self._machine_info.quality_changes_info.name
|
self._quality_changes_to_apply = self._machine_info.quality_changes_info.name
|
||||||
else:
|
else:
|
||||||
self._quality_type_to_apply = self._machine_info.quality_type
|
self._quality_type_to_apply = self._machine_info.quality_type
|
||||||
|
self._intent_category_to_apply = self._machine_info.intent_category
|
||||||
|
|
||||||
# Set enabled/disabled for extruders
|
# Set enabled/disabled for extruders
|
||||||
for position, extruder_stack in extruder_stack_dict.items():
|
for position, extruder_stack in extruder_stack_dict.items():
|
||||||
|
@ -1018,6 +1034,11 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
|
||||||
if quality_group is not None:
|
if quality_group is not None:
|
||||||
machine_manager.setQualityGroup(quality_group, no_dialog = True)
|
machine_manager.setQualityGroup(quality_group, no_dialog = True)
|
||||||
|
|
||||||
|
# Also apply intent if available
|
||||||
|
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)
|
||||||
|
|
||||||
# Notify everything/one that is to notify about changes.
|
# Notify everything/one that is to notify about changes.
|
||||||
global_stack.containersChanged.emit(global_stack.getTop())
|
global_stack.containersChanged.emit(global_stack.getTop())
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@ class WorkspaceDialog(QObject):
|
||||||
self._quality_name = ""
|
self._quality_name = ""
|
||||||
self._num_settings_overridden_by_quality_changes = 0
|
self._num_settings_overridden_by_quality_changes = 0
|
||||||
self._quality_type = ""
|
self._quality_type = ""
|
||||||
|
self._intent_name = ""
|
||||||
self._machine_name = ""
|
self._machine_name = ""
|
||||||
self._machine_type = ""
|
self._machine_type = ""
|
||||||
self._variant_type = ""
|
self._variant_type = ""
|
||||||
|
@ -60,6 +61,7 @@ class WorkspaceDialog(QObject):
|
||||||
hasVisibleSettingsFieldChanged = pyqtSignal()
|
hasVisibleSettingsFieldChanged = pyqtSignal()
|
||||||
numSettingsOverridenByQualityChangesChanged = pyqtSignal()
|
numSettingsOverridenByQualityChangesChanged = pyqtSignal()
|
||||||
qualityTypeChanged = pyqtSignal()
|
qualityTypeChanged = pyqtSignal()
|
||||||
|
intentNameChanged = pyqtSignal()
|
||||||
machineNameChanged = pyqtSignal()
|
machineNameChanged = pyqtSignal()
|
||||||
materialLabelsChanged = pyqtSignal()
|
materialLabelsChanged = pyqtSignal()
|
||||||
objectsOnPlateChanged = pyqtSignal()
|
objectsOnPlateChanged = pyqtSignal()
|
||||||
|
@ -166,6 +168,15 @@ class WorkspaceDialog(QObject):
|
||||||
self._quality_name = quality_name
|
self._quality_name = quality_name
|
||||||
self.qualityNameChanged.emit()
|
self.qualityNameChanged.emit()
|
||||||
|
|
||||||
|
@pyqtProperty(str, notify = intentNameChanged)
|
||||||
|
def intentName(self) -> str:
|
||||||
|
return self._intent_name
|
||||||
|
|
||||||
|
def setIntentName(self, intent_name: str) -> None:
|
||||||
|
if self._intent_name != intent_name:
|
||||||
|
self._intent_name = intent_name
|
||||||
|
self.intentNameChanged.emit()
|
||||||
|
|
||||||
@pyqtProperty(str, notify=activeModeChanged)
|
@pyqtProperty(str, notify=activeModeChanged)
|
||||||
def activeMode(self):
|
def activeMode(self):
|
||||||
return self._active_mode
|
return self._active_mode
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Copyright (c) 2016 Ultimaker B.V.
|
// Copyright (c) 2016 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 QtQuick 2.1
|
import QtQuick 2.10
|
||||||
import QtQuick.Controls 1.1
|
import QtQuick.Controls 1.4
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Window 2.1
|
import QtQuick.Window 2.2
|
||||||
|
|
||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ UM.Dialog
|
||||||
onClosing: manager.notifyClosed()
|
onClosing: manager.notifyClosed()
|
||||||
onVisibleChanged:
|
onVisibleChanged:
|
||||||
{
|
{
|
||||||
if(visible)
|
if (visible)
|
||||||
{
|
{
|
||||||
machineResolveComboBox.currentIndex = 0
|
machineResolveComboBox.currentIndex = 0
|
||||||
qualityChangesResolveComboBox.currentIndex = 0
|
qualityChangesResolveComboBox.currentIndex = 0
|
||||||
|
@ -223,6 +223,21 @@ UM.Dialog
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Row
|
Row
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
height: childrenRect.height
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: catalog.i18nc("@action:label", "Intent")
|
||||||
|
width: (parent.width / 3) | 0
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: manager.intentName
|
||||||
|
width: (parent.width / 3) | 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Row
|
||||||
{
|
{
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: manager.numUserSettings != 0 ? childrenRect.height : 0
|
height: manager.numUserSettings != 0 ? childrenRect.height : 0
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// 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 QtQuick 2.1
|
import QtQuick 2.10
|
||||||
import QtQuick.Controls 1.1
|
import QtQuick.Controls 1.4
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.3
|
||||||
import QtQuick.Window 2.1
|
import QtQuick.Window 2.2
|
||||||
|
|
||||||
import UM 1.2 as UM
|
import UM 1.2 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
|
@ -256,6 +256,23 @@ UM.Dialog
|
||||||
width: Math.floor(scroll.width / 3) | 0
|
width: Math.floor(scroll.width / 3) | 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Intent
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
width: parent.width
|
||||||
|
height: childrenRect.height
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: catalog.i18nc("@action:label", "Intent")
|
||||||
|
width: Math.floor(scroll.width / 3) | 0
|
||||||
|
}
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
text: Cura.MachineManager.activeIntentCategory
|
||||||
|
width: Math.floor(scroll.width / 3) | 0
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue