Browse Source

Cast plug-in path of self to str

Because it can't be None.
Ghostkeeper 6 years ago
parent
commit
41c840adbc
1 changed files with 3 additions and 3 deletions
  1. 3 3
      plugins/CuraDrive/src/DrivePluginExtension.py

+ 3 - 3
plugins/CuraDrive/src/DrivePluginExtension.py

@@ -1,9 +1,9 @@
-# Copyright (c) 2018 Ultimaker B.V.
+# Copyright (c) 2019 Ultimaker B.V.
 # Cura is released under the terms of the LGPLv3 or higher.
 
 import os
 from datetime import datetime
-from typing import Optional, List, Dict, Any
+from typing import cast, Optional, List, Dict, Any
 
 from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal
 
@@ -68,7 +68,7 @@ class DrivePluginExtension(QObject, Extension):
 
     def showDriveWindow(self) -> None:
         if not self._drive_window:
-            plugin_dir_path = CuraApplication.getInstance().getPluginRegistry().getPluginPath(self.getPluginId())
+            plugin_dir_path = cast(str, CuraApplication.getInstance().getPluginRegistry().getPluginPath(self.getPluginId())) # We know this plug-in exists because that's us, so this always returns str.
             path = os.path.join(plugin_dir_path, "src", "qml", "main.qml")
             self._drive_window = CuraApplication.getInstance().createQmlComponent(path, {"CuraDrive": self})
         self.refreshBackups()