mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Merge branch 'main' into CURA-12371
This commit is contained in:
commit
8b0f59256f
54 changed files with 371 additions and 71 deletions
|
@ -46,6 +46,13 @@ class MakerbotWriter(MeshWriter):
|
|||
suffixes=["makerbot"]
|
||||
)
|
||||
)
|
||||
MimeTypeDatabase.addMimeType(
|
||||
MimeType(
|
||||
name="application/x-makerbot-replicator_plus",
|
||||
comment="Makerbot Toolpath Package",
|
||||
suffixes=["makerbot"]
|
||||
)
|
||||
)
|
||||
|
||||
_PNG_FORMAT = [
|
||||
{"prefix": "isometric_thumbnail", "width": 120, "height": 120},
|
||||
|
@ -114,6 +121,8 @@ class MakerbotWriter(MeshWriter):
|
|||
filename, filedata = "print.gcode", gcode_text_io.getvalue()
|
||||
case "application/x-makerbot":
|
||||
filename, filedata = "print.jsontoolpath", du.gcode_2_miracle_jtp(gcode_text_io.getvalue())
|
||||
case "application/x-makerbot-replicator_plus":
|
||||
filename, filedata = "print.jsontoolpath", du.gcode_2_miracle_jtp(gcode_text_io.getvalue(), nb_extruders=1)
|
||||
case _:
|
||||
raise Exception("Unsupported Mime type")
|
||||
|
||||
|
|
|
@ -25,6 +25,12 @@ def getMetaData():
|
|||
"description": catalog.i18nc("@item:inlistbox", "Makerbot Sketch Printfile"),
|
||||
"mime_type": "application/x-makerbot-sketch",
|
||||
"mode": MakerbotWriter.MakerbotWriter.OutputMode.BinaryMode,
|
||||
},
|
||||
{
|
||||
"extension": file_extension,
|
||||
"description": catalog.i18nc("@item:inlistbox", "Makerbot Replicator+ Printfile"),
|
||||
"mime_type": "application/x-makerbot-replicator_plus",
|
||||
"mode": MakerbotWriter.MakerbotWriter.OutputMode.BinaryMode,
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
@ -331,7 +331,7 @@ class CloudOutputDevice(UltimakerNetworkedPrinterOutputDevice):
|
|||
return False
|
||||
|
||||
[printer, *_] = self._printers
|
||||
return printer.type in ("MakerBot Method X", "MakerBot Method XL", "MakerBot Sketch")
|
||||
return printer.type in ("MakerBot Method", "MakerBot Method X", "MakerBot Method XL", "MakerBot Sketch", "MakerBot Sketch Large", "MakerBot Sketch Sprint")
|
||||
|
||||
@pyqtProperty(bool, notify=_cloudClusterPrintersChanged)
|
||||
def supportsPrintJobActions(self) -> bool:
|
||||
|
|
|
@ -3,5 +3,7 @@
|
|||
"ultimaker_methodx": "MakerBot Method X",
|
||||
"ultimaker_methodxl": "MakerBot Method XL",
|
||||
"ultimaker_factor4": "Ultimaker Factor 4",
|
||||
"ultimaker_sketch": "MakerBot Sketch"
|
||||
"ultimaker_sketch": "MakerBot Sketch",
|
||||
"ultimaker_sketch_large": "MakerBot Sketch Large",
|
||||
"ultimaker_sketch_sprint": "MakerBot Sketch Sprint"
|
||||
}
|
||||
|
|
|
@ -97,6 +97,8 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
|||
|
||||
CuraApplication.getInstance().getOnExitCallbackManager().addCallback(self._checkActivePrintingUponAppExit)
|
||||
|
||||
CuraApplication.getInstance().getPreferences().addPreference("usb_printing/enabled", False)
|
||||
|
||||
# This is a callback function that checks if there is any printing in progress via USB when the application tries
|
||||
# to exit. If so, it will show a confirmation before
|
||||
def _checkActivePrintingUponAppExit(self) -> None:
|
||||
|
@ -144,6 +146,8 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
|
|||
|
||||
CuraApplication.getInstance().getController().setActiveStage("MonitorStage")
|
||||
|
||||
CuraApplication.getInstance().getPreferences().setValue("usb_printing/enabled", True)
|
||||
|
||||
#Find the g-code to print.
|
||||
gcode_textio = StringIO()
|
||||
gcode_writer = cast(MeshWriter, PluginRegistry.getInstance().getPluginObject("GCodeWriter"))
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
import configparser
|
||||
import io
|
||||
from typing import Dict, Tuple, List
|
||||
|
||||
from UM.VersionUpgrade import VersionUpgrade
|
||||
|
||||
_RENAMED_SETTINGS = {
|
||||
"wall_overhang_speed_factor": "wall_overhang_speed_factors"
|
||||
} # type: Dict[str, str]
|
||||
|
||||
_NEW_SETTING_VERSION = "25"
|
||||
|
||||
|
||||
class VersionUpgrade59to510(VersionUpgrade):
|
||||
def upgradePreferences(self, serialized: str, filename: str):
|
||||
parser = configparser.ConfigParser(interpolation = None)
|
||||
parser.read_string(serialized)
|
||||
|
||||
# Fix 'renamed'(ish) settings for visibility
|
||||
if "visible_settings" in parser["general"]:
|
||||
all_setting_keys = parser["general"]["visible_settings"].strip().split(";")
|
||||
if all_setting_keys:
|
||||
for idx, key in enumerate(all_setting_keys):
|
||||
if key in _RENAMED_SETTINGS:
|
||||
all_setting_keys[idx] = _RENAMED_SETTINGS[key]
|
||||
parser["general"]["visible_settings"] = ";".join(all_setting_keys)
|
||||
|
||||
# Update version number.
|
||||
parser["metadata"]["setting_version"] = _NEW_SETTING_VERSION
|
||||
|
||||
result = io.StringIO()
|
||||
parser.write(result)
|
||||
return [filename], [result.getvalue()]
|
||||
|
||||
def upgradeInstanceContainer(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||
parser = configparser.ConfigParser(interpolation = None, comment_prefixes = ())
|
||||
parser.read_string(serialized)
|
||||
|
||||
# Update version number.
|
||||
parser["metadata"]["setting_version"] = _NEW_SETTING_VERSION
|
||||
|
||||
if "values" in parser:
|
||||
for old_name, new_name in _RENAMED_SETTINGS.items():
|
||||
if old_name in parser["values"]:
|
||||
parser["values"][new_name] = parser["values"][old_name]
|
||||
del parser["values"][old_name]
|
||||
if "wall_overhang_speed_factors" in parser["values"]:
|
||||
old_value = float(parser["values"]["wall_overhang_speed_factors"])
|
||||
new_value = [max(1, int(round(old_value)))]
|
||||
parser["values"]["wall_overhang_speed_factor"] = str(new_value)
|
||||
|
||||
result = io.StringIO()
|
||||
parser.write(result)
|
||||
return [filename], [result.getvalue()]
|
||||
|
||||
def upgradeStack(self, serialized: str, filename: str) -> Tuple[List[str], List[str]]:
|
||||
parser = configparser.ConfigParser(interpolation = None)
|
||||
parser.read_string(serialized)
|
||||
|
||||
# Update version number.
|
||||
if "metadata" not in parser:
|
||||
parser["metadata"] = {}
|
||||
|
||||
parser["metadata"]["setting_version"] = _NEW_SETTING_VERSION
|
||||
|
||||
result = io.StringIO()
|
||||
parser.write(result)
|
||||
return [filename], [result.getvalue()]
|
60
plugins/VersionUpgrade/VersionUpgrade59to510/__init__.py
Normal file
60
plugins/VersionUpgrade/VersionUpgrade59to510/__init__.py
Normal file
|
@ -0,0 +1,60 @@
|
|||
# Copyright (c) 2024 UltiMaker
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from typing import Any, Dict, TYPE_CHECKING
|
||||
|
||||
from . import VersionUpgrade59to510
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from UM.Application import Application
|
||||
|
||||
upgrade = VersionUpgrade59to510.VersionUpgrade59to510()
|
||||
|
||||
def getMetaData() -> Dict[str, Any]:
|
||||
return {
|
||||
"version_upgrade": {
|
||||
# From To Upgrade function
|
||||
("preferences", 7000024): ("preferences", 7000025, upgrade.upgradePreferences),
|
||||
("machine_stack", 6000024): ("machine_stack", 6000025, upgrade.upgradeStack),
|
||||
("extruder_train", 6000024): ("extruder_train", 6000025, upgrade.upgradeStack),
|
||||
("definition_changes", 4000024): ("definition_changes", 4000025, upgrade.upgradeInstanceContainer),
|
||||
("quality_changes", 4000024): ("quality_changes", 4000025, upgrade.upgradeInstanceContainer),
|
||||
("quality", 4000024): ("quality", 4000025, upgrade.upgradeInstanceContainer),
|
||||
("user", 4000024): ("user", 4000025, upgrade.upgradeInstanceContainer),
|
||||
("intent", 4000024): ("intent", 4000025, upgrade.upgradeInstanceContainer),
|
||||
},
|
||||
"sources": {
|
||||
"preferences": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
"location": {"."}
|
||||
},
|
||||
"machine_stack": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
"location": {"./machine_instances"}
|
||||
},
|
||||
"extruder_train": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
"location": {"./extruders"}
|
||||
},
|
||||
"definition_changes": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
"location": {"./definition_changes"}
|
||||
},
|
||||
"quality_changes": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
"location": {"./quality_changes"}
|
||||
},
|
||||
"quality": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
"location": {"./quality"}
|
||||
},
|
||||
"user": {
|
||||
"get_version": upgrade.getCfgVersion,
|
||||
"location": {"./user"}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
def register(app: "Application") -> Dict[str, Any]:
|
||||
return {"version_upgrade": upgrade}
|
8
plugins/VersionUpgrade/VersionUpgrade59to510/plugin.json
Normal file
8
plugins/VersionUpgrade/VersionUpgrade59to510/plugin.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "Version Upgrade 5.9 to 5.10",
|
||||
"author": "Ultimaker B.V.",
|
||||
"version": "1.0.0",
|
||||
"description": "Upgrades configurations from Cura 5.9 to Cura 5.10",
|
||||
"api": 8,
|
||||
"i18n-catalog": "cura"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue