Small fixes to sidebar layout after refactoring

This commit is contained in:
ChrisTerBeke 2017-12-06 18:09:02 +01:00
parent ee643610e5
commit 9702ffb794
4 changed files with 19 additions and 11 deletions

View File

@ -24,7 +24,7 @@ Item
{ {
id: globalProfileRow id: globalProfileRow
height: UM.Theme.getSize("sidebar_setup").height height: UM.Theme.getSize("sidebar_setup").height
// visible: !sidebar.monitoringPrint && !sidebar.hideSettings visible: !sidebar.monitoringPrint && !sidebar.hideSettings
anchors anchors
{ {

View File

@ -10,7 +10,6 @@ import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
import "Menus" import "Menus"
Rectangle Rectangle
{ {
id: base; id: base;
@ -92,6 +91,7 @@ Rectangle
id: header id: header
width: parent.width width: parent.width
visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants
onShowTooltip: base.showTooltip(item, location, text) onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip() onHideTooltip: base.hideTooltip()
} }
@ -106,6 +106,15 @@ Rectangle
anchors.topMargin: visible ? UM.Theme.getSize("sidebar_margin").height : 0 anchors.topMargin: visible ? UM.Theme.getSize("sidebar_margin").height : 0
} }
onCurrentModeIndexChanged:
{
UM.Preferences.setValue("cura/active_mode", currentModeIndex);
if(modesListModel.count > base.currentModeIndex)
{
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "replace": true });
}
}
Label { Label {
id: settingsModeLabel id: settingsModeLabel
text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox","Print Setup disabled\nG-code files cannot be modified"); text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox","Print Setup disabled\nG-code files cannot be modified");
@ -540,6 +549,7 @@ Rectangle
visible: monitoringPrint visible: monitoringPrint
} }
SidebarTooltip SidebarTooltip
{ {
id: tooltip; id: tooltip;
@ -593,6 +603,7 @@ Rectangle
UM.SettingPropertyProvider UM.SettingPropertyProvider
{ {
id: machineExtruderCount id: machineExtruderCount
containerStackId: Cura.MachineManager.activeMachineId containerStackId: Cura.MachineManager.activeMachineId
key: "machine_extruder_count" key: "machine_extruder_count"
watchedProperties: [ "value" ] watchedProperties: [ "value" ]
@ -602,6 +613,7 @@ Rectangle
UM.SettingPropertyProvider UM.SettingPropertyProvider
{ {
id: machineHeatedBed id: machineHeatedBed
containerStackId: Cura.MachineManager.activeMachineId containerStackId: Cura.MachineManager.activeMachineId
key: "machine_heated_bed" key: "machine_heated_bed"
watchedProperties: [ "value" ] watchedProperties: [ "value" ]

View File

@ -40,7 +40,7 @@ Column
id: extruderSelectionRow id: extruderSelectionRow
width: parent.width width: parent.width
height: Math.floor(UM.Theme.getSize("sidebar_tabs").height * 2 / 3) height: Math.floor(UM.Theme.getSize("sidebar_tabs").height * 2 / 3)
visible: machineExtruderCount.properties.value > 1 visible: machineExtruderCount.properties.value > 1 && !sidebar.monitoringPrint
anchors anchors
{ {
@ -229,7 +229,7 @@ Column
{ {
id: materialRow id: materialRow
height: UM.Theme.getSize("sidebar_setup").height height: UM.Theme.getSize("sidebar_setup").height
visible: Cura.MachineManager.hasMaterials visible: Cura.MachineManager.hasMaterials && !sidebar.monitoringPrint && !sidebar.hideSettings
anchors anchors
{ {
@ -279,7 +279,7 @@ Column
{ {
id: variantRow id: variantRow
height: UM.Theme.getSize("sidebar_setup").height height: UM.Theme.getSize("sidebar_setup").height
visible: Cura.MachineManager.hasVariants visible: Cura.MachineManager.hasVariants && !sidebar.monitoringPrint && !sidebar.hideSettings
anchors anchors
{ {
@ -319,7 +319,7 @@ Column
{ {
id: materialInfoRow id: materialInfoRow
height: Math.floor(UM.Theme.getSize("sidebar_setup").height / 2) height: Math.floor(UM.Theme.getSize("sidebar_setup").height / 2)
visible: Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials visible: (Cura.MachineManager.hasVariants || Cura.MachineManager.hasMaterials) && !sidebar.monitoringPrint && !sidebar.hideSettings
anchors anchors
{ {

View File

@ -572,11 +572,7 @@ Item
var steps = parseInt(infillSteps.properties.value) var steps = parseInt(infillSteps.properties.value)
var infillModelItem = infillModel.get(i) var infillModelItem = infillModel.get(i)
// TODO: somehow this print causes this method not to crash QML when the sidebar view gets unloaded (when switching states) if (infillModelItem != "undefined"
// TODO: That should be fixed :P
print("test", density, steps, infillModelItem)
if (infillModelItem
&& density >= infillModelItem.percentageMin && density >= infillModelItem.percentageMin
&& density <= infillModelItem.percentageMax && density <= infillModelItem.percentageMax
&& steps >= infillModelItem.stepsMin && steps >= infillModelItem.stepsMin