Fix uses of getValue after its removal from Uranium API

This commit is contained in:
Arjen Hiemstra 2016-05-18 16:33:10 +02:00
parent a5f8546d69
commit b621958098
2 changed files with 11 additions and 3 deletions

View file

@ -37,6 +37,7 @@ class BuildVolume(SceneNode):
self.setCalculateBoundingBox(False) self.setCalculateBoundingBox(False)
self._active_container_stack = None
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerStackChanged) Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerStackChanged)
self._onGlobalContainerStackChanged() self._onGlobalContainerStackChanged()
@ -158,9 +159,14 @@ class BuildVolume(SceneNode):
Application.getInstance().getController().getScene()._maximum_bounds = scale_to_max_bounds Application.getInstance().getController().getScene()._maximum_bounds = scale_to_max_bounds
def _onGlobalContainerStackChanged(self): def _onGlobalContainerStackChanged(self):
if self._active_container_stack:
self._active_container_stack.propertyChanged.disconnect(self._onSettingPropertyChanged)
self._active_container_stack = Application.getInstance().getGlobalContainerStack() self._active_container_stack = Application.getInstance().getGlobalContainerStack()
if self._active_container_stack: if self._active_container_stack:
self._active_container_stack.propertyChanged.connect(self._onSettingPropertyChanged)
self._width = self._active_container_stack.getProperty("machine_width", "value") self._width = self._active_container_stack.getProperty("machine_width", "value")
if self._active_container_stack.getProperty("print_sequence", "value") == "one_at_a_time": if self._active_container_stack.getProperty("print_sequence", "value") == "one_at_a_time":
self._height = self._active_container_stack.getProperty("gantry_height", "value") self._height = self._active_container_stack.getProperty("gantry_height", "value")
@ -172,12 +178,15 @@ class BuildVolume(SceneNode):
self.rebuild() self.rebuild()
def _onSettingValueChanged(self, setting_key): def _onSettingPropertyChanged(self, setting_key, property_name):
if property_name != "value":
return
if setting_key == "print_sequence": if setting_key == "print_sequence":
if Application.getInstance().getGlobalContainerStack().getProperty("print_sequence", "value") == "one_at_a_time": if Application.getInstance().getGlobalContainerStack().getProperty("print_sequence", "value") == "one_at_a_time":
self._height = self._active_container_stack.getProperty("gantry_height", "value") self._height = self._active_container_stack.getProperty("gantry_height", "value")
else: else:
self._height = self._active_container_stack.getProperty("machine_depth", "value") self._height = self._active_container_stack.getProperty("machine_height", "value")
self.rebuild() self.rebuild()
if setting_key in self._skirt_settings: if setting_key in self._skirt_settings:
self._updateDisallowedAreas() self._updateDisallowedAreas()

View file

@ -35,7 +35,6 @@ class SolidView(View):
self._disabled_shader.setUniformValue("u_overhangAngle", math.cos(math.radians(0))) self._disabled_shader.setUniformValue("u_overhangAngle", math.cos(math.radians(0)))
if Application.getInstance().getGlobalContainerStack(): if Application.getInstance().getGlobalContainerStack():
if Preferences.getInstance().getValue("view/show_overhang"): if Preferences.getInstance().getValue("view/show_overhang"):
angle = Application.getInstance().getGlobalContainerStack().getProperty("support_angle", "value") angle = Application.getInstance().getGlobalContainerStack().getProperty("support_angle", "value")
if angle is not None: if angle is not None: