Browse Source

Convert doxygen to rst for UltimakerMachineActions, USBPrinting

Nino van Hooff 4 years ago
parent
commit
de82406782

+ 17 - 12
plugins/USBPrinting/USBPrinterOutputDevice.py

@@ -110,20 +110,22 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
             application = CuraApplication.getInstance()
             application.triggerNextExitCheck()
 
-    ## Reset USB device settings
-    #
     def resetDeviceSettings(self) -> None:
+        """Reset USB device settings"""
+
         self._firmware_name = None
 
-    ##  Request the current scene to be sent to a USB-connected printer.
-    #
-    #   \param nodes A collection of scene nodes to send. This is ignored.
-    #   \param file_name A suggestion for a file name to write.
-    #   \param filter_by_machine Whether to filter MIME types by machine. This
-    #   is ignored.
-    #   \param kwargs Keyword arguments.
     def requestWrite(self, nodes: List["SceneNode"], file_name: Optional[str] = None, limit_mimetypes: bool = False,
                      file_handler: Optional["FileHandler"] = None, filter_by_machine: bool = False, **kwargs) -> None:
+        """Request the current scene to be sent to a USB-connected printer.
+        
+        :param nodes: A collection of scene nodes to send. This is ignored.
+        :param file_name: A suggestion for a file name to write.
+        :param filter_by_machine: Whether to filter MIME types by machine. This
+               is ignored.
+        :param kwargs: Keyword arguments.
+        """
+
         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()
@@ -144,9 +146,11 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
 
         self._printGCode(gcode_textio.getvalue())
 
-    ##  Start a print based on a g-code.
-    #   \param gcode The g-code to print.
     def _printGCode(self, gcode: str):
+        """Start a print based on a g-code.
+        
+        :param gcode: The g-code to print.
+        """
         self._gcode.clear()
         self._paused = False
 
@@ -219,8 +223,9 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
         self._update_thread = Thread(target=self._update, daemon=True, name = "USBPrinterUpdate")
         self._serial = None
 
-    ##  Send a command to printer.
     def sendCommand(self, command: Union[str, bytes]):
+        """Send a command to printer."""
+
         if not self._command_received.is_set():
             self._command_queue.put(command)
         else:

+ 10 - 5
plugins/USBPrinting/USBPrinterOutputDeviceManager.py

@@ -20,9 +20,10 @@ from . import USBPrinterOutputDevice
 i18n_catalog = i18nCatalog("cura")
 
 
-##  Manager class that ensures that an USBPrinterOutput device is created for every connected USB printer.
 @signalemitter
 class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin):
+    """Manager class that ensures that an USBPrinterOutput device is created for every connected USB printer."""
+
     addUSBOutputDeviceSignal = Signal()
     progressChanged = pyqtSignal()
 
@@ -85,8 +86,9 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin):
             self._addRemovePorts(port_list)
             time.sleep(5)
 
-    ##  Helper to identify serial ports (and scan for them)
     def _addRemovePorts(self, serial_ports):
+        """Helper to identify serial ports (and scan for them)"""
+
         # First, find and add all new or changed keys
         for serial_port in list(serial_ports):
             if serial_port not in self._serial_port_list:
@@ -98,16 +100,19 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin):
             if port not in self._serial_port_list:
                 device.close()
 
-    ##  Because the model needs to be created in the same thread as the QMLEngine, we use a signal.
     def addOutputDevice(self, serial_port):
+        """Because the model needs to be created in the same thread as the QMLEngine, we use a signal."""
+
         device = USBPrinterOutputDevice.USBPrinterOutputDevice(serial_port)
         device.connectionStateChanged.connect(self._onConnectionStateChanged)
         self._usb_output_devices[serial_port] = device
         device.connect()
 
-    ##  Create a list of serial ports on the system.
-    #   \param only_list_usb If true, only usb ports are listed
     def getSerialPortList(self, only_list_usb = False):
+        """Create a list of serial ports on the system.
+        
+        :param only_list_usb: If true, only usb ports are listed
+        """
         base_list = []
         for port in serial.tools.list_ports.comports():
             if not isinstance(port, tuple):

+ 5 - 2
plugins/UltimakerMachineActions/BedLevelMachineAction.py

@@ -14,9 +14,12 @@ from UM.Logger import Logger
 catalog = i18nCatalog("cura")
 
 
-##  A simple action to handle manual bed leveling procedure for printers that don't have it on the firmware.
-#   This is currently only used by the Ultimaker Original+
 class BedLevelMachineAction(MachineAction):
+    """A simple action to handle manual bed leveling procedure for printers that don't have it on the firmware.
+    
+    This is currently only used by the Ultimaker Original+
+    """
+
     def __init__(self):
         super().__init__("BedLevel", catalog.i18nc("@action", "Level build plate"))
         self._qml_url = "BedLevelMachineAction.qml"

+ 5 - 2
plugins/UltimakerMachineActions/UMOUpgradeSelection.py

@@ -11,9 +11,12 @@ catalog = i18nCatalog("cura")
 
 from cura.Settings.CuraStackBuilder import CuraStackBuilder
 
-##  The Ultimaker Original can have a few revisions & upgrades. This action helps with selecting them, so they are added
-#   as a variant.
+
 class UMOUpgradeSelection(MachineAction):
+    """The Ultimaker Original can have a few revisions & upgrades.
+    This action helps with selecting them, so they are added as a variant.
+    """
+
     def __init__(self):
         super().__init__("UMOUpgradeSelection", catalog.i18nc("@action", "Select upgrades"))
         self._qml_url = "UMOUpgradeSelectionMachineAction.qml"