mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Add CuraProfileWriter plugin
This plugin writes the default Cura profile format. Contributes to issue CURA-34.
This commit is contained in:
parent
984a8efe1e
commit
3ec790f963
3 changed files with 47 additions and 1 deletions
19
plugins/CuraProfileWriter/CuraProfileWriter.py
Normal file
19
plugins/CuraProfileWriter/CuraProfileWriter.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Copyright (c) 2015 Ultimaker B.V.
|
||||||
|
# Copyright (c) 2013 David Braam
|
||||||
|
# Uranium is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
|
from UM.Settings.Profile import Profile
|
||||||
|
from UM.Settings.ProfileWriter import ProfileWriter
|
||||||
|
|
||||||
|
## Writes profiles to Cura's own profile format with config files.
|
||||||
|
class CuraProfileWriter(ProfileWriter):
|
||||||
|
## Writes a profile to the specified stream.
|
||||||
|
#
|
||||||
|
# \param stream \type{IOStream} The stream to write the profile to.
|
||||||
|
# \param profile \type{Profile} The profile to write to that stream.
|
||||||
|
# \return \code True \endcode if the writing was successful, or \code
|
||||||
|
# False \endcode if it wasn't.
|
||||||
|
def write(self, stream, profile):
|
||||||
|
serialised = profile.serialise()
|
||||||
|
stream.write(serialised)
|
||||||
|
return True
|
27
plugins/CuraProfileWriter/__init__.py
Normal file
27
plugins/CuraProfileWriter/__init__.py
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
# Copyright (c) 2015 Ultimaker B.V.
|
||||||
|
# Uranium is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
|
from . import CuraProfileWriter
|
||||||
|
|
||||||
|
from UM.i18n import i18nCatalog
|
||||||
|
catalog = i18nCatalog("uranium")
|
||||||
|
|
||||||
|
def getMetaData():
|
||||||
|
return {
|
||||||
|
"plugin": {
|
||||||
|
"name": catalog.i18nc("@label", "Cura Profile Writer"),
|
||||||
|
"author": "Ultimaker",
|
||||||
|
"version": "1.0",
|
||||||
|
"description": catalog.i18nc("@info:whatsthis", "Provides support for exporting Cura profiles."),
|
||||||
|
"api": 2
|
||||||
|
},
|
||||||
|
"profile_writer": [
|
||||||
|
{
|
||||||
|
"extension": "curaprofile",
|
||||||
|
"description": catalog.i18nc("@item:inlistbox", "Cura Profile")
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
def register(app):
|
||||||
|
return { "profile_writer": CuraProfileWriter.CuraProfileWriter() }
|
Loading…
Add table
Add a link
Reference in a new issue