diff options
author | Simon Edwards <s.edwards@ultimaker.com> | 2017-02-26 22:40:32 +0300 |
---|---|---|
committer | Simon Edwards <s.edwards@ultimaker.com> | 2017-02-26 23:05:09 +0300 |
commit | 4ab6b74930f5a15a0c13d91236f09cdeee736e8d (patch) | |
tree | 2c856f0d29033c45327f8d659224a5d0e1fa1cb5 /cura/Settings/MachineNameValidator.py | |
parent | 7bb486a34bb2f36b21692f40cfdf970c048ff27a (diff) |
Fixed a bunch of error which were reported by PyCharm's code analysis.
Diffstat (limited to 'cura/Settings/MachineNameValidator.py')
-rw-r--r-- | cura/Settings/MachineNameValidator.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/cura/Settings/MachineNameValidator.py b/cura/Settings/MachineNameValidator.py index 68782a2148..dcb83b7a4c 100644 --- a/cura/Settings/MachineNameValidator.py +++ b/cura/Settings/MachineNameValidator.py @@ -6,7 +6,7 @@ from PyQt5.QtGui import QValidator import os #For statvfs. import urllib #To escape machine names for how they're saved to file. -import UM.Resources +from UM.Resources import Resources from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.InstanceContainer import InstanceContainer @@ -19,7 +19,7 @@ class MachineNameValidator(QObject): #Compute the validation regex for printer names. This is limited by the maximum file name length. try: - filename_max_length = os.statvfs(UM.Resources.getDataStoragePath()).f_namemax + filename_max_length = os.statvfs(Resources.getDataStoragePath()).f_namemax except AttributeError: #Doesn't support statvfs. Probably because it's not a Unix system. filename_max_length = 255 #Assume it's Windows on NTFS. machine_name_max_length = filename_max_length - len("_current_settings.") - len(ContainerRegistry.getMimeTypeForContainer(InstanceContainer).preferredSuffix) @@ -41,7 +41,7 @@ class MachineNameValidator(QObject): def validate(self, name, position): #Check for file name length of the current settings container (which is the longest file we're saving with the name). try: - filename_max_length = os.statvfs(UM.Resources.getDataStoragePath()).f_namemax + filename_max_length = os.statvfs(Resources.getDataStoragePath()).f_namemax except AttributeError: #Doesn't support statvfs. Probably because it's not a Unix system. filename_max_length = 255 #Assume it's Windows on NTFS. escaped_name = urllib.parse.quote_plus(name) |