Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaime van Kessel <nallath@gmail.com>2021-12-01 12:21:07 +0300
committerJaime van Kessel <nallath@gmail.com>2021-12-01 12:21:07 +0300
commit6bce9453e4173a930b447c8a9b6b31faeb3c9e8c (patch)
treecfe15315261fe9c91149ae9c946d0097019ea76f
parenta057cbe481eb4363edce0bc9b91b5a1a13c0b393 (diff)
Fix warnings in newpages model
Boyscouting. These somehow snuck through code review CURA-8696
-rw-r--r--cura/UI/WhatsNewPagesModel.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/cura/UI/WhatsNewPagesModel.py b/cura/UI/WhatsNewPagesModel.py
index 1627f3e3ce..b99bdf30f0 100644
--- a/cura/UI/WhatsNewPagesModel.py
+++ b/cura/UI/WhatsNewPagesModel.py
@@ -2,7 +2,7 @@
# Cura is released under the terms of the LGPLv3 or higher.
import os
-from typing import Optional, Dict, List, Tuple
+from typing import Optional, Dict, List, Tuple, TYPE_CHECKING
from PyQt5.QtCore import pyqtProperty, pyqtSlot
@@ -11,6 +11,10 @@ from UM.Resources import Resources
from cura.UI.WelcomePagesModel import WelcomePagesModel
+if TYPE_CHECKING:
+ from PyQt5.QtCore import QObject
+ from cura.CuraApplication import CuraApplication
+
class WhatsNewPagesModel(WelcomePagesModel):
"""
@@ -23,6 +27,10 @@ class WhatsNewPagesModel(WelcomePagesModel):
image_key = "image"
text_key = "text"
+ def __init__(self, application: "CuraApplication", parent: Optional["QObject"] = None) -> None:
+ super().__init__(application, parent)
+ self._subpages: List[Dict[str, Optional[str]]] = []
+
@staticmethod
def _collectOrdinalFiles(resource_type: int, include: List[str]) -> Tuple[Dict[int, str], int]:
result = {} # type: Dict[int, str]
@@ -69,7 +77,7 @@ class WhatsNewPagesModel(WelcomePagesModel):
texts, max_text = WhatsNewPagesModel._collectOrdinalFiles(Resources.Texts, WhatsNewPagesModel.text_formats)
highest = max(max_image, max_text)
- self._subpages = [] #type: List[Dict[str, Optional[str]]]
+ self._subpages = []
for n in range(0, highest + 1):
self._subpages.append({
WhatsNewPagesModel.image_key: None if n not in images else images[n],
@@ -97,5 +105,3 @@ class WhatsNewPagesModel(WelcomePagesModel):
def getSubpageText(self, page: int) -> str:
result = self._getSubpageItem(page, WhatsNewPagesModel.text_key)
return result if result else "* * *"
-
-__all__ = ["WhatsNewPagesModel"]