mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Convert the last bits over to the changed API
This commit is contained in:
parent
f60dc01e66
commit
09cfda095b
6 changed files with 28 additions and 26 deletions
|
@ -55,12 +55,12 @@ class BuildVolume(SceneNode):
|
||||||
|
|
||||||
if not self._material:
|
if not self._material:
|
||||||
self._material = renderer.createMaterial(
|
self._material = renderer.createMaterial(
|
||||||
Resources.getPath(Resources.ShadersLocation, "basic.vert"),
|
Resources.getPath(Resources.Shaders, "basic.vert"),
|
||||||
Resources.getPath(Resources.ShadersLocation, "vertexcolor.frag")
|
Resources.getPath(Resources.Shaders, "vertexcolor.frag")
|
||||||
)
|
)
|
||||||
self._grid_material = renderer.createMaterial(
|
self._grid_material = renderer.createMaterial(
|
||||||
Resources.getPath(Resources.ShadersLocation, "basic.vert"),
|
Resources.getPath(Resources.Shaders, "basic.vert"),
|
||||||
Resources.getPath(Resources.ShadersLocation, "grid.frag")
|
Resources.getPath(Resources.Shaders, "grid.frag")
|
||||||
)
|
)
|
||||||
self._grid_material.setUniformValue("u_gridColor0", Color(245, 245, 245, 255))
|
self._grid_material.setUniformValue("u_gridColor0", Color(245, 245, 245, 255))
|
||||||
self._grid_material.setUniformValue("u_gridColor1", Color(205, 202, 201, 255))
|
self._grid_material.setUniformValue("u_gridColor1", Color(205, 202, 201, 255))
|
||||||
|
@ -135,7 +135,7 @@ class BuildVolume(SceneNode):
|
||||||
|
|
||||||
self._aabb = AxisAlignedBox(minimum = Vector(minW, minH - 1.0, minD), maximum = Vector(maxW, maxH, maxD))
|
self._aabb = AxisAlignedBox(minimum = Vector(minW, minH - 1.0, minD), maximum = Vector(maxW, maxH, maxD))
|
||||||
|
|
||||||
settings = Application.getInstance().getActiveMachine()
|
settings = Application.getInstance().getMachineManager().getActiveMachineInstance()
|
||||||
|
|
||||||
skirt_size = 0.0
|
skirt_size = 0.0
|
||||||
if settings.getSettingValueByKey("adhesion_type") == "None":
|
if settings.getSettingValueByKey("adhesion_type") == "None":
|
||||||
|
|
|
@ -14,7 +14,7 @@ class ConvexHullDecorator(SceneNodeDecorator):
|
||||||
|
|
||||||
self._convex_hull_node = None
|
self._convex_hull_node = None
|
||||||
self._convex_hull_job = None
|
self._convex_hull_job = None
|
||||||
settings = Application.getInstance().getActiveMachine()
|
settings = Application.getInstance().getMachineManager().getActiveMachineInstance()
|
||||||
print_sequence_setting = settings.getSettingByKey("print_sequence")
|
print_sequence_setting = settings.getSettingByKey("print_sequence")
|
||||||
if print_sequence_setting:
|
if print_sequence_setting:
|
||||||
print_sequence_setting.valueChanged.connect(self._onPrintSequenceSettingChanged)
|
print_sequence_setting.valueChanged.connect(self._onPrintSequenceSettingChanged)
|
||||||
|
|
|
@ -162,17 +162,20 @@ class CuraApplication(QtApplication):
|
||||||
self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml"))
|
self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml"))
|
||||||
self.initializeEngine()
|
self.initializeEngine()
|
||||||
|
|
||||||
#if self.getMachines():
|
manager = self.getMachineManager()
|
||||||
#active_machine_pref = Preferences.getInstance().getValue("cura/active_machine")
|
if manager.getMachineInstances():
|
||||||
#if active_machine_pref:
|
active_machine_pref = Preferences.getInstance().getValue("cura/active_machine")
|
||||||
#for machine in self.getMachines():
|
if active_machine_pref:
|
||||||
#if machine.getName() == active_machine_pref:
|
index = manager.findMachineInstance(active_machine_pref)
|
||||||
#self.setActiveMachine(machine)
|
if index != -1:
|
||||||
|
manager.setActiveMachineInstance(manager.getMachineInstance(index))
|
||||||
|
|
||||||
#if not self.getActiveMachine():
|
if not manager.getActiveMachineInstance():
|
||||||
#self.setActiveMachine(self.getMachines()[0])
|
manager.setActiveMachineInstance(manager.getMachineInstance(index))
|
||||||
#else:
|
else:
|
||||||
#self.requestAddPrinter.emit()
|
self.requestAddPrinter.emit()
|
||||||
|
|
||||||
|
manager.setActiveProfile(manager.getProfiles()[0])
|
||||||
|
|
||||||
if self._engine.rootObjects:
|
if self._engine.rootObjects:
|
||||||
self.closeSplash()
|
self.closeSplash()
|
||||||
|
@ -462,7 +465,7 @@ class CuraApplication(QtApplication):
|
||||||
Selection.remove(node)
|
Selection.remove(node)
|
||||||
|
|
||||||
def _onActiveMachineChanged(self):
|
def _onActiveMachineChanged(self):
|
||||||
machine = self.getActiveMachine()
|
machine = self.getMachineManager().getActiveMachineInstance()
|
||||||
if machine:
|
if machine:
|
||||||
Preferences.getInstance().setValue("cura/active_machine", machine.getName())
|
Preferences.getInstance().setValue("cura/active_machine", machine.getName())
|
||||||
|
|
||||||
|
|
|
@ -52,10 +52,10 @@ class LayerView(View):
|
||||||
renderer.setRenderSelection(False)
|
renderer.setRenderSelection(False)
|
||||||
|
|
||||||
if not self._material:
|
if not self._material:
|
||||||
self._material = renderer.createMaterial(Resources.getPath(Resources.ShadersLocation, "basic.vert"), Resources.getPath(Resources.ShadersLocation, "vertexcolor.frag"))
|
self._material = renderer.createMaterial(Resources.getPath(Resources.Shaders, "basic.vert"), Resources.getPath(Resources.Shaders, "vertexcolor.frag"))
|
||||||
self._material.setUniformValue("u_color", [1.0, 0.0, 0.0, 1.0])
|
self._material.setUniformValue("u_color", [1.0, 0.0, 0.0, 1.0])
|
||||||
|
|
||||||
self._selection_material = renderer.createMaterial(Resources.getPath(Resources.ShadersLocation, "basic.vert"), Resources.getPath(Resources.ShadersLocation, "color.frag"))
|
self._selection_material = renderer.createMaterial(Resources.getPath(Resources.Shaders, "basic.vert"), Resources.getPath(Resources.Shaders, "color.frag"))
|
||||||
self._selection_material.setUniformValue("u_color", Color(35, 35, 35, 128))
|
self._selection_material.setUniformValue("u_color", Color(35, 35, 35, 128))
|
||||||
|
|
||||||
for node in DepthFirstIterator(scene.getRoot()):
|
for node in DepthFirstIterator(scene.getRoot()):
|
||||||
|
|
|
@ -119,13 +119,13 @@ UM.MainWindow {
|
||||||
title: qsTr("&Machine");
|
title: qsTr("&Machine");
|
||||||
|
|
||||||
Instantiator {
|
Instantiator {
|
||||||
model: UM.Models.machinesModel
|
model: UM.MachineInstancesModel { }
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: model.name;
|
text: model.name;
|
||||||
checkable: true;
|
checkable: true;
|
||||||
checked: model.active;
|
checked: model.active;
|
||||||
exclusiveGroup: machineMenuGroup;
|
exclusiveGroup: machineMenuGroup;
|
||||||
onTriggered: UM.Models.machinesModel.setActive(index)
|
onTriggered: UM.MachineManager.setActiveMachineInstance(model.name)
|
||||||
}
|
}
|
||||||
onObjectAdded: machineMenu.insertItem(index, object)
|
onObjectAdded: machineMenu.insertItem(index, object)
|
||||||
onObjectRemoved: machineMenu.removeItem(object)
|
onObjectRemoved: machineMenu.removeItem(object)
|
||||||
|
|
|
@ -6,7 +6,7 @@ import QtQuick.Controls 1.1
|
||||||
import QtQuick.Controls.Styles 1.1
|
import QtQuick.Controls.Styles 1.1
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
|
|
||||||
import UM 1.0 as UM
|
import UM 1.1 as UM
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: base;
|
id: base;
|
||||||
|
@ -78,8 +78,7 @@ Column {
|
||||||
|
|
||||||
ToolButton {
|
ToolButton {
|
||||||
id: machineButton;
|
id: machineButton;
|
||||||
text: UM.Application.machineName;
|
text: UM.MachineManager.activeMachineInstance;
|
||||||
tooltip: UM.Application.machineName;
|
|
||||||
|
|
||||||
style: UM.Theme.styles.sidebar_header_button;
|
style: UM.Theme.styles.sidebar_header_button;
|
||||||
|
|
||||||
|
@ -88,13 +87,13 @@ Column {
|
||||||
menu: Menu {
|
menu: Menu {
|
||||||
id: machineMenu;
|
id: machineMenu;
|
||||||
Instantiator {
|
Instantiator {
|
||||||
model: UM.Models.machinesModel
|
model: UM.MachineInstancesModel { }
|
||||||
MenuItem {
|
MenuItem {
|
||||||
text: model.name;
|
text: model.name;
|
||||||
checkable: true;
|
checkable: true;
|
||||||
checked: model.active;
|
checked: model.active;
|
||||||
exclusiveGroup: machineMenuGroup;
|
exclusiveGroup: machineMenuGroup;
|
||||||
onTriggered: UM.Models.machinesModel.setActive(index)
|
onTriggered: UM.MachineManager.setActiveMachineInstance(model.name);
|
||||||
}
|
}
|
||||||
onObjectAdded: machineMenu.insertItem(index, object)
|
onObjectAdded: machineMenu.insertItem(index, object)
|
||||||
onObjectRemoved: machineMenu.removeItem(object)
|
onObjectRemoved: machineMenu.removeItem(object)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue