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() f = file.toLocalFile()
extension = os.path.splitext(f)[1] extension = os.path.splitext(f)[1]
extension = extension.lower()
filename = os.path.basename(f) filename = os.path.basename(f)
if len(self._currently_loading_files) > 0: 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 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( message = Message(
self._i18n_catalog.i18nc("@info:status", self._i18n_catalog.i18nc("@info:status",
"Only one G-code file can be loaded at a time. Skipped importing {0}", "Only one G-code file can be loaded at a time. Skipped importing {0}",
@ -1548,7 +1549,8 @@ class CuraApplication(QtApplication):
return return
# If file being loaded is non-slicable file, then prevent loading of any other files # 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] 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( message = Message(
self._i18n_catalog.i18nc("@info:status", self._i18n_catalog.i18nc("@info:status",
"Can't open any other file if G-code is loading. Skipped importing {0}", "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_position = 0
self._extruder_stack = None 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): def _updateExtruderStack(self):
global_stack = self._machine_manager.activeMachine global_stack = self._machine_manager.activeMachine
@ -50,9 +52,11 @@ class BaseMaterialsModel(ListModel):
self._extruder_stack = global_stack.extruders.get(str(self._extruder_position)) self._extruder_stack = global_stack.extruders.get(str(self._extruder_position))
if self._extruder_stack is not None: if self._extruder_stack is not None:
self._extruder_stack.pyqtContainersChanged.connect(self._update) self._extruder_stack.pyqtContainersChanged.connect(self._update)
# Force update the model when the extruder stack changes
self._update()
def setExtruderPosition(self, position: int): 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._extruder_position = position
self._updateExtruderStack() self._updateExtruderStack()
self.extruderPositionChanged.emit() self.extruderPositionChanged.emit()

View file

@ -1279,6 +1279,10 @@ class MachineManager(QObject):
self._global_container_stack.variant = self._empty_variant_container self._global_container_stack.variant = self._empty_variant_container
self._updateQualityWithMaterial() 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' ## 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: def replaceContainersMetadata(self, key: str, value: str, new_value: str) -> None:
machines = ContainerRegistry.getInstance().findContainerStacks(type = "machine") machines = ContainerRegistry.getInstance().findContainerStacks(type = "machine")

View file

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

View file

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

View file

@ -16,7 +16,7 @@ Item
{ {
color: UM.Theme.getColor("lining") color: UM.Theme.getColor("lining")
width: parent.width width: parent.width
height: UM.Theme.getSize("default_lining").height height: Math.floor(UM.Theme.getSize("default_lining").height)
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
} }
Row Row
@ -40,14 +40,14 @@ Item
Column Column
{ {
id: pluginInfo 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") 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 Label
{ {
text: model.name text: model.name
width: parent.width width: parent.width
height: UM.Theme.getSize("toolbox_property_label").height height: Math.floor(UM.Theme.getSize("toolbox_property_label").height)
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
font: UM.Theme.getFont("default_bold") font: UM.Theme.getFont("default_bold")
color: pluginInfo.color color: pluginInfo.color
@ -81,7 +81,7 @@ Item
} }
} }
width: parent.width width: parent.width
height: UM.Theme.getSize("toolbox_property_label").height height: Math.floor(UM.Theme.getSize("toolbox_property_label").height)
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft

View file

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

View file

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