Browse Source

Fixed removable drive error spam on Windows

Jaime van Kessel 7 years ago
parent
commit
ef51897b71
1 changed files with 5 additions and 6 deletions
  1. 5 6
      plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py

+ 5 - 6
plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py

@@ -1,19 +1,18 @@
 # Copyright (c) 2015 Ultimaker B.V.
 # Copyright (c) 2013 David Braam
 # Uranium is released under the terms of the AGPLv3 or higher.
-
-from UM.i18n import i18nCatalog
-catalog = i18nCatalog("cura")
-
 from . import RemovableDrivePlugin
 
 import string
-import ctypes   # type: ignore
-from ctypes import wintypes # Using ctypes.wintypes in the code below does not seem to work
+import ctypes
+from ctypes import wintypes  # Using ctypes.wintypes in the code below does not seem to work
 
 from UM.i18n import i18nCatalog
 catalog = i18nCatalog("cura")
 
+# Ignore windows error popups. Fixes the whole "Can't open drive X" when user has an SD card reader.
+ctypes.windll.kernel32.SetErrorMode(1)
+
 # WinAPI Constants that we need
 # Hardcoded here due to stupid WinDLL stuff that does not give us access to these values.
 DRIVE_REMOVABLE = 2 # [CodeStyle: Windows Enum value]