mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Somewhat better layout, added legend
This commit is contained in:
parent
f0e0d65635
commit
55dd08eff8
3 changed files with 67 additions and 5 deletions
|
@ -16,6 +16,7 @@ from UM.Logger import Logger
|
|||
|
||||
from UM.Math.Vector import Vector
|
||||
|
||||
from cura.Settings.ExtruderManager import ExtruderManager
|
||||
from cura import LayerDataBuilder
|
||||
from cura import LayerDataDecorator
|
||||
from cura import LayerPolygon
|
||||
|
@ -159,11 +160,7 @@ class ProcessSlicedLayersJob(Job):
|
|||
# We are done processing all the layers we got from the engine, now create a mesh out of the data
|
||||
|
||||
# Find out colors per extruder
|
||||
# TODO: move to a better place. Code is similar to code in ExtrudersModel
|
||||
from cura.Settings.ExtruderManager import ExtruderManager
|
||||
import UM
|
||||
|
||||
global_container_stack = UM.Application.getInstance().getGlobalContainerStack()
|
||||
global_container_stack = Application.getInstance().getGlobalContainerStack()
|
||||
manager = ExtruderManager.getInstance()
|
||||
extruders = list(manager.getMachineExtruders(global_container_stack.getId()))
|
||||
if extruders:
|
||||
|
@ -182,6 +179,7 @@ class ProcessSlicedLayersJob(Job):
|
|||
color = colorCodeToRGBA(color_code)
|
||||
material_color_map[0, :] = color
|
||||
|
||||
# We have to scale the colors for compatibility mode
|
||||
if bool(Preferences.getInstance().getValue("view/compatibility_mode")):
|
||||
line_type_brightness = 0.5
|
||||
else:
|
||||
|
|
|
@ -181,8 +181,10 @@ Item
|
|||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: view_settings
|
||||
anchors.top: layer_type_combobox.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
x: UM.Theme.getSize("default_margin").width
|
||||
|
||||
CheckBox {
|
||||
checked: true
|
||||
|
@ -243,5 +245,60 @@ Item
|
|||
}
|
||||
}
|
||||
|
||||
// legend
|
||||
ListView {
|
||||
|
||||
visible: (UM.LayerView.getLayerViewType() == 1) // line type
|
||||
anchors.top: view_settings.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
//width: parent.width
|
||||
//height: childrenRect.height
|
||||
|
||||
delegate: Row
|
||||
{
|
||||
Rectangle
|
||||
{
|
||||
id: rect
|
||||
|
||||
x: UM.Theme.getSize("default_margin").width
|
||||
y: index * UM.Theme.getSize("section_icon").height
|
||||
|
||||
//width: UM.Theme.getSize("section_icon").width
|
||||
//height: 0.5 * UM.Theme.getSize("section_icon").height
|
||||
width: UM.Theme.getSize("setting_control").height / 2
|
||||
height: UM.Theme.getSize("setting_control").height / 2
|
||||
//Behavior on height { NumberAnimation { duration: 50; } }
|
||||
|
||||
border.width: UM.Theme.getSize("default_lining").width;
|
||||
border.color: UM.Theme.getColor("slider_groove_border");
|
||||
|
||||
color: model.color;
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
anchors.left: rect.right
|
||||
anchors.verticalCenter: rect.verticalCenter
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
text: model.label
|
||||
}
|
||||
}
|
||||
model: ListModel
|
||||
{
|
||||
id: legendModel
|
||||
}
|
||||
Component.onCompleted:
|
||||
{
|
||||
// see LayerPolygon
|
||||
legendModel.append({ label:catalog.i18nc("@label", "Inset0"), color: "#ff0000" });
|
||||
legendModel.append({ label:catalog.i18nc("@label", "InsetX"), color: "#00ff00" });
|
||||
legendModel.append({ label:catalog.i18nc("@label", "Skin"), color: "#ffff00" });
|
||||
legendModel.append({ label:catalog.i18nc("@label", "Support, Skirt, SupportInfill"), color: "#00ffff" });
|
||||
legendModel.append({ label:catalog.i18nc("@label", "Infill"), color: "#ffbf00" });
|
||||
legendModel.append({ label:catalog.i18nc("@label", "MoveCombing"), color: "#0000ff" });
|
||||
legendModel.append({ label:catalog.i18nc("@label", "MoveRetraction"), color: "#8080ff" });
|
||||
legendModel.append({ label:catalog.i18nc("@label", "SupportInterface"), color: "#3fbfff" });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,6 +76,13 @@ class LayerViewProxy(QObject):
|
|||
if type(active_view) == LayerView.LayerView.LayerView:
|
||||
active_view.setLayerViewType(layer_view_type)
|
||||
|
||||
@pyqtProperty(bool)
|
||||
def getLayerViewType(self):
|
||||
active_view = self._controller.getActiveView()
|
||||
if type(active_view) == LayerView.LayerView.LayerView:
|
||||
return active_view.getLayerViewType()
|
||||
return 0
|
||||
|
||||
@pyqtSlot(bool)
|
||||
def setOnlyColorActiveExtruder(self, only_color_active_extruder):
|
||||
active_view = self._controller.getActiveView()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue