mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-06 05:23:58 -06:00
Support for importing a profile.
Contributes to CURA-1667 Profile import/export
This commit is contained in:
parent
97d64a0749
commit
b93137545f
1 changed files with 5 additions and 2 deletions
|
@ -1,11 +1,13 @@
|
||||||
# Copyright (c) 2015 Ultimaker B.V.
|
# Copyright (c) 2015 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
|
||||||
from UM.Application import Application #To get the machine manager to create the new profile in.
|
from UM.Application import Application #To get the machine manager to create the new profile in.
|
||||||
from UM.Logger import Logger
|
from UM.Logger import Logger
|
||||||
|
from UM.Settings.InstanceContainer import InstanceContainer #The new profile to make.
|
||||||
from cura.ProfileReader import ProfileReader
|
from cura.ProfileReader import ProfileReader
|
||||||
|
|
||||||
|
|
||||||
## A plugin that reads profile data from Cura profile files.
|
## A plugin that reads profile data from Cura profile files.
|
||||||
#
|
#
|
||||||
# It reads a profile from a .curaprofile file, and returns it as a profile
|
# It reads a profile from a .curaprofile file, and returns it as a profile
|
||||||
|
@ -24,7 +26,8 @@ class CuraProfileReader(ProfileReader):
|
||||||
# returned.
|
# returned.
|
||||||
def read(self, file_name):
|
def read(self, file_name):
|
||||||
# Create an empty profile.
|
# Create an empty profile.
|
||||||
profile = Profile(machine_manager = Application.getInstance().getMachineManager(), read_only = False)
|
profile = InstanceContainer(os.path.basename(os.path.splitext(file_name)[0]))
|
||||||
|
profile.addMetaDataEntry("type", "quality")
|
||||||
try:
|
try:
|
||||||
with open(file_name) as f: # Open file for reading.
|
with open(file_name) as f: # Open file for reading.
|
||||||
serialized = f.read()
|
serialized = f.read()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue