Add CuraView, which does something similar to CuraStage

So instead of relying on strange activeViewProxy, it's up to the CuraView to provide a set of components.
These can subsequently be used by the active stage again.

CURA-5829
This commit is contained in:
Jaime van Kessel 2018-10-29 16:21:16 +01:00
parent d8dd9bf363
commit 0a3803d665
4 changed files with 39 additions and 5 deletions

View file

@ -26,8 +26,8 @@ from UM.View.GL.OpenGL import OpenGL
from UM.View.GL.OpenGLContext import OpenGLContext
from UM.View.GL.ShaderProgram import ShaderProgram
from UM.View.View import View
from UM.i18n import i18nCatalog
from cura.CuraView import CuraView
from cura.Scene.ConvexHullNode import ConvexHullNode
from cura.CuraApplication import CuraApplication
@ -48,15 +48,15 @@ catalog = i18nCatalog("cura")
## View used to display g-code paths.
class SimulationView(View):
class SimulationView(CuraView):
# Must match SimulationView.qml
LAYER_VIEW_TYPE_MATERIAL_TYPE = 0
LAYER_VIEW_TYPE_LINE_TYPE = 1
LAYER_VIEW_TYPE_FEEDRATE = 2
LAYER_VIEW_TYPE_THICKNESS = 3
def __init__(self) -> None:
super().__init__()
def __init__(self, parent = None) -> None:
super().__init__(parent)
self._max_layers = 0
self._current_layer_num = 0
@ -113,6 +113,13 @@ class SimulationView(View):
self._wireprint_warning_message = Message(catalog.i18nc("@info:status", "Cura does not accurately display layers when Wire Printing is enabled"),
title = catalog.i18nc("@info:title", "Simulation View"))
Application.getInstance().engineCreatedSignal.connect(self._onEngineCreated)
def _onEngineCreated(self) -> None:
menu_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("SimulationView"),
"SimulationView.qml")
self.addDisplayComponent("menu", menu_component_path)
def _evaluateCompatibilityMode(self) -> bool:
return OpenGLContext.isLegacyOpenGL() or bool(Application.getInstance().getPreferences().getValue("view/force_layer_view_compatibility_mode"))