From f95c09db371c580f3522e93aa4af873ccb8b87d7 Mon Sep 17 00:00:00 2001 From: Remco Burema Date: Wed, 24 Mar 2021 16:18:56 +0100 Subject: [PATCH] Type-checks, not just type comments, and static- over class-method. CURA-8014 --- cura/UI/WhatsNewPagesModel.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cura/UI/WhatsNewPagesModel.py b/cura/UI/WhatsNewPagesModel.py index afba295e90..990f10afd3 100644 --- a/cura/UI/WhatsNewPagesModel.py +++ b/cura/UI/WhatsNewPagesModel.py @@ -19,9 +19,9 @@ class WhatsNewPagesModel(WelcomePagesModel): image_key = "image" text_key = "text" - @classmethod - def _collectOrdinalFiles(cls, resource_type: int, include: List[str]) -> Tuple[Dict[int, str], int]: - result = {} # Dict[int, str] + @staticmethod + def _collectOrdinalFiles(resource_type: int, include: List[str]) -> Tuple[Dict[int, str], int]: + result = {} #type: Dict[int, str] highest = -1 try: folder_path = Resources.getPath(resource_type, "whats_new") @@ -38,8 +38,8 @@ class WhatsNewPagesModel(WelcomePagesModel): Logger.logException("w", "Could not find 'whats_new' folder for resource-type {0}".format(resource_type)) return result, highest - @classmethod - def _loadText(cls, filename: str) -> str: + @staticmethod + def _loadText(filename: str) -> str: result = "" try: with open(filename, "r", encoding="utf-8") as file: @@ -65,7 +65,7 @@ class WhatsNewPagesModel(WelcomePagesModel): texts, max_text = WhatsNewPagesModel._collectOrdinalFiles(Resources.Texts, WhatsNewPagesModel.text_formats) highest = max(max_image, max_text) - self._subpages = [] # List[Dict[str, str]] + self._subpages = [] #type: List[Dict[str, str]] for n in range(0, highest + 1): self._subpages.append({ WhatsNewPagesModel.image_key: None if n not in images else images[n],