mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Importing invalid filetypes now gives proper error messages
CURA-2883
This commit is contained in:
parent
1b01455c36
commit
ac708d54b6
3 changed files with 5 additions and 1 deletions
|
@ -210,7 +210,7 @@ class CuraContainerRegistry(ContainerRegistry):
|
||||||
return {"status": "ok", "message": catalog.i18nc("@info:status", "Successfully imported profile {0}", profile_or_list[0].getName())}
|
return {"status": "ok", "message": catalog.i18nc("@info:status", "Successfully imported profile {0}", profile_or_list[0].getName())}
|
||||||
|
|
||||||
# If it hasn't returned by now, none of the plugins loaded the profile successfully.
|
# If it hasn't returned by now, none of the plugins loaded the profile successfully.
|
||||||
return {"status": "error", "message": catalog.i18nc("@info:status", "Profile {0} has an unknown file type.", file_name)}
|
return {"status": "error", "message": catalog.i18nc("@info:status", "Profile {0} has an unknown file type or is corrupted.", file_name)}
|
||||||
|
|
||||||
def _configureProfile(self, profile, id_seed, new_name):
|
def _configureProfile(self, profile, id_seed, new_name):
|
||||||
profile.setReadOnly(False)
|
profile.setReadOnly(False)
|
||||||
|
|
|
@ -99,4 +99,6 @@ class CuraProfileReader(ProfileReader):
|
||||||
return []
|
return []
|
||||||
|
|
||||||
filenames, outputs = profile_convert_funcs[0](serialized, profile_id)
|
filenames, outputs = profile_convert_funcs[0](serialized, profile_id)
|
||||||
|
if filenames is None and outputs is None:
|
||||||
|
return []
|
||||||
return list(zip(outputs, filenames))
|
return list(zip(outputs, filenames))
|
||||||
|
|
|
@ -5,6 +5,7 @@ import configparser #To read config files.
|
||||||
import io #To write config files to strings as if they were files.
|
import io #To write config files to strings as if they were files.
|
||||||
|
|
||||||
import UM.VersionUpgrade
|
import UM.VersionUpgrade
|
||||||
|
from UM.Logger import Logger
|
||||||
|
|
||||||
## Creates a new profile instance by parsing a serialised profile in version 1
|
## Creates a new profile instance by parsing a serialised profile in version 1
|
||||||
# of the file format.
|
# of the file format.
|
||||||
|
@ -80,6 +81,7 @@ class Profile:
|
||||||
import VersionUpgrade21to22 # Import here to prevent circular dependencies.
|
import VersionUpgrade21to22 # Import here to prevent circular dependencies.
|
||||||
|
|
||||||
if self._name == "Current settings":
|
if self._name == "Current settings":
|
||||||
|
Logger.log("w", "Unable to upgrade this profile. Skipping it.")
|
||||||
return None, None #Can't upgrade these, because the new current profile needs to specify the definition ID and the old file only had the machine instance, not the definition.
|
return None, None #Can't upgrade these, because the new current profile needs to specify the definition ID and the old file only had the machine instance, not the definition.
|
||||||
|
|
||||||
config = configparser.ConfigParser(interpolation = None)
|
config = configparser.ConfigParser(interpolation = None)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue