Browse Source

Show a message when trying to print via USB while already printing

Otherwise the button does nothing and gives no feedback of why it does nothing.

Fixes #6026.
Ghostkeeper 5 years ago
parent
commit
cc9609738c
1 changed files with 3 additions and 0 deletions
  1. 3 0
      plugins/USBPrinting/USBPrinterOutputDevice.py

+ 3 - 0
plugins/USBPrinting/USBPrinterOutputDevice.py

@@ -6,6 +6,7 @@ import os
 from UM.i18n import i18nCatalog
 from UM.Logger import Logger
 from UM.Mesh.MeshWriter import MeshWriter #To get the g-code output.
+from UM.Message import Message #Show an error when already printing.
 from UM.PluginRegistry import PluginRegistry #To get the g-code output.
 from UM.Qt.Duration import DurationFormat
 
@@ -118,6 +119,8 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
     #   \param kwargs Keyword arguments.
     def requestWrite(self, nodes, file_name: str = None, filter_by_machine = False, file_handler = None, **kwargs):
         if self._is_printing:
+            message = Message(text = catalog.i18nc("@message", "A print is still in progress. Cura cannot start another print via USB until the previous print has completed."), title = catalog.i18nc("@message", "Print in Progress"))
+            message.show()
             return  # Already printing
         self.writeStarted.emit(self)
         # cancel any ongoing preheat timer before starting a print