mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 05:07:50 -06:00
Add typing
This commit is contained in:
parent
3f8a65d926
commit
8179e1ee90
1 changed files with 11 additions and 10 deletions
|
@ -1,15 +1,16 @@
|
||||||
# Copyright (c) 2018 Ultimaker B.V.
|
# Copyright (c) 2019 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
from ..Script import Script
|
from ..Script import Script
|
||||||
|
|
||||||
from UM.Application import Application #To get the current printer's settings.
|
from UM.Application import Application #To get the current printer's settings.
|
||||||
|
from typing import List, Tuple
|
||||||
|
|
||||||
class PauseAtHeight(Script):
|
class PauseAtHeight(Script):
|
||||||
def __init__(self):
|
def __init__(self) -> None:
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def getSettingDataString(self):
|
def getSettingDataString(self) -> str:
|
||||||
return """{
|
return """{
|
||||||
"name": "Pause at height",
|
"name": "Pause at height",
|
||||||
"key": "PauseAtHeight",
|
"key": "PauseAtHeight",
|
||||||
|
@ -113,11 +114,9 @@ class PauseAtHeight(Script):
|
||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
|
|
||||||
def getNextXY(self, layer: str):
|
## Get the X and Y values for a layer (will be used to get X and Y of the
|
||||||
"""
|
# layer after the pause).
|
||||||
Get the X and Y values for a layer (will be used to get X and Y of
|
def getNextXY(self, layer: str) -> Tuple[float, float]:
|
||||||
the layer after the pause
|
|
||||||
"""
|
|
||||||
lines = layer.split("\n")
|
lines = layer.split("\n")
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if self.getValue(line, "X") is not None and self.getValue(line, "Y") is not None:
|
if self.getValue(line, "X") is not None and self.getValue(line, "Y") is not None:
|
||||||
|
@ -126,8 +125,10 @@ class PauseAtHeight(Script):
|
||||||
return x, y
|
return x, y
|
||||||
return 0, 0
|
return 0, 0
|
||||||
|
|
||||||
def execute(self, data: list):
|
## Inserts the pause commands.
|
||||||
"""data is a list. Each index contains a layer"""
|
# \param data: List of layers.
|
||||||
|
# \return New list of layers.
|
||||||
|
def execute(self, data: List[str]) -> List[str]:
|
||||||
pause_at = self.getSettingValueByKey("pause_at")
|
pause_at = self.getSettingValueByKey("pause_at")
|
||||||
pause_height = self.getSettingValueByKey("pause_height")
|
pause_height = self.getSettingValueByKey("pause_height")
|
||||||
pause_layer = self.getSettingValueByKey("pause_layer")
|
pause_layer = self.getSettingValueByKey("pause_layer")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue