diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py
index 47672a9823..6100b7a39e 100644
--- a/cura/PrintInformation.py
+++ b/cura/PrintInformation.py
@@ -227,7 +227,8 @@ class PrintInformation(QObject):
# when a file is opened using the terminal; the filename comes from _onFileLoaded and still contains its
# extension. This cuts the extension off if necessary.
name = os.path.splitext(name)[0]
- if self._job_name != name:
+
+ if self._job_name != name and (self._job_name == "" or name == ""):
self._job_name = name
self.jobNameChanged.emit()
diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py
index 5e384d1d03..ec1b0ac175 100755
--- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py
+++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py
@@ -326,6 +326,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
return True
def _stopCamera(self):
+ self._stream_buffer = b""
+ self._stream_buffer_start_index = -1
+
if self._camera_timer.isActive():
self._camera_timer.stop()
@@ -1166,6 +1169,12 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
return
self._stream_buffer += self._image_reply.readAll()
+ if len(self._stream_buffer) > 2000000: # No single camera frame should be 2 Mb or larger
+ Logger.log("w", "MJPEG buffer exceeds reasonable size. Restarting stream...")
+ self._stopCamera() # resets stream buffer and start index
+ self._startCamera()
+ return
+
if self._stream_buffer_start_index == -1:
self._stream_buffer_start_index = self._stream_buffer.indexOf(b'\xff\xd8')
stream_buffer_end_index = self._stream_buffer.lastIndexOf(b'\xff\xd9')
diff --git a/resources/qml/ExtruderButton.qml b/resources/qml/ExtruderButton.qml
index 296964448b..0037207e87 100644
--- a/resources/qml/ExtruderButton.qml
+++ b/resources/qml/ExtruderButton.qml
@@ -16,7 +16,7 @@ Button
text: catalog.i18ncp("@label %1 is filled in with the name of an extruder", "Print Selected Model with %1", "Print Selected Models with %1", UM.Selection.selectionCount).arg(extruder.name)
style: UM.Theme.styles.tool_button;
- iconSource: checked ? UM.Theme.getIcon("material_selected") : UM.Theme.getIcon("material_not_selected");
+ iconSource: UM.Theme.getIcon("extruder_button")
checked: ExtruderManager.selectedObjectExtruders.indexOf(extruder.id) != -1
enabled: UM.Selection.hasSelection
@@ -36,12 +36,7 @@ Button
Item
{
- anchors
- {
- right: parent.right;
- top: parent.top;
- margins: UM.Theme.getSize("default_lining").width * 3
- }
+ anchors.centerIn: parent
width: UM.Theme.getSize("default_margin").width
height: UM.Theme.getSize("default_margin").height
@@ -54,22 +49,27 @@ Button
}
}
+ // Material colour circle
+ // Only draw the filling colour of the material inside the SVG border.
Rectangle
{
anchors
{
- left: parent.left;
- top: parent.top;
- margins: UM.Theme.getSize("default_lining").width * 3
+ right: parent.right
+ top: parent.top
+ margins: UM.Theme.getSize("extruder_button_material_margin").width
}
color: model.color
- width: UM.Theme.getSize("default_margin").width
- height: UM.Theme.getSize("default_margin").height
+ width: UM.Theme.getSize("extruder_button_material_size").width
+ height: UM.Theme.getSize("extruder_button_material_size").height
+ radius: width / 2
- border.width: UM.Theme.getSize("default_lining").width
- border.color: UM.Theme.getColor("lining");
+ border.width: 0
+ border.color: "transparent"
+
+ opacity: !base.enabled ? 0.2 : 1.0
}
onClicked:
diff --git a/resources/qml/Settings/SettingExtruder.qml b/resources/qml/Settings/SettingExtruder.qml
index 15496eaa8b..ac9f6a29eb 100644
--- a/resources/qml/Settings/SettingExtruder.qml
+++ b/resources/qml/Settings/SettingExtruder.qml
@@ -97,36 +97,36 @@ SettingItem
}
label: Item
{
+ Label
+ {
+ id: extruderText
+ anchors.verticalCenter: parent.verticalCenter
+
+ text: control.currentText
+ font: UM.Theme.getFont("default")
+ color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
+
+ elide: Text.ElideLeft
+ verticalAlignment: Text.AlignVCenter
+ }
Rectangle
{
id: swatch
height: UM.Theme.getSize("setting_control").height / 2
width: height
- anchors.verticalCenter: parent.verticalCenter
-
- border.width: UM.Theme.getSize("default_lining").width
- border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
-
- color: control.color
- }
- Label
- {
anchors
{
- left: swatch.right;
- right: arrow.left;
+ right: arrow.left
verticalCenter: parent.verticalCenter
- margins: UM.Theme.getSize("default_lining").width
+ margins: UM.Theme.getSize("default_margin").width / 4
}
- width: parent.width - swatch.width;
- text: control.currentText
- font: UM.Theme.getFont("default")
- color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
+ border.width: UM.Theme.getSize("default_lining").width * 2
+ border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
+ radius: width / 2
- elide: Text.ElideRight
- verticalAlignment: Text.AlignVCenter
+ color: control.color
}
UM.RecolorImage
{
diff --git a/resources/qml/Settings/SettingOptionalExtruder.qml b/resources/qml/Settings/SettingOptionalExtruder.qml
index 0fd36564a1..4e49f0440e 100644
--- a/resources/qml/Settings/SettingOptionalExtruder.qml
+++ b/resources/qml/Settings/SettingOptionalExtruder.qml
@@ -116,29 +116,10 @@ SettingItem
}
label: Item
{
- Rectangle
- {
- id: swatch
- height: UM.Theme.getSize("setting_control").height / 2
- width: height
-
- anchors.verticalCenter: parent.verticalCenter
-
- border.width: UM.Theme.getSize("default_lining").width
- border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
-
- color: control.color
- }
Label
{
- anchors
- {
- left: swatch.right;
- right: arrow.left;
- verticalCenter: parent.verticalCenter
- margins: UM.Theme.getSize("default_lining").width
- }
- width: parent.width - swatch.width;
+ anchors.verticalCenter: parent.verticalCenter
+ width: parent.width - swatch.width - arrow.width;
text: control.currentText
font: UM.Theme.getFont("default")
@@ -147,6 +128,25 @@ SettingItem
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
+ Rectangle
+ {
+ id: swatch
+ height: UM.Theme.getSize("setting_control").height / 2
+ width: height
+
+ anchors
+ {
+ right: arrow.left;
+ verticalCenter: parent.verticalCenter
+ margins: UM.Theme.getSize("default_margin").width / 4
+ }
+
+ border.width: UM.Theme.getSize("default_lining").width * 2
+ border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
+ radius: width / 2
+
+ color: control.color
+ }
UM.RecolorImage
{
id: arrow
diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml
index 606e629b45..f3ed19d521 100644
--- a/resources/qml/SidebarHeader.qml
+++ b/resources/qml/SidebarHeader.qml
@@ -22,6 +22,30 @@ Column
signal showTooltip(Item item, point location, string text)
signal hideTooltip()
+ Item
+ {
+ height: UM.Theme.getSize("default_margin").height / 4
+ width: height
+ visible: extruderSelectionRow.visible
+ }
+
+ Label
+ {
+ id: extruderSelectionLabel
+ anchors
+ {
+ left: parent.left
+ leftMargin: UM.Theme.getSize("default_margin").width
+ right: parent.right
+ rightMargin: UM.Theme.getSize("default_margin").width
+ }
+ height: UM.Theme.getSize("sidebar_tabs").height / 3
+ text: catalog.i18nc("@label", "Extruder configuration")
+ font: UM.Theme.getFont("default_bold")
+ color: UM.Theme.getColor("text")
+ visible: extruderSelectionRow.visible
+ }
+
Item
{
id: extruderSelectionRow
@@ -29,16 +53,12 @@ Column
height: UM.Theme.getSize("sidebar_tabs").height
visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint
- Rectangle
+ anchors
{
- id: extruderSeparator
- visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint
-
- width: parent.width
- height: parent.height
- color: UM.Theme.getColor("sidebar_lining")
-
- anchors.top: extruderSelectionRow.top
+ left: parent.left
+ leftMargin: UM.Theme.getSize("default_margin").width
+ right: parent.right
+ rightMargin: UM.Theme.getSize("default_margin").width
}
ListView
@@ -53,8 +73,10 @@ Column
anchors
{
left: parent.left
+ leftMargin: UM.Theme.getSize("default_margin").width / 2
right: parent.right
- bottom: extruderSelectionRow.bottom
+ rightMargin: UM.Theme.getSize("default_margin").width / 2
+ verticalCenter: parent.verticalCenter
}
ExclusiveGroup { id: extruderMenuGroup; }
@@ -92,61 +114,116 @@ Column
style: ButtonStyle
{
- background: Rectangle
+ background: Item
{
- border.width: UM.Theme.getSize("default_lining").width
- border.color: control.checked ? UM.Theme.getColor("tab_checked_border") :
- control.pressed ? UM.Theme.getColor("tab_active_border") :
- control.hovered ? UM.Theme.getColor("tab_hovered_border") : UM.Theme.getColor("tab_unchecked_border")
- color: control.checked ? UM.Theme.getColor("tab_checked") :
- control.pressed ? UM.Theme.getColor("tab_active") :
- control.hovered ? UM.Theme.getColor("tab_hovered") : UM.Theme.getColor("tab_unchecked")
- Behavior on color { ColorAnimation { duration: 50; } }
-
Rectangle
{
- id: highlight
- visible: control.checked
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: parent.top
- height: UM.Theme.getSize("sidebar_header_highlight").height
- color: UM.Theme.getColor("sidebar_header_bar")
- }
-
- Rectangle
- {
- id: swatch
- visible: index > -1
- height: UM.Theme.getSize("setting_control").height / 2
- width: height
- anchors.left: parent.left
- anchors.leftMargin: (parent.height - height) / 2
- anchors.verticalCenter: parent.verticalCenter
-
- color: model.color
+ anchors.fill: parent
border.width: UM.Theme.getSize("default_lining").width
- border.color: UM.Theme.getColor("setting_control_border")
+ border.color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_border") :
+ control.hovered ? UM.Theme.getColor("action_button_hovered_border") :
+ UM.Theme.getColor("action_button_border")
+ color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active") :
+ control.hovered ? UM.Theme.getColor("action_button_hovered") :
+ UM.Theme.getColor("action_button")
+ Behavior on color { ColorAnimation { duration: 50; } }
}
- Text
+ Item
{
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: swatch.visible ? swatch.right : parent.left
- anchors.leftMargin: swatch.visible ? UM.Theme.getSize("sidebar_margin").width / 2 : UM.Theme.getSize("sidebar_margin").width
- anchors.right: parent.right
- anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width / 2
+ id: extruderButtonFace
+ anchors.centerIn: parent
+ width: {
+ var extruderTextWidth = extruderStaticText.visible ? extruderStaticText.width : 0;
+ var iconWidth = extruderIconItem.width;
+ return extruderTextWidth + iconWidth + UM.Theme.getSize("default_margin").width / 4;
+ }
- color: control.checked ? UM.Theme.getColor("tab_checked_text") :
- control.pressed ? UM.Theme.getColor("tab_active_text") :
- control.hovered ? UM.Theme.getColor("tab_hovered_text") : UM.Theme.getColor("tab_unchecked_text")
+ // Static text "Extruder"
+ Text
+ {
+ id: extruderStaticText
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
- font: UM.Theme.getFont("default")
- text: control.text
- elide: Text.ElideRight
+ color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") :
+ control.hovered ? UM.Theme.getColor("action_button_hovered_text") :
+ UM.Theme.getColor("action_button_text")
+
+ font: UM.Theme.getFont("default")
+ text: catalog.i18nc("@label", "Extruder")
+ visible: width < (control.width - extruderIconItem.width - UM.Theme.getSize("default_margin").width)
+ elide: Text.ElideRight
+ }
+
+ // Everthing for the extruder icon
+ Item
+ {
+ id: extruderIconItem
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.right: parent.right
+
+ property var sizeToUse:
+ {
+ var minimumWidth = control.width < UM.Theme.getSize("button").width ? control.width : UM.Theme.getSize("button").width;
+ var minimumHeight = control.height < UM.Theme.getSize("button").height ? control.height : UM.Theme.getSize("button").height;
+ var minimumSize = minimumWidth < minimumHeight ? minimumWidth : minimumHeight;
+ minimumSize -= UM.Theme.getSize("default_margin").width;
+ return minimumSize;
+ }
+
+ width: sizeToUse
+ height: sizeToUse
+
+ UM.RecolorImage {
+ id: mainCircle
+ anchors.fill: parent
+
+ sourceSize.width: parent.width
+ sourceSize.height: parent.width
+ source: UM.Theme.getIcon("extruder_button")
+
+ color: extruderNumberText.color
+ }
+
+ Text
+ {
+ id: extruderNumberText
+ anchors.centerIn: parent
+ text: index + 1;
+ color: (control.checked || control.pressed) ? UM.Theme.getColor("action_button_active_text") :
+ control.hovered ? UM.Theme.getColor("action_button_hovered_text") :
+ UM.Theme.getColor("action_button_text")
+ font: UM.Theme.getFont("default_bold")
+ }
+
+ // Material colour circle
+ // Only draw the filling colour of the material inside the SVG border.
+ Rectangle
+ {
+ anchors
+ {
+ right: parent.right
+ top: parent.top
+ rightMargin: parent.sizeToUse * 0.04
+ topMargin: parent.sizeToUse * 0.04
+ }
+
+ color: model.color
+
+ width: parent.width * 0.27
+ height: parent.height * 0.27
+ radius: width / 2
+
+ border.width: 0
+ border.color: "transparent"
+
+ opacity: !control.checked ? 0.6 : 1.0
+ }
+ }
}
}
- label: Item { }
+ label: Item {}
}
}
}
diff --git a/resources/themes/cura-light/icons/extruder_button.svg b/resources/themes/cura-light/icons/extruder_button.svg
new file mode 100644
index 0000000000..883e3caaf4
--- /dev/null
+++ b/resources/themes/cura-light/icons/extruder_button.svg
@@ -0,0 +1,70 @@
+
+
diff --git a/resources/themes/cura-light/icons/material_not_selected.svg b/resources/themes/cura-light/icons/material_not_selected.svg
deleted file mode 100644
index 9b3cad88bd..0000000000
--- a/resources/themes/cura-light/icons/material_not_selected.svg
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
diff --git a/resources/themes/cura-light/icons/material_selected.svg b/resources/themes/cura-light/icons/material_selected.svg
deleted file mode 100644
index 6589eac416..0000000000
--- a/resources/themes/cura-light/icons/material_selected.svg
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml
index cfe35ca789..d40fa1c9d1 100755
--- a/resources/themes/cura-light/styles.qml
+++ b/resources/themes/cura-light/styles.qml
@@ -606,24 +606,11 @@ QtObject {
}
label: Item
{
- Rectangle
- {
- id: swatch
- height: UM.Theme.getSize("setting_control").height / 2
- width: height
- anchors.left: parent.left
- anchors.leftMargin: UM.Theme.getSize("default_lining").width
- anchors.verticalCenter: parent.verticalCenter
-
- color: if (control.color_override != "") {return control.color_override} else {return control.color;}
- border.width: UM.Theme.getSize("default_lining").width
- border.color: !enabled ? UM.Theme.getColor("setting_control_disabled_border") : UM.Theme.getColor("setting_control_border")
- }
Label
{
- anchors.left: swatch.right
+ anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_lining").width
- anchors.right: downArrow.left
+ anchors.right: swatch.left
anchors.rightMargin: UM.Theme.getSize("default_lining").width
anchors.verticalCenter: parent.verticalCenter
@@ -634,7 +621,25 @@ QtObject {
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
+ Rectangle
+ {
+ id: swatch
+ height: UM.Theme.getSize("setting_control").height / 2
+ width: height
+ anchors
+ {
+ right: downArrow.left;
+ verticalCenter: parent.verticalCenter
+ margins: UM.Theme.getSize("default_margin").width / 4
+ }
+
+ border.width: UM.Theme.getSize("default_lining").width * 2
+ border.color: enabled ? UM.Theme.getColor("setting_control_border") : UM.Theme.getColor("setting_control_disabled_border")
+ radius: width / 2
+
+ color: if (control.color_override != "") {return control.color_override} else {return control.color;}
+ }
UM.RecolorImage
{
id: downArrow
diff --git a/resources/themes/cura-light/theme.json b/resources/themes/cura-light/theme.json
index 85f62c2851..398fbac3eb 100644
--- a/resources/themes/cura-light/theme.json
+++ b/resources/themes/cura-light/theme.json
@@ -269,6 +269,9 @@
"default_arrow": [0.8, 0.8],
"logo": [7.6, 1.6],
+ "extruder_button_material_margin": [0.875, 0.875],
+ "extruder_button_material_size": [0.68, 0.68],
+
"sidebar": [35.0, 10.0],
"sidebar_margin": [1.71, 1.43],
"sidebar_margin_thin": [0.71, 0.71],