Merge remote-tracking branch 'origin/3.4'

This commit is contained in:
Lipu Fei 2018-06-01 13:51:00 +02:00
commit 61a3668a4f
8 changed files with 26 additions and 14 deletions

View file

@ -1536,10 +1536,11 @@ class CuraApplication(QtApplication):
f = file.toLocalFile()
extension = os.path.splitext(f)[1]
extension = extension.lower()
filename = os.path.basename(f)
if len(self._currently_loading_files) > 0:
# If a non-slicable file is already being loaded, we prevent loading of any further non-slicable files
if extension.lower() in self._non_sliceable_extensions:
if extension in self._non_sliceable_extensions:
message = Message(
self._i18n_catalog.i18nc("@info:status",
"Only one G-code file can be loaded at a time. Skipped importing {0}",
@ -1548,7 +1549,8 @@ class CuraApplication(QtApplication):
return
# If file being loaded is non-slicable file, then prevent loading of any other files
extension = os.path.splitext(self._currently_loading_files[0])[1]
if extension.lower() in self._non_sliceable_extensions:
extension = extension.lower()
if extension in self._non_sliceable_extensions:
message = Message(
self._i18n_catalog.i18nc("@info:status",
"Can't open any other file if G-code is loading. Skipped importing {0}",

View file

@ -39,6 +39,8 @@ class BaseMaterialsModel(ListModel):
self._extruder_position = 0
self._extruder_stack = None
# Update the stack and the model data when the machine changes
self._machine_manager.globalContainerChanged.connect(self._updateExtruderStack)
def _updateExtruderStack(self):
global_stack = self._machine_manager.activeMachine
@ -50,9 +52,11 @@ class BaseMaterialsModel(ListModel):
self._extruder_stack = global_stack.extruders.get(str(self._extruder_position))
if self._extruder_stack is not None:
self._extruder_stack.pyqtContainersChanged.connect(self._update)
# Force update the model when the extruder stack changes
self._update()
def setExtruderPosition(self, position: int):
if self._extruder_position != position:
if self._extruder_stack is None or self._extruder_position != position:
self._extruder_position = position
self._updateExtruderStack()
self.extruderPositionChanged.emit()

View file

@ -1279,6 +1279,10 @@ class MachineManager(QObject):
self._global_container_stack.variant = self._empty_variant_container
self._updateQualityWithMaterial()
# See if we need to show the Discard or Keep changes screen
if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1:
self._application.discardOrKeepProfileChanges()
## Find all container stacks that has the pair 'key = value' in its metadata and replaces the value with 'new_value'
def replaceContainersMetadata(self, key: str, value: str, new_value: str) -> None:
machines = ContainerRegistry.getInstance().findContainerStacks(type = "machine")

View file

@ -12,6 +12,7 @@ Column
height: childrenRect.height
width: parent.width
spacing: UM.Theme.getSize("default_margin").height
/* Hidden for 3.4
Label
{
id: heading
@ -20,6 +21,7 @@ Column
color: UM.Theme.getColor("text_medium")
font: UM.Theme.getFont("medium")
}
*/
GridLayout
{
id: grid

View file

@ -65,6 +65,7 @@ ScrollView
}
}
}
/* Hidden in 3.4
Label
{
visible: toolbox.materialsInstalledModel.items.length > 0
@ -102,5 +103,6 @@ ScrollView
}
}
}
*/
}
}

View file

@ -16,7 +16,7 @@ Item
{
color: UM.Theme.getColor("lining")
width: parent.width
height: UM.Theme.getSize("default_lining").height
height: Math.floor(UM.Theme.getSize("default_lining").height)
anchors.bottom: parent.bottom
}
Row
@ -40,14 +40,14 @@ Item
Column
{
id: pluginInfo
topPadding: UM.Theme.getSize("default_margin").height / 2
topPadding: Math.floor(UM.Theme.getSize("default_margin").height / 2)
property var color: model.type === "plugin" && !isEnabled ? UM.Theme.getColor("lining") : UM.Theme.getColor("text")
width: tileRow.width - (authorInfo.width + pluginActions.width + 2 * tileRow.spacing + ((disableButton.visible) ? disableButton.width + tileRow.spacing : 0))
width: Math.floor(tileRow.width - (authorInfo.width + pluginActions.width + 2 * tileRow.spacing + ((disableButton.visible) ? disableButton.width + tileRow.spacing : 0)))
Label
{
text: model.name
width: parent.width
height: UM.Theme.getSize("toolbox_property_label").height
height: Math.floor(UM.Theme.getSize("toolbox_property_label").height)
wrapMode: Text.WordWrap
font: UM.Theme.getFont("default_bold")
color: pluginInfo.color
@ -81,7 +81,7 @@ Item
}
}
width: parent.width
height: UM.Theme.getSize("toolbox_property_label").height
height: Math.floor(UM.Theme.getSize("toolbox_property_label").height)
wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft

View file

@ -81,11 +81,10 @@ Item {
text: PrintInformation.jobName
horizontalAlignment: TextInput.AlignRight
onEditingFinished: {
PrintInformation.setJobName(text, true);
if (printJobTextfield.text != ''){
text = text == "" ? "unnamed" : text;
PrintInformation.setJobName(printJobTextfield.text, true);
printJobTextfield.focus = false;
}
}
validator: RegExpValidator {
regExp: /^[^\\ \/ \*\?\|\[\]]*$/
}

View file

@ -63,8 +63,7 @@ Menu
exclusiveGroup: group
onTriggered:
{
var activeExtruderIndex = Cura.ExtruderManager.activeExtruderIndex;
Cura.MachineManager.setMaterial(activeExtruderIndex, model.container_node);
Cura.MachineManager.setMaterial(extruderIndex, model.container_node);
}
}
onObjectAdded: brandMaterialsMenu.insertItem(index, object)