CURA-4526 Add to SimulationView the same behavior than LayerView

This commit is contained in:
Diego Prado Gesto 2017-11-03 17:46:12 +01:00
parent 74a7f02166
commit 97fd926654
2 changed files with 4 additions and 4 deletions

View file

@ -588,7 +588,7 @@ class CuraEngineBackend(QObject, Backend):
def _onActiveViewChanged(self): def _onActiveViewChanged(self):
if Application.getInstance().getController().getActiveView(): if Application.getInstance().getController().getActiveView():
view = Application.getInstance().getController().getActiveView() view = Application.getInstance().getController().getActiveView()
if view.getPluginId() == "LayerView": # If switching to layer view, we should process the layers if that hasn't been done yet. if view.getPluginId() in ("LayerView", "SimulationView"): # If switching to layer view, we should process the layers if that hasn't been done yet.
self._layer_view_active = True self._layer_view_active = True
# There is data and we're not slicing at the moment # There is data and we're not slicing at the moment
# if we are slicing, there is no need to re-calculate the data as it will be invalid in a moment. # if we are slicing, there is no need to re-calculate the data as it will be invalid in a moment.

View file

@ -61,7 +61,7 @@ class ProcessSlicedLayersJob(Job):
def run(self): def run(self):
start_time = time() start_time = time()
if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView": if Application.getInstance().getController().getActiveView().getPluginId() in ("LayerView", "SimulationView"):
self._progress_message.show() self._progress_message.show()
Job.yieldThread() Job.yieldThread()
if self._abort_requested: if self._abort_requested:
@ -219,7 +219,7 @@ class ProcessSlicedLayersJob(Job):
self._progress_message.setProgress(100) self._progress_message.setProgress(100)
view = Application.getInstance().getController().getActiveView() view = Application.getInstance().getController().getActiveView()
if view.getPluginId() == "LayerView": if view.getPluginId() in ("LayerView", "SimulationView"):
view.resetLayerData() view.resetLayerData()
if self._progress_message: if self._progress_message:
@ -232,7 +232,7 @@ class ProcessSlicedLayersJob(Job):
def _onActiveViewChanged(self): def _onActiveViewChanged(self):
if self.isRunning(): if self.isRunning():
if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView": if Application.getInstance().getController().getActiveView().getPluginId() in ("LayerView", "SimulationView"):
if not self._progress_message: if not self._progress_message:
self._progress_message = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, 0, catalog.i18nc("@info:title", "Information")) self._progress_message = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, 0, catalog.i18nc("@info:title", "Information"))
if self._progress_message.getProgress() != 100: if self._progress_message.getProgress() != 100: