Update patched sidebar for Cura 3.4

This commit is contained in:
fieldOfView 2018-06-04 13:07:37 +02:00
parent 6e3a02a735
commit f37cb4bc8a
4 changed files with 30 additions and 42 deletions

View file

@ -77,7 +77,7 @@ class BlackBeltPlugin(Extension):
self._application._engine.rootObjects()[0].setTitle(i18n_catalog.i18nc("@title:window","BlackBelt Cura"))
# Substitute our own sidebar
sidebar_component_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "sidebar", "Sidebar.qml")
sidebar_component_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "sidebar", "PrepareSidebar.qml")
prepare_stage = Application.getInstance().getController().getStage("PrepareStage")
prepare_stage.addDisplayComponent("sidebar", sidebar_component_path)

View file

@ -18,12 +18,10 @@ Rectangle
// Is there an output device for this printer?
property bool isNetworkPrinter: Cura.MachineManager.activeMachineNetworkKey != ""
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
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 bool monitoringPrint: UM.Controller.activeStage.stageId == "MonitorStage"
property variant printDuration: PrintInformation.currentPrintTime
property variant printMaterialLengths: PrintInformation.materialLengths
property variant printMaterialWeights: PrintInformation.materialWeights
@ -118,7 +116,7 @@ Rectangle
SidebarHeader {
id: header
width: parent.width
visible: !hideSettings && (machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants) && !monitoringPrint
visible: !hideSettings && (machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants)
anchors.top: machineSelection.bottom
onShowTooltip: base.showTooltip(item, location, text)
@ -156,7 +154,7 @@ Rectangle
width: Math.round(parent.width * 0.45)
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
visible: !monitoringPrint && !hideView
visible: !hideView
}
// Settings mode selection toggle
@ -183,7 +181,7 @@ Rectangle
}
}
visible: !monitoringPrint && !hideSettings && !hideView
visible: !hideSettings && !hideView
Component
{
@ -280,7 +278,7 @@ Rectangle
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
anchors.left: base.left
anchors.right: base.right
visible: !monitoringPrint && !hideSettings
visible: !hideSettings
replaceEnter: Transition {
PropertyAnimation {
@ -303,25 +301,13 @@ Rectangle
Loader
{
id: controlItem
anchors.bottom: footerSeparator.top
anchors.top: monitoringPrint ? machineSelection.bottom : headerSeparator.bottom
anchors.top: headerSeparator.bottom
anchors.left: base.left
anchors.right: base.right
sourceComponent:
{
if(monitoringPrint && connectedPrinter != null)
{
if(connectedPrinter.controlItem != null)
{
return connectedPrinter.controlItem
}
}
return null
}
source: "SidebarContents.qml"
}
Rectangle
{
id: footerSeparator
@ -341,7 +327,6 @@ Rectangle
anchors.bottomMargin: UM.Theme.getSize("sidebar_margin").height
height: timeDetails.height + costSpec.height
width: base.width - (saveButton.buttonRowWidth + UM.Theme.getSize("sidebar_margin").width)
visible: !monitoringPrint
clip: true
Label
@ -544,8 +529,7 @@ Rectangle
}
}
// SaveButton and MonitorButton are actually the bottom footer panels.
// "!monitoringPrint" currently means "show-settings-mode"
// SaveButton is actually the bottom footer panel.
Cura.SaveButton
{
id: saveButton
@ -553,17 +537,6 @@ Rectangle
anchors.top: footerSeparator.bottom
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
anchors.bottom: parent.bottom
visible: !monitoringPrint
}
Cura.MonitorButton
{
id: monitorButton
implicitWidth: base.width
anchors.top: footerSeparator.bottom
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
anchors.bottom: parent.bottom
visible: monitoringPrint
}
Cura.SidebarTooltip

View file

@ -14,8 +14,20 @@ Column
property int currentExtruderIndex: Cura.ExtruderManager.activeExtruderIndex;
property bool currentExtruderVisible: extrudersList.visible;
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property bool hasManyPrinterTypes: printerConnected ? Cura.MachineManager.printerOutputDevices[0].connectedPrintersTypeCount.length > 1 : false
property bool printerConnected: Cura.MachineManager.printerConnected
property bool hasManyPrinterTypes:
{
if (printerConnected)
{
if (Cura.MachineManager.printerOutputDevices[0].connectedPrintersTypeCount != null)
{
return Cura.MachineManager.printerOutputDevices[0].connectedPrintersTypeCount.length > 1;
}
}
return false;
}
property bool buildplateCompatibilityError: !Cura.MachineManager.variantBuildplateCompatible && !Cura.MachineManager.variantBuildplateUsable
property bool buildplateCompatibilityWarning: Cura.MachineManager.variantBuildplateUsable
spacing: Math.round(UM.Theme.getSize("sidebar_margin").width * 0.9)

View file

@ -247,17 +247,19 @@ Item
{
function showTooltip (showTooltip)
{
if (showTooltip) {
if (showTooltip)
{
var content = catalog.i18nc("@tooltip", "This quality profile is not available for you current material and nozzle configuration. Please change these to enable this quality profile")
base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("sidebar_margin").width, customisedSettings.height), content)
}
else {
else
{
base.hideTooltip()
}
}
id: unavailableLineToolTip
height: 20 // hovered area height
height: 20 * screenScaleFactor // hovered area height
z: parent.z + 1 // should be higher, otherwise the area can be hovered
x: 0
anchors.verticalCenter: qualitySlider.verticalCenter
@ -267,7 +269,8 @@ Item
id: leftArea
width:
{
if (qualityModel.availableTotalTicks == 0) {
if (qualityModel.availableTotalTicks == 0)
{
return qualityModel.qualitySliderStepWidth * qualityModel.totalTicks
}
return qualityModel.qualitySliderStepWidth * qualityModel.qualitySliderAvailableMin - 10