mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Fix mypy type errors
CURA-6057
This commit is contained in:
parent
9091eaa6f8
commit
84aa7fd007
2 changed files with 12 additions and 10 deletions
|
@ -51,12 +51,14 @@ class ObjectsModel(ListModel):
|
||||||
group_nr = 1
|
group_nr = 1
|
||||||
name_count_dict = defaultdict(int) # type: Dict[str, int]
|
name_count_dict = defaultdict(int) # type: Dict[str, int]
|
||||||
|
|
||||||
for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()):
|
for node in DepthFirstIterator(Application.getInstance().getController().getScene().getRoot()): # type: ignore
|
||||||
if not isinstance(node, SceneNode):
|
if not isinstance(node, SceneNode):
|
||||||
continue
|
continue
|
||||||
if (not node.getMeshData() and not node.callDecoration("getLayerData")) and not node.callDecoration("isGroup"):
|
if (not node.getMeshData() and not node.callDecoration("getLayerData")) and not node.callDecoration("isGroup"):
|
||||||
continue
|
continue
|
||||||
if node.getParent() and node.getParent().callDecoration("isGroup"):
|
|
||||||
|
parent = node.getParent()
|
||||||
|
if parent and parent.callDecoration("isGroup"):
|
||||||
continue # Grouped nodes don't need resetting as their parent (the group) is resetted)
|
continue # Grouped nodes don't need resetting as their parent (the group) is resetted)
|
||||||
if not node.callDecoration("isSliceable") and not node.callDecoration("isGroup"):
|
if not node.callDecoration("isSliceable") and not node.callDecoration("isGroup"):
|
||||||
continue
|
continue
|
||||||
|
@ -72,7 +74,7 @@ class ObjectsModel(ListModel):
|
||||||
group_nr += 1
|
group_nr += 1
|
||||||
|
|
||||||
if hasattr(node, "isOutsideBuildArea"):
|
if hasattr(node, "isOutsideBuildArea"):
|
||||||
is_outside_build_area = node.isOutsideBuildArea()
|
is_outside_build_area = node.isOutsideBuildArea() # type: ignore
|
||||||
else:
|
else:
|
||||||
is_outside_build_area = False
|
is_outside_build_area = False
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
from typing import Optional
|
from typing import Optional, Dict, List, cast
|
||||||
|
|
||||||
from PyQt5.QtCore import QObject, pyqtSlot
|
from PyQt5.QtCore import QObject, pyqtSlot
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ class TextManager(QObject):
|
||||||
def _loadChangeLogText(self) -> str:
|
def _loadChangeLogText(self) -> str:
|
||||||
# Load change log texts and organize them with a dict
|
# Load change log texts and organize them with a dict
|
||||||
file_path = Resources.getPath(Resources.Texts, "change_log.txt")
|
file_path = Resources.getPath(Resources.Texts, "change_log.txt")
|
||||||
change_logs_dict = {}
|
change_logs_dict = {} # type: Dict[Version, Dict[str, List[str]]]
|
||||||
with open(file_path, "r", encoding = "utf-8") as f:
|
with open(file_path, "r", encoding = "utf-8") as f:
|
||||||
open_version = None
|
open_version = None # type: Optional[Version]
|
||||||
open_header = "" # Initialise to an empty header in case there is no "*" in the first line of the changelog
|
open_header = "" # Initialise to an empty header in case there is no "*" in the first line of the changelog
|
||||||
for line in f:
|
for line in f:
|
||||||
line = line.replace("\n", "")
|
line = line.replace("\n", "")
|
||||||
|
@ -43,11 +43,11 @@ class TextManager(QObject):
|
||||||
change_logs_dict[open_version] = collections.OrderedDict()
|
change_logs_dict[open_version] = collections.OrderedDict()
|
||||||
elif line.startswith("*"):
|
elif line.startswith("*"):
|
||||||
open_header = line.replace("*", "")
|
open_header = line.replace("*", "")
|
||||||
change_logs_dict[open_version][open_header] = []
|
change_logs_dict[cast(Version, open_version)][open_header] = []
|
||||||
elif line != "":
|
elif line != "":
|
||||||
if open_header not in change_logs_dict[open_version]:
|
if open_header not in change_logs_dict[cast(Version, open_version)]:
|
||||||
change_logs_dict[open_version][open_header] = []
|
change_logs_dict[cast(Version, open_version)][open_header] = []
|
||||||
change_logs_dict[open_version][open_header].append(line)
|
change_logs_dict[cast(Version, open_version)][open_header].append(line)
|
||||||
|
|
||||||
# Format changelog text
|
# Format changelog text
|
||||||
content = ""
|
content = ""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue