Merge branch '3.1'

This commit is contained in:
Mark 2017-11-23 10:38:48 +01:00
commit aee838c8c1
12 changed files with 343 additions and 8 deletions

1
.gitignore vendored
View file

@ -44,6 +44,7 @@ plugins/cura-god-mode-plugin
plugins/cura-big-flame-graph
plugins/cura-siemensnx-plugin
plugins/CuraVariSlicePlugin
plugins/CuraLiveScriptingPlugin
#Build stuff
CMakeCache.txt

View file

@ -70,6 +70,7 @@ class PrintInformation(QObject):
Application.getInstance().globalContainerStackChanged.connect(self._updateJobName)
Application.getInstance().fileLoaded.connect(self.setBaseName)
Application.getInstance().workspaceLoaded.connect(self.setProjectName)
Preferences.getInstance().preferenceChanged.connect(self._onPreferencesChanged)
self._active_material_container = None
@ -283,7 +284,11 @@ class PrintInformation(QObject):
return self._base_name
@pyqtSlot(str)
def setBaseName(self, base_name):
def setProjectName(self, name):
self.setBaseName(name, is_project_file = True)
@pyqtSlot(str)
def setBaseName(self, base_name, is_project_file = False):
# Ensure that we don't use entire path but only filename
name = os.path.basename(base_name)
@ -291,15 +296,17 @@ class PrintInformation(QObject):
# extension. This cuts the extension off if necessary.
name = os.path.splitext(name)[0]
# if this is a profile file, always update the job name
# name is "" when I first had some meshes and afterwards I deleted them so the naming should start again
is_empty = name == ""
if is_empty or (self._base_name == "" and self._base_name != name):
if is_project_file or (is_empty or (self._base_name == "" and self._base_name != name)):
# remove ".curaproject" suffix from (imported) the file name
if name.endswith(".curaproject"):
name = name[:name.rfind(".curaproject")]
self._base_name = name
self._updateJobName()
## Created an acronymn-like abbreviated machine name from the currently active machine name
# Called each time the global stack is switched
def _setAbbreviatedMachineName(self):

View file

@ -409,7 +409,7 @@ class CuraContainerRegistry(ContainerRegistry):
extruder_stack = None
# if extruders are defined in the machine definition use those instead
if machine.extruders and len(machine.extruders) > 0:
if machine.extruders and "0" in machine.extruders:
new_extruder_id = machine.extruders["0"].getId()
extruder_stack = machine.extruders["0"]
@ -449,15 +449,16 @@ class CuraContainerRegistry(ContainerRegistry):
extruder_stack.setVariantById(variant_id)
extruder_stack.setMaterialById("default")
extruder_stack.setQualityById("default")
quality_changes_id = "default"
if machine.qualityChanges.getId() != "empty_quality_changes":
extruder_quality_changes_container = self.findInstanceContainers(name = machine.qualityChanges.getName(), extruder = extruder_id)
if extruder_quality_changes_container:
quality_changes_id = extruder_quality_changes_container[0].getId()
extruder_stack.setQualityChangesById(quality_changes_id)
extruder_stack.setQualityChangesById(quality_changes_id)
self.addContainer(extruder_stack)
return extruder_stack
# Fix the extruders that were upgraded to ExtruderStack instances during addContainer.
# The stacks are now responsible for setting the next stack on deserialize. However,
# due to problems with loading order, some stacks may not have the proper next stack

View file

@ -621,9 +621,16 @@ class MachineManager(QObject):
def activeQualityId(self) -> str:
if self._active_container_stack:
quality = self._active_container_stack.quality
if isinstance(quality, type(self._empty_quality_container)):
return ""
quality_changes = self._active_container_stack.qualityChanges
if quality and quality_changes and isinstance(quality_changes, type(self._empty_quality_changes_container)) and not isinstance(quality, type(self._empty_quality_container)):
return quality.getId()
if quality and quality_changes:
if isinstance(quality_changes, type(self._empty_quality_changes_container)):
# It's a built-in profile
return quality.getId()
else:
# Custom profile
return quality_changes.getId()
return ""
@pyqtProperty(str, notify=activeQualityChanged)

View file

@ -746,7 +746,7 @@ class ThreeMFWorkspaceReader(WorkspaceReader):
# If not extruder stacks were saved in the project file (pre 3.1) create one manually
# We re-use the container registry's addExtruderStackForSingleExtrusionMachine method for this
if not extruder_stacks:
self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder")
extruder_stacks.append(self._container_registry.addExtruderStackForSingleExtrusionMachine(global_stack, "fdmextruder"))
except:
Logger.logException("w", "We failed to serialize the stack. Trying to clean up.")

View file

@ -220,6 +220,81 @@ Rectangle
menu: PrinterMenu { }
}
//View orientation Item
Row
{
id: viewOrientationControl
height: 30
spacing: 2
anchors {
verticalCenter: base.verticalCenter
right: viewModeButton.right
rightMargin: UM.Theme.getSize("default_margin").width + viewModeButton.width
}
// #1 3d view
Button
{
iconSource: UM.Theme.getIcon("view_3d")
style: UM.Theme.styles.orientation_button
anchors.verticalCenter: viewOrientationControl.verticalCenter
onClicked:{
UM.Controller.rotateView("3d", 0);
}
visible: base.width > 1100
}
// #2 Front view
Button
{
iconSource: UM.Theme.getIcon("view_front")
style: UM.Theme.styles.orientation_button
anchors.verticalCenter: viewOrientationControl.verticalCenter
onClicked:{
UM.Controller.rotateView("home", 0);
}
visible: base.width > 1130
}
// #3 Top view
Button
{
iconSource: UM.Theme.getIcon("view_top")
style: UM.Theme.styles.orientation_button
anchors.verticalCenter: viewOrientationControl.verticalCenter
onClicked:{
UM.Controller.rotateView("y", 90);
}
visible: base.width > 1160
}
// #4 Left view
Button
{
iconSource: UM.Theme.getIcon("view_left")
style: UM.Theme.styles.orientation_button
anchors.verticalCenter: viewOrientationControl.verticalCenter
onClicked:{
UM.Controller.rotateView("x", 90);
}
visible: base.width > 1190
}
// #5 Left view
Button
{
iconSource: UM.Theme.getIcon("view_right")
style: UM.Theme.styles.orientation_button
anchors.verticalCenter: viewOrientationControl.verticalCenter
onClicked:{
UM.Controller.rotateView("x", -90);
}
visible: base.width > 1210
}
}
ComboBox
{
id: viewModeButton

View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
<title>icn_perspectives_white</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icn_perspectives_white" fill="#1F2427">
<polygon id="Polygon" points="15 3 26 7.75 15 13 4 7.75"></polygon>
<polygon id="Rectangle-3" points="16 15 26 10 26 21 16 26"></polygon>
<polygon id="Rectangle-3-Copy" transform="translate(9.000000, 18.000000) scale(-1, 1) translate(-9.000000, -18.000000) " points="4 15 14 10 14 21 4 26"></polygon>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 868 B

View file

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
<title>icn_front_white</title>
<desc>Created with Sketch.</desc>
<defs>
<rect id="path-1" x="4" y="11" width="15" height="15"></rect>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icn_front_white">
<polygon id="Path-2" stroke="#1F2427" points="25.9854977 4 11.3636023 4 4.05692142 11.3333333 4 26 18.6890523 26 26 18.6666667"></polygon>
<g id="Rectangle-3-Copy-3">
<use fill="#1F2427" fill-rule="evenodd" xlink:href="#path-1"></use>
<rect stroke="#1F2427" stroke-width="1" x="4.5" y="11.5" width="14" height="14"></rect>
</g>
<path d="M18.4012594,11.6428026 L26,4" id="Path-3" stroke="#1F2427"></path>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
<title>icn_left_white</title>
<desc>Created with Sketch.</desc>
<defs>
<polygon id="path-1" points="0 7.33333333 7.13513514 0 7.13513514 14.6666667 0 22"></polygon>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icn_left_white">
<g id="Group-Copy" transform="translate(4.000000, 4.000000)">
<polygon id="Path-2-Copy-4" stroke="#1F2427" transform="translate(10.735474, 11.000000) scale(-1, 1) translate(-10.735474, -11.000000) " points="21.4567937 0 7.18652344 0 0.0555525861 7.33333333 0 22 14.3358121 22 21.4709473 14.6666667"></polygon>
<g id="Rectangle-3-Copy-14" transform="translate(3.567568, 11.000000) scale(-1, 1) translate(-3.567568, -11.000000) ">
<use fill="#1F2427" fill-rule="evenodd" xlink:href="#path-1"></use>
<path stroke="#1F2427" stroke-width="1" d="M0.5,7.53643942 L0.5,20.7691161 L6.63513514,14.4635606 L6.63513514,1.23088386 L0.5,7.53643942 Z"></path>
</g>
<path d="M6.65507549,7.42568631 L21.5199404,7.42568631" id="Path-3" stroke="#1F2427"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
<title>icn_right_white</title>
<desc>Created with Sketch.</desc>
<defs>
<polygon id="path-1" points="14.2702703 7.33333333 21.4054054 0 21.4054054 14.6666667 14.2702703 22"></polygon>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icn_right_white">
<g id="Group-2-Copy" transform="translate(4.000000, 4.000000)">
<polygon id="Path-2-Copy-2" stroke="#1F2427" points="21.4567937 0 7.18652344 0 0.0555525861 7.33333333 0 22 14.3358121 22 21.4709473 14.6666667"></polygon>
<g id="Rectangle-3-Copy-10">
<use fill="#1F2427" fill-rule="evenodd" xlink:href="#path-1"></use>
<path stroke="#1F2427" stroke-width="1" d="M14.7702703,7.53643942 L14.7702703,20.7691161 L20.9054054,14.4635606 L20.9054054,1.23088386 L14.7702703,7.53643942 Z"></path>
</g>
<path d="M0.114534945,7.42568631 L14.9793998,7.42568631" id="Path-3" stroke="#1F2427"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="30px" height="30px" viewBox="0 0 30 30" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 47.1 (45422) - http://www.bohemiancoding.com/sketch -->
<title>icn_top_white</title>
<desc>Created with Sketch.</desc>
<defs>
<polygon id="path-1" points="7.13513514 0 21.4054054 0 14.2702703 7.33333333 0 7.33333333"></polygon>
</defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icn_top_white">
<g id="Group-3-Copy" transform="translate(4.000000, 4.000000)">
<polygon id="Path-2-Copy" stroke="#1F2427" points="21.4567937 0 7.18652344 0 0.0555525861 7.33333333 0 22 14.3358121 22 21.4709473 14.6666667"></polygon>
<g id="Rectangle-3-Copy-6">
<use fill="#1F2427" fill-rule="evenodd" xlink:href="#path-1"></use>
<path stroke="#1F2427" stroke-width="1" d="M7.34626538,0.5 L1.18410322,6.83333333 L14.05914,6.83333333 L20.2213022,0.5 L7.34626538,0.5 Z"></path>
</g>
<path d="M14.2702703,22 L14.2702703,6.72222222" id="Path-3" stroke="#1F2427"></path>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -381,6 +381,111 @@ QtObject {
}
}
property Component orientation_button: Component {
ButtonStyle {
background: Item {
implicitWidth: 25;
implicitHeight: 25;
Rectangle {
id: buttonFace2;
anchors.fill: parent;
property bool down: control.pressed || (control.checkable && control.checked);
color: {
if(control.customColor !== undefined && control.customColor !== null) {
return control.customColor
} else if(control.checkable && control.checked && control.hovered) {
return Theme.getColor("button_active_hover");
} else if(control.pressed || (control.checkable && control.checked)) {
return Theme.getColor("button_active");
} else if(control.hovered) {
return Theme.getColor("button_hover");
} else {
//return Theme.getColor("button");
return "transparent"
}
}
Behavior on color { ColorAnimation { duration: 50; } }
border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0
border.color: Theme.getColor("tool_button_border")
UM.RecolorImage {
id: tool_button_arrow2
//anchors.right: parent.right;
//anchors.rightMargin: (Theme.getSize("button").width - Theme.getSize("button_icon").width) / 4
//anchors.bottom: parent.bottom;
//anchors.bottomMargin: (Theme.getSize("button").height - Theme.getSize("button_icon").height) / 4
//width: Theme.getSize("standard_arrow").width
//height: Theme.getSize("standard_arrow").height
width: 5
height: 5
sourceSize.width: 5
sourceSize.height: 5
visible: control.menu != null;
color:
{
if(control.checkable && control.checked && control.hovered)
{
return Theme.getColor("button_text_active_hover");
}
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("button_text_active");
}
else if(control.hovered)
{
return Theme.getColor("button_text_hover");
}
else
{
return Theme.getColor("button_text");
}
}
source: Theme.getIcon("arrow_bottom")
}
}
}
label: Item {
UM.RecolorImage {
anchors.centerIn: parent;
opacity: !control.enabled ? 0.2 : 1.0
source: control.iconSource;
width: 20;
height: 20;
color:
{
if(control.checkable && control.checked && control.hovered)
{
return Theme.getColor("button_text_active_hover");
}
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("button_text_active");
}
else if(control.hovered)
{
//return Theme.getColor("button_text_hover");
return "white"
}
else
{
//return Theme.getColor("button_text");
return "black"
}
}
sourceSize: Theme.getSize("button_icon")
}
}
}
}
property Component progressbar: Component{
ProgressBarStyle {
background: Rectangle {
@ -753,6 +858,49 @@ QtObject {
}
}
property Component partially_checkbox: Component {
CheckBoxStyle {
background: Item { }
indicator: Rectangle {
implicitWidth: Theme.getSize("checkbox").width;
implicitHeight: Theme.getSize("checkbox").height;
color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_hover") : Theme.getColor("checkbox");
Behavior on color { ColorAnimation { duration: 50; } }
radius: control.exclusiveGroup ? Theme.getSize("checkbox").width / 2 : 0
border.width: Theme.getSize("default_lining").width;
border.color: (control.hovered || control._hovered) ? Theme.getColor("checkbox_border_hover") : Theme.getColor("checkbox_border");
UM.RecolorImage {
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width / 2.5
height: parent.height / 2.5
sourceSize.width: width
sourceSize.height: width
color: Theme.getColor("checkbox_mark")
source: {
if (control.checkbox_state == 2){
return Theme.getIcon("solid")
}
else{
return control.exclusiveGroup ? Theme.getIcon("dot") : Theme.getIcon("check")
}
}
opacity: control.checked
Behavior on opacity { NumberAnimation { duration: 100; } }
}
}
label: Label {
text: control.text;
color: Theme.getColor("checkbox_text");
font: Theme.getFont("default");
}
}
}
property Component slider: Component {
SliderStyle {
groove: Rectangle {