From 437c78711de5712544fd458c4792cae9d7ae2229 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 13 Apr 2017 16:32:17 +0200 Subject: [PATCH] Added typing to all singletons This greatly helps with pycharms ability to do auto code completion --- cura/QualityManager.py | 4 ++-- cura/Settings/ProfilesModel.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/QualityManager.py b/cura/QualityManager.py index d7b2c7d705..f0f095b912 100644 --- a/cura/QualityManager.py +++ b/cura/QualityManager.py @@ -16,9 +16,9 @@ class QualityManager: ## Get the singleton instance for this class. @classmethod - def getInstance(cls): + def getInstance(cls) -> "QualityManager": # Note: Explicit use of class name to prevent issues with inheritance. - if QualityManager.__instance is None: + if not QualityManager.__instance: QualityManager.__instance = cls() return QualityManager.__instance diff --git a/cura/Settings/ProfilesModel.py b/cura/Settings/ProfilesModel.py index 404bb569a5..9056273216 100644 --- a/cura/Settings/ProfilesModel.py +++ b/cura/Settings/ProfilesModel.py @@ -32,9 +32,9 @@ class ProfilesModel(InstanceContainersModel): ## Get the singleton instance for this class. @classmethod - def getInstance(cls): + def getInstance(cls) -> "ProfilesModel": # Note: Explicit use of class name to prevent issues with inheritance. - if ProfilesModel.__instance is None: + if not ProfilesModel.__instance: ProfilesModel.__instance = cls() return ProfilesModel.__instance