mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
ffd309f816
10 changed files with 54 additions and 41 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -16,3 +16,8 @@ resources/firmware
|
||||||
*~
|
*~
|
||||||
*.qm
|
*.qm
|
||||||
.idea
|
.idea
|
||||||
|
.project
|
||||||
|
.pydevproject
|
||||||
|
|
||||||
|
# Debian packaging
|
||||||
|
debian/
|
||||||
|
|
|
@ -271,7 +271,7 @@ class CuraApplication(QtApplication):
|
||||||
file_name = urllib.parse.quote_plus(stack.getId()) + ".stack.cfg"
|
file_name = urllib.parse.quote_plus(stack.getId()) + ".stack.cfg"
|
||||||
stack_type = stack.getMetaDataEntry("type", None)
|
stack_type = stack.getMetaDataEntry("type", None)
|
||||||
path = None
|
path = None
|
||||||
if stack_type == "machine":
|
if not stack_type or stack_type == "machine":
|
||||||
path = Resources.getStoragePath(self.ResourceTypes.MachineStack, file_name)
|
path = Resources.getStoragePath(self.ResourceTypes.MachineStack, file_name)
|
||||||
elif stack_type == "extruder":
|
elif stack_type == "extruder":
|
||||||
path = Resources.getStoragePath(self.ResourceTypes.ExtruderStack, file_name)
|
path = Resources.getStoragePath(self.ResourceTypes.ExtruderStack, file_name)
|
||||||
|
|
|
@ -23,7 +23,7 @@ class CuraSplashScreen(QSplashScreen):
|
||||||
version = Application.getInstance().getVersion().split("-")
|
version = Application.getInstance().getVersion().split("-")
|
||||||
buildtype = Application.getInstance().getBuildType()
|
buildtype = Application.getInstance().getBuildType()
|
||||||
if buildtype:
|
if buildtype:
|
||||||
version += " (%s)" %(buildtype)
|
version[0] += " (%s)" %(buildtype)
|
||||||
|
|
||||||
painter.setFont(QFont("Proxima Nova Rg", 20 ))
|
painter.setFont(QFont("Proxima Nova Rg", 20 ))
|
||||||
painter.drawText(0, 0, 330 * self._scale, 230 * self._scale, Qt.AlignHCenter | Qt.AlignBottom, version[0])
|
painter.drawText(0, 0, 330 * self._scale, 230 * self._scale, Qt.AlignHCenter | Qt.AlignBottom, version[0])
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Extruder:
|
||||||
self._nozzles += container_registry.findInstanceContainers(type = "nozzle", definitions = self._definition.getId())
|
self._nozzles += container_registry.findInstanceContainers(type = "nozzle", definitions = self._definition.getId())
|
||||||
|
|
||||||
#Create a container stack for this extruder.
|
#Create a container stack for this extruder.
|
||||||
self._name = self._uniqueName(self._definition.getId())
|
self._name = self._uniqueName(self._definition)
|
||||||
self._container_stack = UM.Settings.ContainerStack(self._name)
|
self._container_stack = UM.Settings.ContainerStack(self._name)
|
||||||
self._container_stack.addMetaDataEntry("type", "extruder_train")
|
self._container_stack.addMetaDataEntry("type", "extruder_train")
|
||||||
self._container_stack.addContainer(self._definition)
|
self._container_stack.addContainer(self._definition)
|
||||||
|
|
|
@ -27,6 +27,7 @@ class ExtruderManager:
|
||||||
self._next_item = 0 #For when you use this class as iterator.
|
self._next_item = 0 #For when you use this class as iterator.
|
||||||
|
|
||||||
UM.Application.getInstance().globalContainerStackChanged.connect(self._reconnectExtruderReload) #When the current machine changes, we need to reload all extruders belonging to the new machine.
|
UM.Application.getInstance().globalContainerStackChanged.connect(self._reconnectExtruderReload) #When the current machine changes, we need to reload all extruders belonging to the new machine.
|
||||||
|
self._reconnectExtruderReload()
|
||||||
|
|
||||||
## Gets an instance of this extruder manager.
|
## Gets an instance of this extruder manager.
|
||||||
#
|
#
|
||||||
|
@ -51,6 +52,7 @@ class ExtruderManager:
|
||||||
self._global_container_stack.containersChanged.disconnect(self._reloadExtruders) #Disconnect from the old global container stack.
|
self._global_container_stack.containersChanged.disconnect(self._reloadExtruders) #Disconnect from the old global container stack.
|
||||||
self._global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
|
self._global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||||
self._global_container_stack.containersChanged.connect(self._reloadExtruders) #When the current machine changes, we need to reload all extruders belonging to the new machine.
|
self._global_container_stack.containersChanged.connect(self._reloadExtruders) #When the current machine changes, we need to reload all extruders belonging to the new machine.
|
||||||
|
self._reloadExtruders()
|
||||||
|
|
||||||
## (Re)loads all extruders of the currently active machine.
|
## (Re)loads all extruders of the currently active machine.
|
||||||
#
|
#
|
||||||
|
@ -66,7 +68,7 @@ class ExtruderManager:
|
||||||
#Get the extruder definitions belonging to the current machine.
|
#Get the extruder definitions belonging to the current machine.
|
||||||
machine = self._global_container_stack.getBottom()
|
machine = self._global_container_stack.getBottom()
|
||||||
extruder_train_ids = machine.getMetaDataEntry("machine_extruder_trains")
|
extruder_train_ids = machine.getMetaDataEntry("machine_extruder_trains")
|
||||||
for extruder_train_id in extruder_train_ids:
|
for _,extruder_train_id in extruder_train_ids.items():
|
||||||
extruder_definitions = UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = extruder_train_id) #Should be only 1 definition if IDs are unique, but add the whole list anyway.
|
extruder_definitions = UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = extruder_train_id) #Should be only 1 definition if IDs are unique, but add the whole list anyway.
|
||||||
if not extruder_definitions: #Empty list or error.
|
if not extruder_definitions: #Empty list or error.
|
||||||
UM.Logger.log("w", "Machine definition %s refers to an extruder train \"%s\", but no such extruder was found.", machine.getId(), extruder_train_id)
|
UM.Logger.log("w", "Machine definition %s refers to an extruder train \"%s\", but no such extruder was found.", machine.getId(), extruder_train_id)
|
||||||
|
|
|
@ -179,8 +179,8 @@ class MachineManagerModel(QObject):
|
||||||
i = 1
|
i = 1
|
||||||
|
|
||||||
# Check both the id and the name, because they may not be the same and it is better if they are both unique
|
# Check both the id and the name, because they may not be the same and it is better if they are both unique
|
||||||
while UM.Settings.ContainerRegistry.getInstance().findContainers(None, id = unique_name) or \
|
while UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = unique_name, type = "machine") or \
|
||||||
UM.Settings.ContainerRegistry.getInstance().findContainers(None, name = unique_name):
|
UM.Settings.ContainerRegistry.getInstance().findContainerStacks(name = unique_name, type = "machine"):
|
||||||
i += 1
|
i += 1
|
||||||
unique_name = "%s #%d" % (name, i)
|
unique_name = "%s #%d" % (name, i)
|
||||||
|
|
||||||
|
@ -405,11 +405,13 @@ class MachineManagerModel(QObject):
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def removeMachine(self, machine_id):
|
def removeMachine(self, machine_id):
|
||||||
# If the machine that is being removed is the currently active machine, set another machine as the active machine
|
# If the machine that is being removed is the currently active machine, set another machine as the active machine
|
||||||
if self._global_container_stack and self._global_container_stack.getId() == machine_id:
|
activate_new_machine = (self._global_container_stack and self._global_container_stack.getId() == machine_id)
|
||||||
containers = UM.Settings.ContainerRegistry.getInstance().findContainerStacks()
|
|
||||||
if containers:
|
|
||||||
Application.getInstance().setGlobalContainerStack(containers[0])
|
|
||||||
UM.Settings.ContainerRegistry.getInstance().removeContainer(machine_id)
|
UM.Settings.ContainerRegistry.getInstance().removeContainer(machine_id)
|
||||||
|
if activate_new_machine:
|
||||||
|
stacks = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(type = "machine")
|
||||||
|
if stacks:
|
||||||
|
Application.getInstance().setGlobalContainerStack(stacks[0])
|
||||||
|
|
||||||
|
|
||||||
@pyqtProperty(bool, notify = globalContainerChanged)
|
@pyqtProperty(bool, notify = globalContainerChanged)
|
||||||
def hasMaterials(self):
|
def hasMaterials(self):
|
||||||
|
|
|
@ -51,6 +51,8 @@ class PrintInformation(QObject):
|
||||||
self._backend.printDurationMessage.connect(self._onPrintDurationMessage)
|
self._backend.printDurationMessage.connect(self._onPrintDurationMessage)
|
||||||
|
|
||||||
self._job_name = ""
|
self._job_name = ""
|
||||||
|
self._abbr_machine = ""
|
||||||
|
|
||||||
Application.getInstance().globalContainerStackChanged.connect(self._setAbbreviatedMachineName)
|
Application.getInstance().globalContainerStackChanged.connect(self._setAbbreviatedMachineName)
|
||||||
Application.getInstance().fileLoaded.connect(self.setJobName)
|
Application.getInstance().fileLoaded.connect(self.setJobName)
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,7 @@ Item {
|
||||||
//Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
|
//Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
|
||||||
//In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
|
//In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
|
||||||
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
|
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
|
||||||
asynchronous: model.type != "enum"
|
asynchronous: model.type != "enum" && model.type != "extruder"
|
||||||
|
|
||||||
onLoaded: {
|
onLoaded: {
|
||||||
settingLoader.item.showRevertButton = false
|
settingLoader.item.showRevertButton = false
|
||||||
|
|
|
@ -16,17 +16,18 @@ SettingItem
|
||||||
{
|
{
|
||||||
id: control
|
id: control
|
||||||
|
|
||||||
model: Cura.ExtrudersModel {
|
model: Cura.ExtrudersModel
|
||||||
|
{
|
||||||
id: extruders_model
|
id: extruders_model
|
||||||
}
|
}
|
||||||
textRole: "name";
|
textRole: "name"
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
MouseArea
|
MouseArea
|
||||||
{
|
{
|
||||||
anchors.fill: parent;
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.NoButton;
|
acceptedButtons: Qt.NoButton
|
||||||
onWheel: wheel.accepted = true;
|
onWheel: wheel.accepted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,44 +39,44 @@ SettingItem
|
||||||
{
|
{
|
||||||
if (!enabled)
|
if (!enabled)
|
||||||
{
|
{
|
||||||
return UM.Theme.getColor("setting_control_disabled")
|
return UM.Theme.getColor("setting_control_disabled");
|
||||||
}
|
}
|
||||||
if(control.hovered || base.activeFocus)
|
if(control.hovered || base.activeFocus)
|
||||||
{
|
{
|
||||||
return UM.Theme.getColor("setting_control_highlight")
|
return UM.Theme.getColor("setting_control_highlight");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return UM.Theme.getColor("setting_control")
|
return extruders_model.getItem(index).colour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
border.width: UM.Theme.getSize("default_lining").width;
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border");
|
border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : control.hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border")
|
||||||
}
|
}
|
||||||
label: Item
|
label: Item
|
||||||
{
|
{
|
||||||
Label
|
Label
|
||||||
{
|
{
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: UM.Theme.getSize("default_lining").width
|
anchors.leftMargin: UM.Theme.getSize("default_lining").width
|
||||||
anchors.right: downArrow.left;
|
anchors.right: downArrow.left
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_lining").width;
|
anchors.rightMargin: UM.Theme.getSize("default_lining").width
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
text: control.currentText;
|
text: control.currentText
|
||||||
font: UM.Theme.getFont("default");
|
font: UM.Theme.getFont("default")
|
||||||
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text");
|
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : extruders_model.getItem(index).colour
|
||||||
|
|
||||||
elide: Text.ElideRight;
|
elide: Text.ElideRight
|
||||||
verticalAlignment: Text.AlignVCenter;
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
id: downArrow
|
id: downArrow
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2;
|
anchors.rightMargin: UM.Theme.getSize("default_lining").width * 2
|
||||||
anchors.verticalCenter: parent.verticalCenter;
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
|
||||||
source: UM.Theme.getIcon("arrow_bottom")
|
source: UM.Theme.getIcon("arrow_bottom")
|
||||||
width: UM.Theme.getSize("standard_arrow").width
|
width: UM.Theme.getSize("standard_arrow").width
|
||||||
|
@ -83,29 +84,30 @@ SettingItem
|
||||||
sourceSize.width: width + 5
|
sourceSize.width: width + 5
|
||||||
sourceSize.height: width + 5
|
sourceSize.height: width + 5
|
||||||
|
|
||||||
color: UM.Theme.getColor("setting_control_text");
|
color: UM.Theme.getColor("setting_control_text")
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onActivated: provider.setPropertyValue("value", extruders_model.getItem(index).index)
|
onActivated: provider.setPropertyValue("value", extruders_model.getItem(index).index);
|
||||||
onModelChanged: updateCurrentIndex();
|
onModelChanged: updateCurrentIndex();
|
||||||
|
|
||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
target: provider
|
target: provider
|
||||||
onPropertiesChanged: control.updateCurrentIndex()
|
onPropertiesChanged: control.updateCurrentIndex();
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateCurrentIndex() {
|
function updateCurrentIndex()
|
||||||
for(var i = 0; i < extruders_model.rowCount(); ++i) {
|
{
|
||||||
if(extruders_model.getItem(i).index == provider.properties.value) {
|
for(var i = 0; i < extruders_model.rowCount(); ++i)
|
||||||
|
{
|
||||||
|
if(extruders_model.getItem(i).index == provider.properties.value)
|
||||||
|
{
|
||||||
currentIndex = i;
|
currentIndex = i;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentIndex = -1;
|
currentIndex = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,7 @@ ScrollView
|
||||||
//Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
|
//Qt5.4.2 and earlier has a bug where this causes a crash: https://bugreports.qt.io/browse/QTBUG-35989
|
||||||
//In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
|
//In addition, while it works for 5.5 and higher, the ordering of the actual combo box drop down changes,
|
||||||
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
|
//causing nasty issues when selecting different options. So disable asynchronous loading of enum type completely.
|
||||||
asynchronous: model.type != "enum"
|
asynchronous: model.type != "enum" && model.type != "extruder"
|
||||||
active: model.type != undefined
|
active: model.type != undefined
|
||||||
|
|
||||||
source:
|
source:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue