mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 11:05:57 +08:00
Merge branch '4.0' into STAR-322_cloud-connection
This commit is contained in:
commit
2772b3bcbd
@ -198,6 +198,8 @@ class CuraApplication(QtApplication):
|
|||||||
self._container_manager = None
|
self._container_manager = None
|
||||||
|
|
||||||
self._object_manager = None
|
self._object_manager = None
|
||||||
|
self._extruders_model = None
|
||||||
|
self._extruders_model_with_optional = None
|
||||||
self._build_plate_model = None
|
self._build_plate_model = None
|
||||||
self._multi_build_plate_model = None
|
self._multi_build_plate_model = None
|
||||||
self._setting_visibility_presets_model = None
|
self._setting_visibility_presets_model = None
|
||||||
@ -855,6 +857,19 @@ class CuraApplication(QtApplication):
|
|||||||
self._object_manager = ObjectsModel.createObjectsModel()
|
self._object_manager = ObjectsModel.createObjectsModel()
|
||||||
return self._object_manager
|
return self._object_manager
|
||||||
|
|
||||||
|
@pyqtSlot(result = QObject)
|
||||||
|
def getExtrudersModel(self, *args) -> "ExtrudersModel":
|
||||||
|
if self._extruders_model is None:
|
||||||
|
self._extruders_model = ExtrudersModel(self)
|
||||||
|
return self._extruders_model
|
||||||
|
|
||||||
|
@pyqtSlot(result = QObject)
|
||||||
|
def getExtrudersModelWithOptional(self, *args) -> "ExtrudersModel":
|
||||||
|
if self._extruders_model_with_optional is None:
|
||||||
|
self._extruders_model_with_optional = ExtrudersModel(self)
|
||||||
|
self._extruders_model_with_optional.setAddOptionalExtruder(True)
|
||||||
|
return self._extruders_model_with_optional
|
||||||
|
|
||||||
@pyqtSlot(result = QObject)
|
@pyqtSlot(result = QObject)
|
||||||
def getMultiBuildPlateModel(self, *args) -> MultiBuildPlateModel:
|
def getMultiBuildPlateModel(self, *args) -> MultiBuildPlateModel:
|
||||||
if self._multi_build_plate_model is None:
|
if self._multi_build_plate_model is None:
|
||||||
|
@ -33,8 +33,6 @@ class NozzleModel(ListModel):
|
|||||||
def _update(self):
|
def _update(self):
|
||||||
Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__))
|
Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__))
|
||||||
|
|
||||||
self.items.clear()
|
|
||||||
|
|
||||||
global_stack = self._machine_manager.activeMachine
|
global_stack = self._machine_manager.activeMachine
|
||||||
if global_stack is None:
|
if global_stack is None:
|
||||||
self.setItems([])
|
self.setItems([])
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# 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.
|
||||||
|
|
||||||
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot, pyqtProperty, QTimer
|
from PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty, QTimer
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
@ -78,8 +78,6 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||||||
self._update_extruder_timer.setSingleShot(True)
|
self._update_extruder_timer.setSingleShot(True)
|
||||||
self._update_extruder_timer.timeout.connect(self.__updateExtruders)
|
self._update_extruder_timer.timeout.connect(self.__updateExtruders)
|
||||||
|
|
||||||
self._simple_names = False
|
|
||||||
|
|
||||||
self._active_machine_extruders = [] # type: Iterable[ExtruderStack]
|
self._active_machine_extruders = [] # type: Iterable[ExtruderStack]
|
||||||
self._add_optional_extruder = False
|
self._add_optional_extruder = False
|
||||||
|
|
||||||
@ -101,21 +99,6 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||||||
def addOptionalExtruder(self):
|
def addOptionalExtruder(self):
|
||||||
return self._add_optional_extruder
|
return self._add_optional_extruder
|
||||||
|
|
||||||
## Set the simpleNames property.
|
|
||||||
def setSimpleNames(self, simple_names):
|
|
||||||
if simple_names != self._simple_names:
|
|
||||||
self._simple_names = simple_names
|
|
||||||
self.simpleNamesChanged.emit()
|
|
||||||
self._updateExtruders()
|
|
||||||
|
|
||||||
## Emitted when the simpleNames property changes.
|
|
||||||
simpleNamesChanged = pyqtSignal()
|
|
||||||
|
|
||||||
## Whether or not the model should show all definitions regardless of visibility.
|
|
||||||
@pyqtProperty(bool, fset = setSimpleNames, notify = simpleNamesChanged)
|
|
||||||
def simpleNames(self):
|
|
||||||
return self._simple_names
|
|
||||||
|
|
||||||
## Links to the stack-changed signal of the new extruders when an extruder
|
## Links to the stack-changed signal of the new extruders when an extruder
|
||||||
# is swapped out or added in the current machine.
|
# is swapped out or added in the current machine.
|
||||||
#
|
#
|
||||||
@ -221,7 +204,12 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
|
|||||||
"enabled": True,
|
"enabled": True,
|
||||||
"color": "#ffffff",
|
"color": "#ffffff",
|
||||||
"index": -1,
|
"index": -1,
|
||||||
"definition": ""
|
"definition": "",
|
||||||
|
"material": "",
|
||||||
|
"variant": "",
|
||||||
|
"stack": None,
|
||||||
|
"material_brand": "",
|
||||||
|
"color_name": "",
|
||||||
}
|
}
|
||||||
items.append(item)
|
items.append(item)
|
||||||
if self._items != items:
|
if self._items != items:
|
||||||
|
@ -88,12 +88,14 @@ class MachineManager(QObject):
|
|||||||
|
|
||||||
self._onGlobalContainerChanged()
|
self._onGlobalContainerChanged()
|
||||||
|
|
||||||
ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderStackChanged)
|
extruder_manager = self._application.getExtruderManager()
|
||||||
|
|
||||||
|
extruder_manager.activeExtruderChanged.connect(self._onActiveExtruderStackChanged)
|
||||||
self._onActiveExtruderStackChanged()
|
self._onActiveExtruderStackChanged()
|
||||||
|
|
||||||
ExtruderManager.getInstance().activeExtruderChanged.connect(self.activeMaterialChanged)
|
extruder_manager.activeExtruderChanged.connect(self.activeMaterialChanged)
|
||||||
ExtruderManager.getInstance().activeExtruderChanged.connect(self.activeVariantChanged)
|
extruder_manager.activeExtruderChanged.connect(self.activeVariantChanged)
|
||||||
ExtruderManager.getInstance().activeExtruderChanged.connect(self.activeQualityChanged)
|
extruder_manager.activeExtruderChanged.connect(self.activeQualityChanged)
|
||||||
|
|
||||||
self.globalContainerChanged.connect(self.activeStackChanged)
|
self.globalContainerChanged.connect(self.activeStackChanged)
|
||||||
self.globalValueChanged.connect(self.activeStackValueChanged)
|
self.globalValueChanged.connect(self.activeStackValueChanged)
|
||||||
|
@ -13,7 +13,7 @@ import Cura 1.0 as Cura
|
|||||||
Cura.MachineAction
|
Cura.MachineAction
|
||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
property var extrudersModel: Cura.ExtrudersModel{}
|
property var extrudersModel: CuraApplication.getExtrudersModel()
|
||||||
property int extruderTabsCount: 0
|
property int extruderTabsCount: 0
|
||||||
|
|
||||||
property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : ""
|
property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : ""
|
||||||
|
@ -163,7 +163,7 @@ Cura.ExpandableComponent
|
|||||||
|
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
model: Cura.ExtrudersModel{}
|
model: CuraApplication.getExtrudersModel()
|
||||||
|
|
||||||
CheckBox
|
CheckBox
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,6 @@ from UM.Math.Color import Color
|
|||||||
from UM.View.GL.OpenGL import OpenGL
|
from UM.View.GL.OpenGL import OpenGL
|
||||||
|
|
||||||
from cura.Settings.ExtruderManager import ExtruderManager
|
from cura.Settings.ExtruderManager import ExtruderManager
|
||||||
from cura.Settings.ExtrudersModel import ExtrudersModel
|
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
@ -29,13 +28,16 @@ class SolidView(View):
|
|||||||
self._non_printing_shader = None
|
self._non_printing_shader = None
|
||||||
self._support_mesh_shader = None
|
self._support_mesh_shader = None
|
||||||
|
|
||||||
self._extruders_model = ExtrudersModel()
|
self._extruders_model = None
|
||||||
self._theme = None
|
self._theme = None
|
||||||
|
|
||||||
def beginRendering(self):
|
def beginRendering(self):
|
||||||
scene = self.getController().getScene()
|
scene = self.getController().getScene()
|
||||||
renderer = self.getRenderer()
|
renderer = self.getRenderer()
|
||||||
|
|
||||||
|
if not self._extruders_model:
|
||||||
|
self._extruders_model = Application.getInstance().getExtrudersModel()
|
||||||
|
|
||||||
if not self._theme:
|
if not self._theme:
|
||||||
self._theme = Application.getInstance().getTheme()
|
self._theme = Application.getInstance().getTheme()
|
||||||
|
|
||||||
|
@ -83,9 +83,7 @@ Item {
|
|||||||
|
|
||||||
Column {
|
Column {
|
||||||
Repeater {
|
Repeater {
|
||||||
model: Cura.ExtrudersModel {
|
model: CuraApplication.getExtrudersModel()
|
||||||
simpleNames: true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: model.name;
|
text: model.name;
|
||||||
|
@ -41,7 +41,7 @@ Column
|
|||||||
{
|
{
|
||||||
left: parent.left
|
left: parent.left
|
||||||
right: printInformationPanel.left
|
right: printInformationPanel.left
|
||||||
rightMargin: UM.Theme.getSize("thin_margin").height
|
rightMargin: printInformationPanel.visible ? UM.Theme.getSize("thin_margin").width : 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.IconWithText
|
Cura.IconWithText
|
||||||
|
@ -12,7 +12,7 @@ UM.RecolorImage
|
|||||||
id: widget
|
id: widget
|
||||||
|
|
||||||
source: UM.Theme.getIcon("info")
|
source: UM.Theme.getIcon("info")
|
||||||
width: UM.Theme.getSize("section_icon").width
|
width: visible ? UM.Theme.getSize("section_icon").width : 0
|
||||||
height: UM.Theme.getSize("section_icon").height
|
height: UM.Theme.getSize("section_icon").height
|
||||||
|
|
||||||
color: UM.Theme.getColor("icon")
|
color: UM.Theme.getColor("icon")
|
||||||
|
@ -54,7 +54,7 @@ Item
|
|||||||
{
|
{
|
||||||
text: model.name.toUpperCase()
|
text: model.name.toUpperCase()
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: UM.Controller.activeStage != null ? model.id == UM.Controller.activeStage.stageId : false
|
checked: UM.Controller.activeStage !== null && model.id == UM.Controller.activeStage.stageId
|
||||||
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
exclusiveGroup: mainWindowHeaderMenuGroup
|
exclusiveGroup: mainWindowHeaderMenuGroup
|
||||||
|
@ -17,10 +17,7 @@ Cura.ExpandablePopup
|
|||||||
{
|
{
|
||||||
id: base
|
id: base
|
||||||
|
|
||||||
Cura.ExtrudersModel
|
property var extrudersModel: CuraApplication.getExtrudersModel()
|
||||||
{
|
|
||||||
id: extrudersModel
|
|
||||||
}
|
|
||||||
|
|
||||||
UM.I18nCatalog
|
UM.I18nCatalog
|
||||||
{
|
{
|
||||||
|
@ -27,7 +27,7 @@ Menu
|
|||||||
MenuItem { id: extruderHeader; text: catalog.i18ncp("@label", "Print Selected Model With:", "Print Selected Models With:", UM.Selection.selectionCount); enabled: false; visible: base.shouldShowExtruders }
|
MenuItem { id: extruderHeader; text: catalog.i18ncp("@label", "Print Selected Model With:", "Print Selected Models With:", UM.Selection.selectionCount); enabled: false; visible: base.shouldShowExtruders }
|
||||||
Instantiator
|
Instantiator
|
||||||
{
|
{
|
||||||
model: Cura.ExtrudersModel { id: extrudersModel }
|
model: CuraApplication.getExtrudersModel()
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: "%1: %2 - %3".arg(model.name).arg(model.material).arg(model.variant)
|
text: "%1: %2 - %3".arg(model.name).arg(model.material).arg(model.variant)
|
||||||
visible: base.shouldShowExtruders
|
visible: base.shouldShowExtruders
|
||||||
|
@ -16,7 +16,7 @@ Item
|
|||||||
|
|
||||||
property QtObject qualityManager: CuraApplication.getQualityManager()
|
property QtObject qualityManager: CuraApplication.getQualityManager()
|
||||||
property var resetEnabled: false // Keep PreferencesDialog happy
|
property var resetEnabled: false // Keep PreferencesDialog happy
|
||||||
property var extrudersModel: Cura.ExtrudersModel {}
|
property var extrudersModel: CuraApplication.getExtrudersModel()
|
||||||
|
|
||||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
UM.I18nCatalog { id: catalog; name: "cura"; }
|
||||||
|
|
||||||
|
@ -60,11 +60,7 @@ Rectangle
|
|||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
Cura.ExtrudersModel
|
property var extrudersModel: CuraApplication.getExtrudersModel()
|
||||||
{
|
|
||||||
id: extrudersModel
|
|
||||||
simpleNames: true
|
|
||||||
}
|
|
||||||
|
|
||||||
OutputDeviceHeader
|
OutputDeviceHeader
|
||||||
{
|
{
|
||||||
|
@ -16,10 +16,7 @@ Item
|
|||||||
property real padding: UM.Theme.getSize("default_margin").width
|
property real padding: UM.Theme.getSize("default_margin").width
|
||||||
property bool multipleExtruders: extrudersModel.count > 1
|
property bool multipleExtruders: extrudersModel.count > 1
|
||||||
|
|
||||||
Cura.ExtrudersModel
|
property var extrudersModel: CuraApplication.getExtrudersModel()
|
||||||
{
|
|
||||||
id: extrudersModel
|
|
||||||
}
|
|
||||||
|
|
||||||
// Profile selector row
|
// Profile selector row
|
||||||
GlobalProfileSelector
|
GlobalProfileSelector
|
||||||
@ -113,9 +110,11 @@ Item
|
|||||||
}
|
}
|
||||||
z: tabBar.z - 1
|
z: tabBar.z - 1
|
||||||
// Don't show the border when only one extruder
|
// Don't show the border when only one extruder
|
||||||
|
|
||||||
border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent"
|
border.color: tabBar.visible ? UM.Theme.getColor("lining") : "transparent"
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
|
||||||
|
color: UM.Theme.getColor("main_background")
|
||||||
Cura.SettingView
|
Cura.SettingView
|
||||||
{
|
{
|
||||||
anchors
|
anchors
|
||||||
|
@ -26,10 +26,7 @@ Cura.ExpandableComponent
|
|||||||
|
|
||||||
headerItem: PrintSetupSelectorHeader {}
|
headerItem: PrintSetupSelectorHeader {}
|
||||||
|
|
||||||
Cura.ExtrudersModel
|
property var extrudersModel: CuraApplication.getExtrudersModel()
|
||||||
{
|
|
||||||
id: extrudersModel
|
|
||||||
}
|
|
||||||
|
|
||||||
contentItem: PrintSetupSelectorContents {}
|
contentItem: PrintSetupSelectorContents {}
|
||||||
}
|
}
|
@ -156,9 +156,10 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
//: Model used to populate the extrudelModel
|
//: Model used to populate the extrudelModel
|
||||||
Cura.ExtrudersModel
|
property var extruders: CuraApplication.getExtrudersModel()
|
||||||
|
Connections
|
||||||
{
|
{
|
||||||
id: extruders
|
target: extruders
|
||||||
onModelChanged: populateExtruderModel()
|
onModelChanged: populateExtruderModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,11 +17,16 @@ SettingItem
|
|||||||
id: control
|
id: control
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
model: Cura.ExtrudersModel
|
property var extrudersModel: CuraApplication.getExtrudersModel()
|
||||||
|
|
||||||
|
model: extrudersModel
|
||||||
|
|
||||||
|
Connections
|
||||||
{
|
{
|
||||||
|
target: extrudersModel
|
||||||
onModelChanged:
|
onModelChanged:
|
||||||
{
|
{
|
||||||
control.color = getItem(control.currentIndex).color
|
control.color = extrudersModel.getItem(control.currentIndex).color
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,15 +12,24 @@ SettingItem
|
|||||||
id: base
|
id: base
|
||||||
property var focusItem: control
|
property var focusItem: control
|
||||||
|
|
||||||
|
// Somehow if we directory set control.model to CuraApplication.getExtrudersModelWithOptional()
|
||||||
|
// and in the Connections.onModelChanged use control.model as a reference, it will complain about
|
||||||
|
// non-existing properties such as "onModelChanged" and "getItem". I guess if we access the model
|
||||||
|
// via "control.model", it gives back a generic/abstract model instance. To avoid this, we add
|
||||||
|
// this extra property to keep the ExtrudersModel and use this in the rest of the code.
|
||||||
|
property var extrudersWithOptionalModel: CuraApplication.getExtrudersModelWithOptional()
|
||||||
|
|
||||||
contents: ComboBox
|
contents: ComboBox
|
||||||
{
|
{
|
||||||
id: control
|
id: control
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
model: Cura.ExtrudersModel
|
model: base.extrudersWithOptionalModel
|
||||||
|
|
||||||
|
Connections
|
||||||
{
|
{
|
||||||
onModelChanged: control.color = getItem(control.currentIndex).color
|
target: base.extrudersWithOptionalModel
|
||||||
addOptionalExtruder: true
|
onModelChanged: control.color = base.extrudersWithOptionalModel.getItem(control.currentIndex).color
|
||||||
}
|
}
|
||||||
|
|
||||||
textRole: "name"
|
textRole: "name"
|
||||||
|
@ -144,10 +144,7 @@ Item
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.ExtrudersModel
|
property var extrudersModel: CuraApplication.getExtrudersModel()
|
||||||
{
|
|
||||||
id: extrudersModel
|
|
||||||
}
|
|
||||||
|
|
||||||
UM.PointingRectangle
|
UM.PointingRectangle
|
||||||
{
|
{
|
||||||
|
@ -78,8 +78,6 @@ Cura.ExpandablePopup
|
|||||||
{
|
{
|
||||||
id: viewSelectorPopup
|
id: viewSelectorPopup
|
||||||
width: viewSelector.width - 2 * viewSelector.contentPadding
|
width: viewSelector.width - 2 * viewSelector.contentPadding
|
||||||
leftPadding: UM.Theme.getSize("default_lining").width
|
|
||||||
rightPadding: UM.Theme.getSize("default_lining").width
|
|
||||||
|
|
||||||
// For some reason the height/width of the column gets set to 0 if this is not set...
|
// For some reason the height/width of the column gets set to 0 if this is not set...
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
|
@ -99,11 +99,11 @@
|
|||||||
"scrollbar_handle_hover": [255, 255, 255, 255],
|
"scrollbar_handle_hover": [255, 255, 255, 255],
|
||||||
"scrollbar_handle_down": [255, 255, 255, 255],
|
"scrollbar_handle_down": [255, 255, 255, 255],
|
||||||
|
|
||||||
"setting_category": [39, 44, 48, 255],
|
"setting_category": [75, 80, 83, 255],
|
||||||
"setting_category_disabled": [39, 44, 48, 255],
|
"setting_category_disabled": [75, 80, 83, 255],
|
||||||
"setting_category_hover": [39, 44, 48, 255],
|
"setting_category_hover": [75, 80, 83, 255],
|
||||||
"setting_category_active": [39, 44, 48, 255],
|
"setting_category_active": [75, 80, 83, 255],
|
||||||
"setting_category_active_hover": [39, 44, 48, 255],
|
"setting_category_active_hover": [75, 80, 83, 255],
|
||||||
"setting_category_text": [255, 255, 255, 152],
|
"setting_category_text": [255, 255, 255, 152],
|
||||||
"setting_category_disabled_text": [255, 255, 255, 101],
|
"setting_category_disabled_text": [255, 255, 255, 101],
|
||||||
"setting_category_hover_text": [255, 255, 255, 204],
|
"setting_category_hover_text": [255, 255, 255, 204],
|
||||||
|
@ -349,7 +349,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"sizes": {
|
"sizes": {
|
||||||
"window_minimum_size": [106, 66],
|
"window_minimum_size": [100, 60],
|
||||||
|
|
||||||
"main_window_header": [0.0, 4.0],
|
"main_window_header": [0.0, 4.0],
|
||||||
"main_window_header_button": [8, 2.35],
|
"main_window_header_button": [8, 2.35],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user