Make settings visible too after adding them

Contributes to issue CURA-7211.
This commit is contained in:
Ghostkeeper 2020-02-13 13:08:32 +01:00
parent 53e1742d27
commit 3b235d5536
No known key found for this signature in database
GPG key ID: 37E2020986774393
2 changed files with 11 additions and 5 deletions

View file

@ -1,5 +1,6 @@
# Copyright (c) 2016 Ultimaker B.V.
# Uranium is released under the terms of the LGPLv3 or higher.
# Copyright (c) 2020 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
from UM.Logger import Logger
from UM.Tool import Tool
from UM.Scene.Selection import Selection
@ -22,14 +23,13 @@ class PerObjectSettingsTool(Tool):
self._multi_extrusion = False
self._single_model_selected = False
self.visibility_handler = None
Selection.selectionChanged.connect(self.propertyChanged)
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerChanged)
self._onGlobalContainerChanged()
Selection.selectionChanged.connect(self._updateEnabled)
def event(self, event):
super().event(event)
if event.type == Event.MousePressEvent and self._controller.getToolsEnabled():
@ -103,6 +103,9 @@ class PerObjectSettingsTool(Tool):
new_instance.setProperty("value", 0)
new_instance.resetState() # Ensure that the state is not seen as a user state.
settings.addInstance(new_instance)
visible = self.visibility_handler.getVisible()
visible.add(property_key)
self.visibility_handler.setVisible(visible)
elif old_mesh_type == "infill_mesh" and settings.getInstance(property_key) and settings.getProperty(property_key, "value") == 0:
settings.removeInstance(property_key)