mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 20:57:49 -06:00
Merge branch '4.0' of github.com:Ultimaker/Cura
This commit is contained in:
commit
dee739db8b
9 changed files with 32 additions and 75 deletions
|
@ -1,12 +1,16 @@
|
||||||
# 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
|
|
||||||
|
|
||||||
from UM.Qt.ListModel import ListModel
|
from UM.Qt.ListModel import ListModel
|
||||||
|
|
||||||
|
from PyQt5.QtCore import pyqtProperty, Qt, QTimer
|
||||||
|
|
||||||
from cura.PrinterOutputDevice import ConnectionType
|
from cura.PrinterOutputDevice import ConnectionType
|
||||||
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
||||||
|
|
||||||
|
from cura.Settings.GlobalStack import GlobalStack
|
||||||
|
|
||||||
|
|
||||||
class GlobalStacksModel(ListModel):
|
class GlobalStacksModel(ListModel):
|
||||||
NameRole = Qt.UserRole + 1
|
NameRole = Qt.UserRole + 1
|
||||||
|
@ -23,20 +27,26 @@ class GlobalStacksModel(ListModel):
|
||||||
self.addRoleName(self.MetaDataRole, "metadata")
|
self.addRoleName(self.MetaDataRole, "metadata")
|
||||||
self._container_stacks = []
|
self._container_stacks = []
|
||||||
|
|
||||||
|
self._change_timer = QTimer()
|
||||||
|
self._change_timer.setInterval(200)
|
||||||
|
self._change_timer.setSingleShot(True)
|
||||||
|
self._change_timer.timeout.connect(self._update)
|
||||||
|
|
||||||
# Listen to changes
|
# Listen to changes
|
||||||
CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerChanged)
|
CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerChanged)
|
||||||
CuraContainerRegistry.getInstance().containerMetaDataChanged.connect(self._onContainerChanged)
|
CuraContainerRegistry.getInstance().containerMetaDataChanged.connect(self._onContainerChanged)
|
||||||
CuraContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChanged)
|
CuraContainerRegistry.getInstance().containerRemoved.connect(self._onContainerChanged)
|
||||||
self._filter_dict = {}
|
self._filter_dict = {}
|
||||||
self._update()
|
self._updateDelayed()
|
||||||
|
|
||||||
## Handler for container added/removed events from registry
|
## Handler for container added/removed events from registry
|
||||||
def _onContainerChanged(self, container):
|
def _onContainerChanged(self, container):
|
||||||
from cura.Settings.GlobalStack import GlobalStack # otherwise circular imports
|
|
||||||
|
|
||||||
# We only need to update when the added / removed container GlobalStack
|
# We only need to update when the added / removed container GlobalStack
|
||||||
if isinstance(container, GlobalStack):
|
if isinstance(container, GlobalStack):
|
||||||
self._update()
|
self._updateDelayed()
|
||||||
|
|
||||||
|
def _updateDelayed(self):
|
||||||
|
self._change_timer.start()
|
||||||
|
|
||||||
def _update(self) -> None:
|
def _update(self) -> None:
|
||||||
items = []
|
items = []
|
||||||
|
|
|
@ -10,6 +10,7 @@ from UM.Settings.SettingFunction import SettingFunction
|
||||||
|
|
||||||
from cura.Machines.QualityManager import QualityGroup
|
from cura.Machines.QualityManager import QualityGroup
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# QML Model for all built-in quality profiles. This model is used for the drop-down quality menu.
|
# QML Model for all built-in quality profiles. This model is used for the drop-down quality menu.
|
||||||
#
|
#
|
||||||
|
@ -51,7 +52,7 @@ class QualityProfilesDropDownMenuModel(ListModel):
|
||||||
self._update_timer.setSingleShot(True)
|
self._update_timer.setSingleShot(True)
|
||||||
self._update_timer.timeout.connect(self._update)
|
self._update_timer.timeout.connect(self._update)
|
||||||
|
|
||||||
self._update()
|
self._onChange()
|
||||||
|
|
||||||
def _onChange(self) -> None:
|
def _onChange(self) -> None:
|
||||||
self._update_timer.start()
|
self._update_timer.start()
|
||||||
|
|
|
@ -273,15 +273,8 @@ class MachineManager(QObject):
|
||||||
|
|
||||||
def _onActiveExtruderStackChanged(self) -> None:
|
def _onActiveExtruderStackChanged(self) -> None:
|
||||||
self.blurSettings.emit() # Ensure no-one has focus.
|
self.blurSettings.emit() # Ensure no-one has focus.
|
||||||
old_active_container_stack = self._active_container_stack
|
|
||||||
|
|
||||||
self._active_container_stack = ExtruderManager.getInstance().getActiveExtruderStack()
|
self._active_container_stack = ExtruderManager.getInstance().getActiveExtruderStack()
|
||||||
|
|
||||||
if old_active_container_stack != self._active_container_stack:
|
|
||||||
# Many methods and properties related to the active quality actually depend
|
|
||||||
# on _active_container_stack. If it changes, then the properties change.
|
|
||||||
self.activeQualityChanged.emit()
|
|
||||||
|
|
||||||
def __emitChangedSignals(self) -> None:
|
def __emitChangedSignals(self) -> None:
|
||||||
self.activeQualityChanged.emit()
|
self.activeQualityChanged.emit()
|
||||||
self.activeVariantChanged.emit()
|
self.activeVariantChanged.emit()
|
||||||
|
|
|
@ -226,32 +226,6 @@ UM.Dialog
|
||||||
text: Cura.MachineManager.activeQualityOrQualityChangesName
|
text: Cura.MachineManager.activeQualityOrQualityChangesName
|
||||||
width: Math.floor(scroll.width / 3) | 0
|
width: Math.floor(scroll.width / 3) | 0
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Column
|
|
||||||
{
|
|
||||||
width: parent.width
|
|
||||||
height: childrenRect.height
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@action:label", "Setting visibility")
|
|
||||||
font.bold: true
|
|
||||||
}
|
|
||||||
Row
|
|
||||||
{
|
|
||||||
width: parent.width
|
|
||||||
height: childrenRect.height
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@action:label", "Visible settings:")
|
|
||||||
width: Math.floor(scroll.width / 3) | 0
|
|
||||||
}
|
|
||||||
Label
|
|
||||||
{
|
|
||||||
text: catalog.i18nc("@action:label", "%1 out of %2" ).arg(definitionsModel.visibleCount).arg(Cura.MachineManager.totalNumberOfSettings)
|
|
||||||
width: Math.floor(scroll.width / 3) | 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,10 +251,10 @@ Item
|
||||||
{
|
{
|
||||||
id: materialSelection
|
id: materialSelection
|
||||||
|
|
||||||
property bool valueError: Cura.MachineManager.activeStack != null ? Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "compatible", "") != "True" : true
|
property bool valueError: Cura.MachineManager.activeStack !== null ? Cura.ContainerManager.getContainerMetaDataEntry(Cura.MachineManager.activeStack.material.id, "compatible", "") !== "True" : true
|
||||||
property bool valueWarning: !Cura.MachineManager.isActiveQualitySupported
|
property bool valueWarning: !Cura.MachineManager.isActiveQualitySupported
|
||||||
|
|
||||||
text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : ""
|
text: Cura.MachineManager.activeStack !== null ? Cura.MachineManager.activeStack.material.name : ""
|
||||||
tooltip: text
|
tooltip: text
|
||||||
|
|
||||||
width: selectors.controlWidth
|
width: selectors.controlWidth
|
||||||
|
|
|
@ -13,7 +13,8 @@ Menu
|
||||||
title: catalog.i18nc("@label:category menu label", "Material")
|
title: catalog.i18nc("@label:category menu label", "Material")
|
||||||
|
|
||||||
property int extruderIndex: 0
|
property int extruderIndex: 0
|
||||||
|
property string currentRootMaterialId: Cura.MachineManager.currentRootMaterialId[extruderIndex]
|
||||||
|
property string activeMaterialId: Cura.MachineManager.allActiveMaterialIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
|
||||||
Cura.FavoriteMaterialsModel
|
Cura.FavoriteMaterialsModel
|
||||||
{
|
{
|
||||||
id: favoriteMaterialsModel
|
id: favoriteMaterialsModel
|
||||||
|
@ -45,7 +46,7 @@ Menu
|
||||||
{
|
{
|
||||||
text: model.brand + " " + model.name
|
text: model.brand + " " + model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex]
|
checked: model.root_material_id === menu.currentRootMaterialId
|
||||||
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
}
|
}
|
||||||
|
@ -67,7 +68,7 @@ Menu
|
||||||
{
|
{
|
||||||
text: model.name
|
text: model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex]
|
checked: model.root_material_id === menu.currentRootMaterialId
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
||||||
}
|
}
|
||||||
|
@ -105,7 +106,7 @@ Menu
|
||||||
{
|
{
|
||||||
text: model.name
|
text: model.name
|
||||||
checkable: true
|
checkable: true
|
||||||
checked: model.id == Cura.MachineManager.allActiveMaterialIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
|
checked: model.id === menu.activeMaterialId
|
||||||
exclusiveGroup: group
|
exclusiveGroup: group
|
||||||
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,24 +101,10 @@ UM.PreferencesPage
|
||||||
UM.Preferences.resetPreference("cura/choice_on_open_project")
|
UM.Preferences.resetPreference("cura/choice_on_open_project")
|
||||||
setDefaultOpenProjectOption(UM.Preferences.getValue("cura/choice_on_open_project"))
|
setDefaultOpenProjectOption(UM.Preferences.getValue("cura/choice_on_open_project"))
|
||||||
|
|
||||||
if (pluginExistsAndEnabled("SliceInfoPlugin")) {
|
UM.Preferences.resetPreference("info/send_slice_info")
|
||||||
UM.Preferences.resetPreference("info/send_slice_info")
|
sendDataCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_slice_info"))
|
||||||
sendDataCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_slice_info"))
|
UM.Preferences.resetPreference("info/automatic_update_check")
|
||||||
}
|
checkUpdatesCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
|
||||||
if (pluginExistsAndEnabled("UpdateChecker")) {
|
|
||||||
UM.Preferences.resetPreference("info/automatic_update_check")
|
|
||||||
checkUpdatesCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function pluginExistsAndEnabled(pluginName)
|
|
||||||
{
|
|
||||||
var pluginItem = plugins.find("id", pluginName)
|
|
||||||
if (pluginItem > -1)
|
|
||||||
{
|
|
||||||
return plugins.getItem(pluginItem).enabled
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollView
|
ScrollView
|
||||||
|
@ -130,8 +116,6 @@ UM.PreferencesPage
|
||||||
|
|
||||||
Column
|
Column
|
||||||
{
|
{
|
||||||
//: Model used to check if a plugin exists
|
|
||||||
UM.PluginsModel { id: plugins }
|
|
||||||
|
|
||||||
//: Language selection label
|
//: Language selection label
|
||||||
UM.I18nCatalog{id: catalog; name: "cura"}
|
UM.I18nCatalog{id: catalog; name: "cura"}
|
||||||
|
@ -672,7 +656,6 @@ UM.PreferencesPage
|
||||||
|
|
||||||
UM.TooltipArea
|
UM.TooltipArea
|
||||||
{
|
{
|
||||||
visible: pluginExistsAndEnabled("UpdateChecker")
|
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
height: visible ? childrenRect.height : 0
|
height: visible ? childrenRect.height : 0
|
||||||
text: catalog.i18nc("@info:tooltip","Should Cura check for updates when the program is started?")
|
text: catalog.i18nc("@info:tooltip","Should Cura check for updates when the program is started?")
|
||||||
|
@ -688,7 +671,6 @@ UM.PreferencesPage
|
||||||
|
|
||||||
UM.TooltipArea
|
UM.TooltipArea
|
||||||
{
|
{
|
||||||
visible: pluginExistsAndEnabled("SliceInfoPlugin")
|
|
||||||
width: childrenRect.width
|
width: childrenRect.width
|
||||||
height: visible ? childrenRect.height : 0
|
height: visible ? childrenRect.height : 0
|
||||||
text: catalog.i18nc("@info:tooltip","Should anonymous data about your print be sent to Ultimaker? Note, no models, IP addresses or other personally identifiable information is sent or stored.")
|
text: catalog.i18nc("@info:tooltip","Should anonymous data about your print be sent to Ultimaker? Note, no models, IP addresses or other personally identifiable information is sent or stored.")
|
||||||
|
|
|
@ -237,7 +237,5 @@ Button
|
||||||
onEntered: base.showTooltip(catalog.i18nc("@label","Some hidden settings use values different from their normal calculated value.\n\nClick to make these settings visible."))
|
onEntered: base.showTooltip(catalog.i18nc("@label","Some hidden settings use values different from their normal calculated value.\n\nClick to make these settings visible."))
|
||||||
|
|
||||||
onExited: base.hideTooltip()
|
onExited: base.hideTooltip()
|
||||||
|
|
||||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ Item
|
||||||
// Create properties to put property provider stuff in (bindings break in qt 5.5.1 otherwise)
|
// Create properties to put property provider stuff in (bindings break in qt 5.5.1 otherwise)
|
||||||
property var state: propertyProvider.properties.state
|
property var state: propertyProvider.properties.state
|
||||||
// There is no resolve property if there is only one stack.
|
// There is no resolve property if there is only one stack.
|
||||||
property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? propertyProvider.properties.resolve : "None"
|
property var resolve: Cura.MachineManager.activeStackId !== Cura.MachineManager.activeMachineId ? propertyProvider.properties.resolve : "None"
|
||||||
property var stackLevels: propertyProvider.stackLevels
|
property var stackLevels: propertyProvider.stackLevels
|
||||||
property var stackLevel: stackLevels[0]
|
property var stackLevel: stackLevels[0]
|
||||||
|
|
||||||
|
@ -234,19 +234,19 @@ Item
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are no settings with any warning.
|
// There are no settings with any warning.
|
||||||
if (Cura.SettingInheritanceManager.settingsWithInheritanceWarning.length == 0)
|
if (Cura.SettingInheritanceManager.settingsWithInheritanceWarning.length === 0)
|
||||||
{
|
{
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// This setting has a resolve value, so an inheritance warning doesn't do anything.
|
// This setting has a resolve value, so an inheritance warning doesn't do anything.
|
||||||
if (resolve != "None")
|
if (resolve !== "None")
|
||||||
{
|
{
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the setting does not have a limit_to_extruder property (or is -1), use the active stack.
|
// If the setting does not have a limit_to_extruder property (or is -1), use the active stack.
|
||||||
if (globalPropertyProvider.properties.limit_to_extruder == null || String(globalPropertyProvider.properties.limit_to_extruder) == "-1")
|
if (globalPropertyProvider.properties.limit_to_extruder === null || String(globalPropertyProvider.properties.limit_to_extruder) === "-1")
|
||||||
{
|
{
|
||||||
return Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0
|
return Cura.SettingInheritanceManager.settingsWithInheritanceWarning.indexOf(definition.key) >= 0
|
||||||
}
|
}
|
||||||
|
@ -317,6 +317,4 @@ Item
|
||||||
height: UM.Theme.getSize("setting_control").height
|
height: UM.Theme.getSize("setting_control").height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue