Reduce the creations of ExtrudersModels

CURA-6015
This commit is contained in:
Lipu Fei 2018-12-12 11:08:33 +01:00
parent 2cf80b4578
commit 620790ae3d
15 changed files with 44 additions and 34 deletions

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,7 +83,7 @@ Item {
Column {
Repeater {
model: Cura.ExtrudersModel { }
model: CuraApplication.getExtrudersModel()
Label {
text: model.name;