コード例 #1
0
ファイル: slicing.py プロジェクト: beeverycreative/BEEweb
def slicingListAll():
	from octoprint.filemanager import get_extensions

	default_slicer = s().get(["slicing", "defaultSlicer"])

	if "configured" in request.values and request.values["configured"] in valid_boolean_trues:
		slicers = slicingManager.configured_slicers
	else:
		slicers = slicingManager.registered_slicers

	result = dict()
	for slicer in slicers:
		try:
			slicer_impl = slicingManager.get_slicer(slicer, require_configured=False)

			extensions = set()
			for source_file_type in slicer_impl.get_slicer_properties().get("source_file_types", ["model"]):
				extensions = extensions.union(get_extensions(source_file_type))

			result[slicer] = dict(
				key=slicer,
				displayName=slicer_impl.get_slicer_properties()["name"],
				default=default_slicer == slicer,
				configured=slicer_impl.is_slicer_configured(),
				profiles=_getSlicingProfilesData(slicer),
				extensions=dict(
					source=list(extensions),
					destination=slicer_impl.get_slicer_properties().get("destination_extensions", ["gco", "gcode", "g"])
				)
			)
		except (UnknownSlicer, SlicerNotConfigured):
			# this should never happen
			pass

	return jsonify(result)
コード例 #2
0
ファイル: slicing.py プロジェクト: gauthama93/OctoPrint
def slicingListAll():
    from octoprint.filemanager import get_extensions

    default_slicer = s().get(["slicing", "defaultSlicer"])

    if ("configured" in request.values
            and request.values["configured"] in valid_boolean_trues):
        slicers = slicingManager.configured_slicers
    else:
        slicers = slicingManager.registered_slicers

    result = {}
    for slicer in slicers:
        try:
            slicer_impl = slicingManager.get_slicer(slicer,
                                                    require_configured=False)

            extensions = set()
            for source_file_type in slicer_impl.get_slicer_properties().get(
                    "source_file_types", ["model"]):
                extensions = extensions.union(get_extensions(source_file_type))

            result[slicer] = {
                "key":
                slicer,
                "displayName":
                slicer_impl.get_slicer_properties().get("name", "n/a"),
                "sameDevice":
                slicer_impl.get_slicer_properties().get("same_device", True),
                "default":
                default_slicer == slicer,
                "configured":
                slicer_impl.is_slicer_configured(),
                "profiles":
                _getSlicingProfilesData(slicer),
                "extensions": {
                    "source":
                    list(extensions),
                    "destination":
                    slicer_impl.get_slicer_properties().get(
                        "destination_extensions", ["gco", "gcode", "g"]),
                },
            }
        except (UnknownSlicer, SlicerNotConfigured):
            # this should never happen
            pass

    return jsonify(result)
コード例 #3
0
def slicingListAll():
    from octoprint.filemanager import get_extensions

    default_slicer = s().get(["slicing", "defaultSlicer"])

    if "configured" in request.values and request.values[
            "configured"] in valid_boolean_trues:
        slicers = slicingManager.configured_slicers
    else:
        slicers = slicingManager.registered_slicers

    result = dict()
    for slicer in slicers:
        try:
            slicer_impl = slicingManager.get_slicer(slicer,
                                                    require_configured=False)

            extensions = set()
            for source_file_type in slicer_impl.get_slicer_properties().get(
                    "source_file_types", ["model"]):
                extensions = extensions.union(get_extensions(source_file_type))

            result[slicer] = dict(
                key=slicer,
                displayName=slicer_impl.get_slicer_properties()["name"],
                default=default_slicer == slicer,
                configured=slicer_impl.is_slicer_configured(),
                profiles=_getSlicingProfilesData(slicer),
                extensions=dict(
                    source=list(extensions),
                    destination=slicer_impl.get_slicer_properties().get(
                        "destination_extensions", ["gco", "gcode", "g"])))
        except (UnknownSlicer, SlicerNotConfigured):
            # this should never happen
            pass

    return jsonify(result)