Skip to content

Commit

Permalink
Merge pull request #20193 from Ultimaker/CURA-12150-add-a-global-pref…
Browse files Browse the repository at this point in the history
…erence-for-USB-printing

CURA-12150 Add local preference to monitor use of USB writing
  • Loading branch information
HellAholic authored Jan 30, 2025
2 parents cd6827c + 67d8535 commit 23cb08e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions plugins/USBPrinting/USBPrinterOutputDevice.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ def __init__(self, serial_port: str, baud_rate: Optional[int] = None) -> None:

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:
Expand Down Expand Up @@ -144,6 +146,8 @@ def requestWrite(self, nodes: List["SceneNode"], file_name: Optional[str] = None

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"))
Expand Down

0 comments on commit 23cb08e

Please sign in to comment.