Updated type hinting

This commit is contained in:
Jaime van Kessel 2017-04-12 16:26:25 +02:00
parent 0bcde6a41c
commit 5de3b4614f

View file

@ -25,6 +25,8 @@ catalog = i18nCatalog("cura")
import numpy import numpy
import math import math
from typing import List
# Setting for clearance around the prime # Setting for clearance around the prime
PRIME_CLEARANCE = 6.5 PRIME_CLEARANCE = 6.5
@ -129,7 +131,7 @@ class BuildVolume(SceneNode):
## Updates the listeners that listen for changes in per-mesh stacks. ## Updates the listeners that listen for changes in per-mesh stacks.
# #
# \param node The node for which the decorators changed. # \param node The node for which the decorators changed.
def _updateNodeListeners(self, node): def _updateNodeListeners(self, node: SceneNode):
per_mesh_stack = node.callDecoration("getStack") per_mesh_stack = node.callDecoration("getStack")
if per_mesh_stack: if per_mesh_stack:
per_mesh_stack.propertyChanged.connect(self._onSettingPropertyChanged) per_mesh_stack.propertyChanged.connect(self._onSettingPropertyChanged)
@ -150,13 +152,14 @@ class BuildVolume(SceneNode):
if depth is not None: if depth is not None:
self._depth = depth self._depth = depth
def setShape(self, shape): def setShape(self, shape: str):
if shape: self._shape = shape if shape:
self._shape = shape
def getDisallowedAreas(self): def getDisallowedAreas(self) -> List[Polygon]:
return self._disallowed_areas return self._disallowed_areas
def setDisallowedAreas(self, areas): def setDisallowedAreas(self, areas: List[Polygon]):
self._disallowed_areas = areas self._disallowed_areas = areas
def render(self, renderer): def render(self, renderer):
@ -199,7 +202,6 @@ class BuildVolume(SceneNode):
return return
for node in nodes: for node in nodes:
# Need to check group nodes later # Need to check group nodes later
if node.callDecoration("isGroup"): if node.callDecoration("isGroup"):
group_nodes.append(node) # Keep list of affected group_nodes group_nodes.append(node) # Keep list of affected group_nodes
@ -415,10 +417,10 @@ class BuildVolume(SceneNode):
self.updateNodeBoundaryCheck() self.updateNodeBoundaryCheck()
def getBoundingBox(self): def getBoundingBox(self) -> AxisAlignedBox:
return self._volume_aabb return self._volume_aabb
def getRaftThickness(self): def getRaftThickness(self) -> float:
return self._raft_thickness return self._raft_thickness
def _updateRaftThickness(self): def _updateRaftThickness(self):
@ -495,7 +497,7 @@ class BuildVolume(SceneNode):
self._engine_ready = True self._engine_ready = True
self.rebuild() self.rebuild()
def _onSettingPropertyChanged(self, setting_key, property_name): def _onSettingPropertyChanged(self, setting_key: str, property_name: str):
if property_name != "value": if property_name != "value":
return return
@ -528,7 +530,7 @@ class BuildVolume(SceneNode):
if rebuild_me: if rebuild_me:
self.rebuild() self.rebuild()
def hasErrors(self): def hasErrors(self) -> bool:
return self._has_errors return self._has_errors
## Calls _updateDisallowedAreas and makes sure the changes appear in the ## Calls _updateDisallowedAreas and makes sure the changes appear in the