Merge remote-tracking branch 'origin/4.0' into CL-1151_add_monitor_carousel

This commit is contained in:
Ian Paschal 2018-12-14 16:31:47 +01:00
commit 6747fe3550
39 changed files with 283 additions and 496 deletions

View File

@ -205,6 +205,8 @@ class CuraApplication(QtApplication):
self._container_manager = None
self._object_manager = None
self._extruders_model = None
self._extruders_model_with_optional = None
self._build_plate_model = None
self._multi_build_plate_model = None
self._setting_visibility_presets_model = None
@ -862,6 +864,19 @@ class CuraApplication(QtApplication):
self._object_manager = ObjectsModel.createObjectsModel()
return self._object_manager
@pyqtSlot(result = QObject)
def getExtrudersModel(self, *args) -> "ExtrudersModel":
if self._extruders_model is None:
self._extruders_model = ExtrudersModel(self)
return self._extruders_model
@pyqtSlot(result = QObject)
def getExtrudersModelWithOptional(self, *args) -> "ExtrudersModel":
if self._extruders_model_with_optional is None:
self._extruders_model_with_optional = ExtrudersModel(self)
self._extruders_model_with_optional.setAddOptionalExtruder(True)
return self._extruders_model_with_optional
@pyqtSlot(result = QObject)
def getMultiBuildPlateModel(self, *args) -> MultiBuildPlateModel:
if self._multi_build_plate_model is None:

View File

@ -33,8 +33,6 @@ class NozzleModel(ListModel):
def _update(self):
Logger.log("d", "Updating {model_class_name}.".format(model_class_name = self.__class__.__name__))
self.items.clear()
global_stack = self._machine_manager.activeMachine
if global_stack is None:
self.setItems([])

View File

@ -1,7 +1,7 @@
# Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import Qt, pyqtSignal, pyqtSlot, pyqtProperty, QTimer
from PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty, QTimer
from typing import Iterable
from UM.i18n import i18nCatalog
@ -78,8 +78,6 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
self._update_extruder_timer.setSingleShot(True)
self._update_extruder_timer.timeout.connect(self.__updateExtruders)
self._simple_names = False
self._active_machine_extruders = [] # type: Iterable[ExtruderStack]
self._add_optional_extruder = False
@ -101,21 +99,6 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
def addOptionalExtruder(self):
return self._add_optional_extruder
## Set the simpleNames property.
def setSimpleNames(self, simple_names):
if simple_names != self._simple_names:
self._simple_names = simple_names
self.simpleNamesChanged.emit()
self._updateExtruders()
## Emitted when the simpleNames property changes.
simpleNamesChanged = pyqtSignal()
## Whether or not the model should show all definitions regardless of visibility.
@pyqtProperty(bool, fset = setSimpleNames, notify = simpleNamesChanged)
def simpleNames(self):
return self._simple_names
## Links to the stack-changed signal of the new extruders when an extruder
# is swapped out or added in the current machine.
#
@ -221,7 +204,12 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel):
"enabled": True,
"color": "#ffffff",
"index": -1,
"definition": ""
"definition": "",
"material": "",
"variant": "",
"stack": None,
"material_brand": "",
"color_name": "",
}
items.append(item)
if self._items != items:

View File

@ -88,12 +88,14 @@ class MachineManager(QObject):
self._onGlobalContainerChanged()
ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderStackChanged)
extruder_manager = self._application.getExtruderManager()
extruder_manager.activeExtruderChanged.connect(self._onActiveExtruderStackChanged)
self._onActiveExtruderStackChanged()
ExtruderManager.getInstance().activeExtruderChanged.connect(self.activeMaterialChanged)
ExtruderManager.getInstance().activeExtruderChanged.connect(self.activeVariantChanged)
ExtruderManager.getInstance().activeExtruderChanged.connect(self.activeQualityChanged)
extruder_manager.activeExtruderChanged.connect(self.activeMaterialChanged)
extruder_manager.activeExtruderChanged.connect(self.activeVariantChanged)
extruder_manager.activeExtruderChanged.connect(self.activeQualityChanged)
self.globalContainerChanged.connect(self.activeStackChanged)
self.globalValueChanged.connect(self.activeStackValueChanged)

View File

@ -13,7 +13,7 @@ import Cura 1.0 as Cura
Cura.MachineAction
{
id: base
property var extrudersModel: Cura.ExtrudersModel{}
property var extrudersModel: CuraApplication.getExtrudersModel()
property int extruderTabsCount: 0
property var activeMachineId: Cura.MachineManager.activeMachine != null ? Cura.MachineManager.activeMachine.id : ""

View File

@ -163,7 +163,7 @@ Cura.ExpandableComponent
Repeater
{
model: Cura.ExtrudersModel{}
model: CuraApplication.getExtrudersModel()
CheckBox
{

View File

@ -12,7 +12,6 @@ from UM.Math.Color import Color
from UM.View.GL.OpenGL import OpenGL
from cura.Settings.ExtruderManager import ExtruderManager
from cura.Settings.ExtrudersModel import ExtrudersModel
import math
@ -29,13 +28,16 @@ class SolidView(View):
self._non_printing_shader = None
self._support_mesh_shader = None
self._extruders_model = ExtrudersModel()
self._extruders_model = None
self._theme = None
def beginRendering(self):
scene = self.getController().getScene()
renderer = self.getRenderer()
if not self._extruders_model:
self._extruders_model = Application.getInstance().getExtrudersModel()
if not self._theme:
self._theme = Application.getInstance().getTheme()

View File

@ -83,9 +83,7 @@ Item {
Column {
Repeater {
model: Cura.ExtrudersModel {
simpleNames: true;
}
model: CuraApplication.getExtrudersModel()
Label {
text: model.name;

View File

@ -43,12 +43,13 @@ Button
contentItem: Row
{
spacing: UM.Theme.getSize("narrow_margin").width
//Left side icon. Only displayed if !isIconOnRightSide.
UM.RecolorImage
{
id: buttonIconLeft
source: ""
height: buttonText.height
height: UM.Theme.getSize("action_button_icon").height
width: visible ? height : 0
sourceSize.width: width
sourceSize.height: height
@ -62,7 +63,7 @@ Button
id: buttonText
text: button.text
color: button.enabled ? (button.hovered ? button.textHoverColor : button.textColor): button.textDisabledColor
font: UM.Theme.getFont("action_button")
font: UM.Theme.getFont("medium")
visible: text != ""
renderType: Text.NativeRendering
anchors.verticalCenter: parent.verticalCenter
@ -76,7 +77,7 @@ Button
{
id: buttonIconRight
source: buttonIconLeft.source
height: buttonText.height
height: UM.Theme.getSize("action_button_icon").height
width: visible ? height : 0
sourceSize.width: width
sourceSize.height: height

View File

@ -119,8 +119,6 @@ Column
}
height: UM.Theme.getSize("action_button").height
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Preview")
onClicked: UM.Controller.setActiveStage("PreviewStage")

View File

@ -60,7 +60,7 @@ Column
text: catalog.i18nc("@label:PrintjobStatus", "Unable to Slice")
source: UM.Theme.getIcon("warning")
color: UM.Theme.getColor("warning")
iconColor: UM.Theme.getColor("warning")
}
// Progress bar, only visible when the backend is in the process of slice the printjob

View File

@ -252,7 +252,7 @@ UM.MainWindow
anchors
{
// Align to the top of the stageMenu since the stageMenu may not exist
top: parent.top
top: stageMenu.source ? stageMenu.verticalCenter : parent.top
left: parent.left
right: parent.right
bottom: parent.bottom

View File

@ -15,6 +15,7 @@ Item
{
property alias source: icon.source
property alias iconSize: icon.width
property alias iconColor: icon.color
property alias color: label.color
property alias text: label.text
property alias font: label.font
@ -37,7 +38,7 @@ Item
{
id: icon
width: UM.Theme.getSize("section_icon").width
height: UM.Theme.getSize("section_icon").height
height: width
color: UM.Theme.getColor("icon")

View File

@ -16,8 +16,8 @@ Item
{
id: header
text: catalog.i18nc("@header", "Configurations")
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("small_button_text")
height: contentHeight
renderType: Text.NativeRendering

View File

@ -14,122 +14,117 @@ Button
property var configuration: null
hoverEnabled: true
height: background.height
background: Rectangle
{
height: childrenRect.height
color: parent.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
border.color: (parent.checked || parent.hovered) ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining")
border.width: parent.checked ? UM.Theme.getSize("thick_lining").width : UM.Theme.getSize("default_lining").width
border.color: parent.checked ? UM.Theme.getColor("primary") : UM.Theme.getColor("lining")
border.width: UM.Theme.getSize("default_lining").width
radius: UM.Theme.getSize("default_radius").width
}
Column
contentItem: Column
{
id: contentColumn
width: parent.width
padding: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("narrow_margin").height
Row
{
id: contentColumn
width: parent.width
padding: UM.Theme.getSize("wide_margin").width
spacing: UM.Theme.getSize("narrow_margin").height
id: extruderRow
Row
anchors
{
id: extruderRow
anchors
{
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
height: childrenRect.height
spacing: UM.Theme.getSize("default_margin").width
Repeater
{
id: repeater
height: childrenRect.height
model: configuration.extruderConfigurations
delegate: PrintCoreConfiguration
{
width: Math.round(parent.width / 2)
printCoreConfiguration: modelData
}
}
left: parent.left
leftMargin: UM.Theme.getSize("wide_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
//Buildplate row separator
Rectangle
spacing: UM.Theme.getSize("default_margin").width
Repeater
{
id: separator
visible: buildplateInformation.visible
anchors
id: repeater
model: configuration.extruderConfigurations
delegate: PrintCoreConfiguration
{
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
height: visible ? Math.round(UM.Theme.getSize("default_lining").height / 2) : 0
color: UM.Theme.getColor("lining")
}
Item
{
id: buildplateInformation
anchors
{
left: parent.left
leftMargin: parent.padding
right: parent.right
rightMargin: parent.padding
}
height: childrenRect.height
visible: configuration.buildplateConfiguration != ""
UM.RecolorImage
{
id: buildplateIcon
anchors.left: parent.left
width: UM.Theme.getSize("main_window_header_button_icon").width
height: UM.Theme.getSize("main_window_header_button_icon").height
source: UM.Theme.getIcon("buildplate")
color: UM.Theme.getColor("text")
}
Label
{
id: buildplateLabel
anchors.left: buildplateIcon.right
anchors.verticalCenter: buildplateIcon.verticalCenter
anchors.leftMargin: Math.round(UM.Theme.getSize("default_margin").height / 2)
text: configuration.buildplateConfiguration
renderType: Text.NativeRendering
color: UM.Theme.getColor("text")
width: Math.round(parent.width / 2)
printCoreConfiguration: modelData
}
}
}
Connections
//Buildplate row separator
Rectangle
{
target: Cura.MachineManager
onCurrentConfigurationChanged:
id: separator
visible: buildplateInformation.visible
anchors
{
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
left: parent.left
leftMargin: UM.Theme.getSize("wide_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
height: visible ? Math.round(UM.Theme.getSize("default_lining").height / 2) : 0
color: UM.Theme.getColor("lining")
}
Component.onCompleted:
Item
{
id: buildplateInformation
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("wide_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width
}
height: childrenRect.height
visible: configuration.buildplateConfiguration != ""
UM.RecolorImage
{
id: buildplateIcon
anchors.left: parent.left
width: UM.Theme.getSize("main_window_header_button_icon").width
height: UM.Theme.getSize("main_window_header_button_icon").height
source: UM.Theme.getIcon("buildplate")
color: UM.Theme.getColor("text")
}
Label
{
id: buildplateLabel
anchors.left: buildplateIcon.right
anchors.verticalCenter: buildplateIcon.verticalCenter
anchors.leftMargin: UM.Theme.getSize("narrow_margin").height
text: configuration.buildplateConfiguration
renderType: Text.NativeRendering
color: UM.Theme.getColor("text")
}
}
}
Connections
{
target: Cura.MachineManager
onCurrentConfigurationChanged:
{
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
}
}
Component.onCompleted:
{
configurationItem.checked = Cura.MachineManager.matchesConfiguration(configuration)
}
onClicked:
{
Cura.MachineManager.applyRemoteConfiguration(configuration)
}
}
}

View File

@ -7,16 +7,15 @@ import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
Column
Item
{
id: base
property var outputDevice: null
height: childrenRect.height + 2 * padding
spacing: UM.Theme.getSize("narrow_margin").height
height: childrenRect.height
function forceModelUpdate()
{
// FIXME For now the model should be removed and then created again, otherwise changes in the printer don't automatically update the UI
// FIXME For now the model has to be removed and then created again, otherwise changes in the printer don't automatically update the UI
configurationList.model = []
if (outputDevice)
{
@ -24,6 +23,42 @@ Column
}
}
// This component will appear when there is no configurations (e.g. when losing connection)
Item
{
width: parent.width
visible: configurationList.model.length == 0
height: label.height + UM.Theme.getSize("wide_margin").height
anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("default_margin").height
UM.RecolorImage
{
id: icon
anchors.left: parent.left
anchors.verticalCenter: label.verticalCenter
source: UM.Theme.getIcon("warning")
color: UM.Theme.getColor("warning")
width: UM.Theme.getSize("section_icon").width
height: width
}
Label
{
id: label
anchors.left: icon.right
anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@label", "The configurations are not available because the printer is disconnected.")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
renderType: Text.NativeRendering
wrapMode: Text.WordWrap
}
}
ScrollView
{
id: container
@ -57,7 +92,6 @@ Column
id: configurationList
spacing: UM.Theme.getSize("narrow_margin").height
width: container.width - ((height > container.maximumHeight) ? container.ScrollBar.vertical.background.width : 0) //Make room for scroll bar if there is any.
contentHeight: childrenRect.height
height: childrenRect.height
section.property: "modelData.printerType"
@ -100,4 +134,4 @@ Column
forceModelUpdate()
}
}
}
}

View File

@ -17,10 +17,7 @@ Cura.ExpandablePopup
{
id: base
Cura.ExtrudersModel
{
id: extrudersModel
}
property var extrudersModel: CuraApplication.getExtrudersModel()
UM.I18nCatalog
{
@ -34,6 +31,7 @@ Cura.ExpandablePopup
Custom
}
contentPadding: UM.Theme.getSize("default_lining").width
enabled: Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants || Cura.MachineManager.hasVariantBuildplates; //Only let it drop down if there is any configuration that you could change.
headerItem: Item
@ -127,34 +125,41 @@ Cura.ExpandablePopup
contentItem: Column
{
id: popupItem
width: base.width - 2 * UM.Theme.getSize("default_margin").width
height: implicitHeight //Required because ExpandableComponent will try to use this to determine the size of the background of the pop-up.
width: UM.Theme.getSize("configuration_selector").width
height: implicitHeight // Required because ExpandableComponent will try to use this to determine the size of the background of the pop-up.
padding: UM.Theme.getSize("default_margin").height
spacing: UM.Theme.getSize("default_margin").height
property bool is_connected: false //If current machine is connected to a printer. Only evaluated upon making popup visible.
property bool is_connected: false // If current machine is connected to a printer. Only evaluated upon making popup visible.
property int configuration_method: ConfigurationMenu.ConfigurationMethod.Custom // Type of configuration being used. Only evaluated upon making popup visible.
property int manual_selected_method: -1 // It stores the configuration method selected by the user. By default the selected method is
onVisibleChanged:
{
is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected //Re-evaluate.
}
is_connected = Cura.MachineManager.activeMachineNetworkKey !== "" && Cura.MachineManager.printerConnected // Re-evaluate.
property int configuration_method: is_connected ? ConfigurationMenu.ConfigurationMethod.Auto : ConfigurationMenu.ConfigurationMethod.Custom //Auto if connected to a printer at start-up, or Custom if not.
// If the printer is not connected, we switch always to the custom mode. If is connected instead, the auto mode
// or the previous state is selected
configuration_method = is_connected ? (manual_selected_method == -1 ? ConfigurationMenu.ConfigurationMethod.Auto : manual_selected_method) : ConfigurationMenu.ConfigurationMethod.Custom
}
Item
{
width: parent.width
width: parent.width - 2 * parent.padding
height:
{
var height = 0;
if(autoConfiguration.visible)
var height = 0
if (autoConfiguration.visible)
{
height += autoConfiguration.height;
height += autoConfiguration.height
}
if(customConfiguration.visible)
if (customConfiguration.visible)
{
height += customConfiguration.height;
height += customConfiguration.height
}
return height;
return height
}
AutoConfiguration
{
id: autoConfiguration
@ -172,9 +177,9 @@ Cura.ExpandablePopup
{
id: separator
visible: buttonBar.visible
x: -contentPadding
x: -parent.padding
width: base.width
width: parent.width
height: UM.Theme.getSize("default_lining").height
color: UM.Theme.getColor("lining")
@ -186,7 +191,7 @@ Cura.ExpandablePopup
id: buttonBar
visible: popupItem.is_connected //Switching only makes sense if the "auto" part is possible.
width: parent.width
width: parent.width - 2 * parent.padding
height: childrenRect.height
Cura.SecondaryButton
@ -200,7 +205,11 @@ Cura.ExpandablePopup
iconSource: UM.Theme.getIcon("arrow_right")
isIconOnRightSide: true
onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Custom
onClicked:
{
popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Custom
popupItem.manual_selected_method = popupItem.configuration_method
}
}
Cura.SecondaryButton
@ -211,8 +220,18 @@ Cura.ExpandablePopup
iconSource: UM.Theme.getIcon("arrow_left")
onClicked: popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Auto
onClicked:
{
popupItem.configuration_method = ConfigurationMenu.ConfigurationMethod.Auto
popupItem.manual_selected_method = popupItem.configuration_method
}
}
}
}
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged: popupItem.manual_selected_method = -1 // When switching printers, reset the value of the manual selected method
}
}

View File

@ -23,8 +23,8 @@ Item
{
id: header
text: catalog.i18nc("@header", "Custom")
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("small_button_text")
height: contentHeight
renderType: Text.NativeRendering
@ -51,9 +51,7 @@ Item
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
right: parent.right
rightMargin: UM.Theme.getSize("default_margin").width
top: header.bottom
topMargin: visible ? UM.Theme.getSize("default_margin").height : 0
}
@ -74,7 +72,7 @@ Item
id: printerTypeSelector
text: Cura.MachineManager.activeMachineDefinitionName
tooltip: Cura.MachineManager.activeMachineDefinitionName
height: UM.Theme.getSize("setting_control").height
height: UM.Theme.getSize("print_setup_big_item").height
width: Math.round(parent.width * 0.7) + UM.Theme.getSize("default_margin").width
anchors.right: parent.right
style: UM.Theme.styles.print_setup_header_button
@ -224,7 +222,7 @@ Item
Row
{
height: UM.Theme.getSize("print_setup_item").height
height: UM.Theme.getSize("print_setup_big_item").height
visible: Cura.MachineManager.hasMaterials
Label
@ -248,7 +246,7 @@ Item
text: Cura.MachineManager.activeStack != null ? Cura.MachineManager.activeStack.material.name : ""
tooltip: text
height: UM.Theme.getSize("setting_control").height
height: UM.Theme.getSize("print_setup_big_item").height
width: selectors.controlWidth
style: UM.Theme.styles.print_setup_header_button
@ -262,7 +260,7 @@ Item
Row
{
height: UM.Theme.getSize("print_setup_item").height
height: UM.Theme.getSize("print_setup_big_item").height
visible: Cura.MachineManager.hasVariants
Label
@ -282,7 +280,7 @@ Item
text: Cura.MachineManager.activeVariantName
tooltip: Cura.MachineManager.activeVariantName
height: UM.Theme.getSize("setting_control").height
height: UM.Theme.getSize("print_setup_big_item").height
width: selectors.controlWidth
style: UM.Theme.styles.print_setup_header_button
activeFocusOnPress: true;

View File

@ -27,7 +27,7 @@ Menu
MenuItem { id: extruderHeader; text: catalog.i18ncp("@label", "Print Selected Model With:", "Print Selected Models With:", UM.Selection.selectionCount); enabled: false; visible: base.shouldShowExtruders }
Instantiator
{
model: Cura.ExtrudersModel { id: extrudersModel }
model: CuraApplication.getExtrudersModel()
MenuItem {
text: "%1: %2 - %3".arg(model.name).arg(model.material).arg(model.variant)
visible: base.shouldShowExtruders

View File

@ -1,212 +0,0 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import UM 1.2 as UM
import Cura 1.0 as Cura
import "Menus"
import "Menus/ConfigurationMenu"
Rectangle
{
id: base
property int currentModeIndex
property bool hideSettings: PrintInformation.preSliced
property bool hideView: Cura.MachineManager.activeMachineName == ""
// Is there an output device for this printer?
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
property bool printerConnected: Cura.MachineManager.printerConnected
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
property variant printDuration: PrintInformation.currentPrintTime
property variant printMaterialLengths: PrintInformation.materialLengths
property variant printMaterialWeights: PrintInformation.materialWeights
property variant printMaterialCosts: PrintInformation.materialCosts
property variant printMaterialNames: PrintInformation.materialNames
color: UM.Theme.getColor("main_background")
UM.I18nCatalog { id: catalog; name: "cura"}
Timer {
id: tooltipDelayTimer
interval: 500
repeat: false
property var item
property string text
onTriggered:
{
base.showTooltip(base, {x: 0, y: item.y}, text);
}
}
function showTooltip(item, position, text)
{
tooltip.text = text;
position = item.mapToItem(base, position.x - UM.Theme.getSize("default_arrow").width, position.y);
tooltip.show(position);
}
function hideTooltip()
{
tooltip.hide();
}
function strPadLeft(string, pad, length) {
return (new Array(length + 1).join(pad) + string).slice(-length);
}
function getPrettyTime(time)
{
var hours = Math.floor(time / 3600)
time -= hours * 3600
var minutes = Math.floor(time / 60);
time -= minutes * 60
var seconds = Math.floor(time);
var finalTime = strPadLeft(hours, "0", 2) + ":" + strPadLeft(minutes, "0", 2) + ":" + strPadLeft(seconds, "0", 2);
return finalTime;
}
MouseArea
{
anchors.fill: parent
acceptedButtons: Qt.AllButtons
onWheel:
{
wheel.accepted = true;
}
}
MachineSelector
{
id: machineSelection
width: base.width - configSelection.width - separator.width
height: UM.Theme.getSize("stage_menu").height
anchors.top: base.top
anchors.left: parent.left
}
Rectangle
{
id: separator
visible: configSelection.visible
width: visible ? Math.round(UM.Theme.getSize("thick_lining").height / 2) : 0
height: UM.Theme.getSize("stage_menu").height
color: UM.Theme.getColor("thick_lining")
anchors.left: machineSelection.right
}
CustomConfigurationSelector
{
id: configSelection
visible: isNetworkPrinter && printerConnected
width: visible ? Math.round(base.width * 0.15) : 0
height: UM.Theme.getSize("stage_menu").height
anchors.top: base.top
anchors.right: parent.right
}
Loader
{
id: controlItem
anchors.bottom: footerSeparator.top
anchors.top: machineSelection.bottom
anchors.left: base.left
anchors.right: base.right
sourceComponent:
{
if(connectedPrinter != null)
{
if(connectedPrinter.controlItem != null)
{
return connectedPrinter.controlItem
}
}
return null
}
}
Loader
{
anchors.bottom: footerSeparator.top
anchors.top: machineSelection.bottom
anchors.left: base.left
anchors.right: base.right
source:
{
if(controlItem.sourceComponent == null)
{
return "PrintMonitor.qml"
}
else
{
return ""
}
}
}
Rectangle
{
id: footerSeparator
width: parent.width
height: UM.Theme.getSize("wide_lining").height
color: UM.Theme.getColor("wide_lining")
anchors.bottom: monitorButton.top
anchors.bottomMargin: UM.Theme.getSize("thick_margin").height
}
// MonitorButton is actually the bottom footer panel.
MonitorButton
{
id: monitorButton
implicitWidth: base.width
anchors.bottom: parent.bottom
}
PrintSetupTooltip
{
id: tooltip
}
UM.SettingPropertyProvider
{
id: machineExtruderCount
containerStack: Cura.MachineManager.activeMachine
key: "machine_extruder_count"
watchedProperties: [ "value" ]
storeIndex: 0
}
UM.SettingPropertyProvider
{
id: machineHeatedBed
containerStack: Cura.MachineManager.activeMachine
key: "machine_heated_bed"
watchedProperties: [ "value" ]
storeIndex: 0
}
// Make the ConfigurationSelector react when the global container changes, otherwise if Cura is not connected to the printer,
// switching printers make no reaction
Connections
{
target: Cura.MachineManager
onGlobalContainerChanged:
{
base.isNetworkPrinter = Cura.MachineManager.activeMachineNetworkKey != ""
base.printerConnected = Cura.MachineManager.printerOutputDevices.length != 0
}
}
}

View File

@ -16,7 +16,7 @@ Item
property QtObject qualityManager: CuraApplication.getQualityManager()
property var resetEnabled: false // Keep PreferencesDialog happy
property var extrudersModel: Cura.ExtrudersModel {}
property var extrudersModel: CuraApplication.getExtrudersModel()
UM.I18nCatalog { id: catalog; name: "cura"; }

View File

@ -60,11 +60,7 @@ Rectangle
anchors.fill: parent
Cura.ExtrudersModel
{
id: extrudersModel
simpleNames: true
}
property var extrudersModel: CuraApplication.getExtrudersModel()
OutputDeviceHeader
{

View File

@ -16,10 +16,7 @@ Item
property real padding: UM.Theme.getSize("default_margin").width
property bool multipleExtruders: extrudersModel.count > 1
Cura.ExtrudersModel
{
id: extrudersModel
}
property var extrudersModel: CuraApplication.getExtrudersModel()
// Profile selector row
GlobalProfileSelector

View File

@ -26,10 +26,7 @@ Cura.ExpandableComponent
headerItem: PrintSetupSelectorHeader {}
Cura.ExtrudersModel
{
id: extrudersModel
}
property var extrudersModel: CuraApplication.getExtrudersModel()
contentItem: PrintSetupSelectorContents {}
}

View File

@ -156,9 +156,10 @@ Item
}
//: Model used to populate the extrudelModel
Cura.ExtrudersModel
property var extruders: CuraApplication.getExtrudersModel()
Connections
{
id: extruders
target: extruders
onModelChanged: populateExtruderModel()
}

View File

@ -326,7 +326,7 @@ Item
return UM.Theme.getColor("action_button_text");
}
}
font: UM.Theme.getFont("action_button")
font: UM.Theme.getFont("medium")
text:
{
if(extruderModel == null)

View File

@ -320,7 +320,7 @@ Item
return UM.Theme.getColor("action_button_text");
}
}
font: UM.Theme.getFont("action_button")
font: UM.Theme.getFont("medium")
text:
{
if(printerModel == null)

View File

@ -27,7 +27,7 @@ Item
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
text: label
font: UM.Theme.getFont("setting_category")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("setting_category_text")
}
}

View File

@ -24,49 +24,24 @@ Cura.ExpandablePopup
name: "cura"
}
headerItem: Item
headerItem: Cura.IconWithText
{
implicitHeight: icon.height
UM.RecolorImage
text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
source:
{
id: icon
anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter
source:
if (isNetworkPrinter)
{
if (isNetworkPrinter)
if (machineSelector.outputDevice != null && machineSelector.outputDevice.clusterSize > 1)
{
if (machineSelector.outputDevice != null && machineSelector.outputDevice.clusterSize > 1)
{
return UM.Theme.getIcon("printer_group")
}
return UM.Theme.getIcon("printer_single")
return UM.Theme.getIcon("printer_group")
}
return ""
return UM.Theme.getIcon("printer_single")
}
width: UM.Theme.getSize("machine_selector_icon").width
height: width
color: UM.Theme.getColor("machine_selector_printer_icon")
visible: source != ""
}
Label
{
id: label
anchors.left: icon.visible ? icon.right : parent.left
anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("thin_margin").width
anchors.verticalCenter: icon.verticalCenter
text: isNetworkPrinter ? Cura.MachineManager.activeMachineNetworkGroupName : Cura.MachineManager.activeMachineName
elide: Text.ElideRight
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
return ""
}
font: UM.Theme.getFont("medium")
iconColor: UM.Theme.getColor("machine_selector_printer_icon")
iconSize: source != "" ? UM.Theme.getSize("machine_selector_icon").width: 0
UM.RecolorImage
{

View File

@ -42,7 +42,7 @@ Button
}
text: machineSelectorButton.text
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("action_button")
font: UM.Theme.getFont("medium")
visible: text != ""
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter

View File

@ -73,7 +73,7 @@ Button
text: definition.label
textFormat: Text.PlainText
renderType: Text.NativeRendering
font: UM.Theme.getFont("setting_category")
font: UM.Theme.getFont("default")
color:
{
if (!base.enabled)
@ -106,26 +106,7 @@ Button
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.height: width
color:
{
if (!base.enabled)
{
return UM.Theme.getColor("setting_category_disabled_text")
}
else if ((base.hovered || base.activeFocus) && base.checkable && base.checked)
{
return UM.Theme.getColor("setting_category_active_hover_text")
}
else if (base.pressed || (base.checkable && base.checked))
{
return UM.Theme.getColor("setting_category_active_text")
}
else if (base.hovered || base.activeFocus)
{
return UM.Theme.getColor("setting_category_hover_text")
}
return UM.Theme.getColor("setting_category_text")
}
color: UM.Theme.getColor("setting_control_button")
source: base.checked ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
}
}

View File

@ -63,7 +63,7 @@ SettingItem
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text")
color: UM.Theme.getColor("setting_control_button")
}
contentItem: Label

View File

@ -17,11 +17,16 @@ SettingItem
id: control
anchors.fill: parent
model: Cura.ExtrudersModel
property var extrudersModel: CuraApplication.getExtrudersModel()
model: extrudersModel
Connections
{
target: extrudersModel
onModelChanged:
{
control.color = getItem(control.currentIndex).color
control.color = extrudersModel.getItem(control.currentIndex).color
}
}
@ -105,7 +110,7 @@ SettingItem
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text");
color: UM.Theme.getColor("setting_control_button");
}
background: Rectangle

View File

@ -12,15 +12,24 @@ SettingItem
id: base
property var focusItem: control
// Somehow if we directory set control.model to CuraApplication.getExtrudersModelWithOptional()
// and in the Connections.onModelChanged use control.model as a reference, it will complain about
// non-existing properties such as "onModelChanged" and "getItem". I guess if we access the model
// via "control.model", it gives back a generic/abstract model instance. To avoid this, we add
// this extra property to keep the ExtrudersModel and use this in the rest of the code.
property var extrudersWithOptionalModel: CuraApplication.getExtrudersModelWithOptional()
contents: ComboBox
{
id: control
anchors.fill: parent
model: Cura.ExtrudersModel
model: base.extrudersWithOptionalModel
Connections
{
onModelChanged: control.color = getItem(control.currentIndex).color
addOptionalExtruder: true
target: base.extrudersWithOptionalModel
onModelChanged: control.color = base.extrudersWithOptionalModel.getItem(control.currentIndex).color
}
textRole: "name"
@ -102,7 +111,7 @@ SettingItem
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text");
color: UM.Theme.getColor("setting_control_button");
}
background: Rectangle

View File

@ -144,10 +144,7 @@ Item
}
}
Cura.ExtrudersModel
{
id: extrudersModel
}
property var extrudersModel: CuraApplication.getExtrudersModel()
UM.PointingRectangle
{

View File

@ -78,8 +78,6 @@ Cura.ExpandablePopup
{
id: viewSelectorPopup
width: viewSelector.width - 2 * viewSelector.contentPadding
leftPadding: UM.Theme.getSize("default_lining").width
rightPadding: UM.Theme.getSize("default_lining").width
// For some reason the height/width of the column gets set to 0 if this is not set...
Component.onCompleted:
@ -109,7 +107,7 @@ Cura.ExpandablePopup
id: buttonText
text: viewsSelectorButton.text
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("action_button")
font: UM.Theme.getFont("medium")
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight

View File

@ -1,4 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<svg width="20px" height="17px" viewBox="0 0 20 17" version="1.1" xmlns="http://www.w3.org/2000/svg">
<path d="M9.552 0C8.949 0 8.403 0.308 8.097 0.83L0.23 14.256C-0.076 14.78-0.077 15.415 0.23 15.937 0.573 16.522 1.146 16.769 1.751 16.767L17.354 16.767C17.959 16.769 18.531 16.522 18.875 15.937 19.182 15.415 19.181 14.78 18.875 14.256L11.008 0.83C10.702 0.308 10.156 0 9.552 0L9.552 0ZM9.552 1.397C9.636 1.397 9.762 1.471 9.8 1.536L17.667 14.962C17.704 15.027 17.704 15.16 17.667 15.224 17.665 15.227 17.437 15.37 17.354 15.37L1.751 15.37C1.668 15.37 1.44 15.227 1.438 15.224 1.4 15.16 1.4 15.027 1.438 14.962L9.305 1.536C9.343 1.471 9.469 1.397 9.552 1.397ZM9.552 5.356C8.909 5.356 8.388 5.877 8.388 6.521L8.621 10.479C8.621 10.994 9.038 11.411 9.552 11.411 10.067 11.411 10.484 10.994 10.484 10.479L10.717 6.521C10.717 5.877 10.195 5.356 9.552 5.356ZM9.552 11.877C8.781 11.877 8.155 12.502 8.155 13.274 8.155 14.046 8.781 14.671 9.552 14.671 10.324 14.671 10.95 14.046 10.95 13.274 10.95 12.502 10.324 11.877 9.552 11.877 Z" />
<?xml version="1.0" encoding="UTF-8"?>
<svg width="18px" height="18px" viewBox="0 0 18 18" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- Generator: Sketch 52.2 (67145) - http://www.bohemiancoding.com/sketch -->
<title>Icon/warning-s</title>
<desc>Created with Sketch.</desc>
<g id="Icon/warning-s" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="icn/warning" transform="translate(0.000000, 1.000000)" fill="#000000" fill-rule="nonzero">
<path d="M10.2840021,13.2214915 L10.2840021,11.3934951 C10.2840021,11.3037916 10.252402,11.2286553 10.1892019,11.1680863 C10.1252018,11.1067505 10.0498017,11.0760827 9.96300155,11.0760827 L8.03699845,11.0760827 C7.94979832,11.0760827 7.87439819,11.1067505 7.81079809,11.1680863 C7.74759799,11.2286553 7.71599794,11.3037916 7.71599794,11.3934951 L7.71599794,13.2209164 C7.71599794,13.3106199 7.74759799,13.3859479 7.81079809,13.4469003 C7.87479819,13.5078527 7.95019832,13.5383288 8.03699845,13.5383288 L9.96300155,13.5383288 C10.0502017,13.5383288 10.1256018,13.507661 10.1892019,13.4463252 C10.252402,13.3857562 10.2840021,13.3106199 10.2840021,13.2209164 L10.2840021,13.2214915 Z M10.264202,9.62530099 L10.4448023,5.21142857 C10.4448023,5.13475891 10.4114023,5.07380653 10.3446022,5.02857143 C10.257402,4.95803534 10.1770019,4.9227673 10.1034018,4.9227673 L7.89659823,4.9227673 C7.82299811,4.9227673 7.74259798,4.95803534 7.65539784,5.02857143 C7.58859774,5.07342318 7.55519768,5.14089248 7.55519768,5.23097934 L7.72559796,9.62530099 C7.72559796,9.68932016 7.75919801,9.74222222 7.82639812,9.78400719 C7.89319822,9.82540881 7.97319835,9.84610961 8.0663985,9.84610961 L9.92280148,9.84610961 C10.0168016,9.84610961 10.0954018,9.82540881 10.1586019,9.78400719 C10.222602,9.74183887 10.257802,9.68893681 10.264202,9.62530099 Z M10.1238018,0.644025157 L17.8290142,14.182929 C18.0634145,14.5865948 18.0568145,14.9904522 17.8092141,15.3945013 C17.695614,15.5804253 17.5400137,15.7280144 17.3424134,15.8372686 C17.1452131,15.9457562 16.9330127,16 16.7058124,16 L1.29418764,16 C1.06698727,16 0.854786932,15.9455645 0.657586615,15.8366936 C0.459986298,15.7278227 0.304386049,15.5802336 0.190785866,15.3939263 C-0.056814531,14.9902606 -0.0634145416,14.5865948 0.170985835,14.182929 L7.8761982,0.644025157 C7.98979838,0.445450734 8.14699863,0.288277928 8.34779895,0.172506739 C8.54859928,0.0575022462 8.76599962,-1.42108547e-13 9,-1.42108547e-13 C9.23400038,-1.42108547e-13 9.45140072,0.0575022462 9.65220105,0.172506739 C9.85300137,0.288277928 10.0102016,0.445450734 10.1238018,0.644025157 Z" id="Shape"></path>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

@ -75,7 +75,7 @@ QtObject
width: Theme.getSize("standard_arrow").width
height: Theme.getSize("standard_arrow").height
sourceSize.height: width
color: control.enabled ? Theme.getColor("setting_category_text") : Theme.getColor("setting_category_disabled_text")
color: control.enabled ? Theme.getColor("setting_control_button") : Theme.getColor("setting_category_disabled_text")
source: Theme.getIcon("arrow_bottom")
}
Label
@ -392,7 +392,7 @@ QtObject
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: Theme.getColor("setting_control_text");
color: Theme.getColor("setting_control_button");
}
}
}
@ -459,7 +459,7 @@ QtObject
sourceSize.width: width + 5 * screenScaleFactor
sourceSize.height: width + 5 * screenScaleFactor
color: UM.Theme.getColor("setting_control_text")
color: UM.Theme.getColor("setting_control_button")
}
}
}
@ -662,7 +662,7 @@ QtObject
return UM.Theme.getColor("action_button_text");
}
}
font: UM.Theme.getFont("action_button")
font: UM.Theme.getFont("medium")
text: control.text
}
}

View File

@ -49,21 +49,6 @@
"size": 0.7,
"weight": 50,
"family": "Noto Sans"
},
"button_tooltip": {
"size": 1.0,
"weight": 50,
"family": "Noto Sans"
},
"setting_category": {
"size": 1.15,
"weight": 63,
"family": "Noto Sans"
},
"action_button": {
"size": 1.15,
"weight": 50,
"family": "Noto Sans"
}
},
@ -118,7 +103,7 @@
"printer_type_label_background": [228, 228, 242, 255],
"text": [0, 0, 0, 255],
"text": [25, 25, 25, 255],
"text_detail": [174, 174, 174, 128],
"text_link": [50, 130, 255, 255],
"text_inactive": [174, 174, 174, 255],
@ -371,6 +356,7 @@
"expandable_component_content_header": [0.0, 3.0],
"configuration_selector": [35.0, 4.0],
"configuration_selector_mode_tabs": [0.0, 3.0],
"action_panel_widget": [25.0, 0.0],
@ -422,6 +408,7 @@
"button_lining": [0, 0],
"action_button": [15.0, 3.0],
"action_button_icon": [1.0, 1.0],
"action_button_radius": [0.15, 0.15],
"small_button": [2, 2],