mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 14:37:29 -06:00
Convert doxygen to rst for Prepare, Preview, RemovableOutputDevice
This commit is contained in:
parent
a4fe3d7685
commit
a09cd0e63e
6 changed files with 74 additions and 57 deletions
|
@ -10,12 +10,14 @@ import glob
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
## Support for removable devices on Linux.
|
||||
#
|
||||
# TODO: This code uses the most basic interfaces for handling this.
|
||||
# We should instead use UDisks2 to handle mount/unmount and hotplugging events.
|
||||
#
|
||||
|
||||
class LinuxRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
||||
"""Support for removable devices on Linux.
|
||||
|
||||
TODO: This code uses the most basic interfaces for handling this.
|
||||
We should instead use UDisks2 to handle mount/unmount and hotplugging events.
|
||||
"""
|
||||
|
||||
def checkRemovableDrives(self):
|
||||
drives = {}
|
||||
for volume in glob.glob("/media/*"):
|
||||
|
|
|
@ -9,8 +9,10 @@ import os
|
|||
|
||||
import plistlib
|
||||
|
||||
## Support for removable devices on Mac OSX
|
||||
|
||||
class OSXRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
||||
"""Support for removable devices on Mac OSX"""
|
||||
|
||||
def checkRemovableDrives(self):
|
||||
drives = {}
|
||||
p = subprocess.Popen(["system_profiler", "SPUSBDataType", "-xml"], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
|
||||
|
|
|
@ -28,17 +28,19 @@ class RemovableDriveOutputDevice(OutputDevice):
|
|||
self._writing = False
|
||||
self._stream = None
|
||||
|
||||
## Request the specified nodes to be written to the removable drive.
|
||||
#
|
||||
# \param nodes A collection of scene nodes that should be written to the
|
||||
# removable drive.
|
||||
# \param file_name \type{string} A suggestion for the file name to write
|
||||
# to. If none is provided, a file name will be made from the names of the
|
||||
# meshes.
|
||||
# \param limit_mimetypes Should we limit the available MIME types to the
|
||||
# MIME types available to the currently active machine?
|
||||
#
|
||||
def requestWrite(self, nodes, file_name = None, filter_by_machine = False, file_handler = None, **kwargs):
|
||||
"""Request the specified nodes to be written to the removable drive.
|
||||
|
||||
:param nodes: A collection of scene nodes that should be written to the
|
||||
removable drive.
|
||||
:param file_name: :type{string} A suggestion for the file name to write to.
|
||||
If none is provided, a file name will be made from the names of the
|
||||
meshes.
|
||||
:param limit_mimetypes: Should we limit the available MIME types to the
|
||||
MIME types available to the currently active machine?
|
||||
|
||||
"""
|
||||
|
||||
filter_by_machine = True # This plugin is intended to be used by machine (regardless of what it was told to do)
|
||||
if self._writing:
|
||||
raise OutputDeviceError.DeviceBusyError()
|
||||
|
@ -106,14 +108,14 @@ class RemovableDriveOutputDevice(OutputDevice):
|
|||
Logger.log("e", "Operating system would not let us write to %s: %s", file_name, str(e))
|
||||
raise OutputDeviceError.WriteRequestFailedError(catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "Could not save to <filename>{0}</filename>: <message>{1}</message>").format(file_name, str(e))) from e
|
||||
|
||||
## Generate a file name automatically for the specified nodes to be saved
|
||||
# in.
|
||||
#
|
||||
# The name generated will be the name of one of the nodes. Which node that
|
||||
# is can not be guaranteed.
|
||||
#
|
||||
# \param nodes A collection of nodes for which to generate a file name.
|
||||
def _automaticFileName(self, nodes):
|
||||
"""Generate a file name automatically for the specified nodes to be saved in.
|
||||
|
||||
The name generated will be the name of one of the nodes. Which node that
|
||||
is can not be guaranteed.
|
||||
|
||||
:param nodes: A collection of nodes for which to generate a file name.
|
||||
"""
|
||||
for root in nodes:
|
||||
for child in BreadthFirstIterator(root):
|
||||
if child.getMeshData():
|
||||
|
|
|
@ -42,8 +42,9 @@ ctypes.windll.kernel32.DeviceIoControl.argtypes = [ #type: ignore
|
|||
ctypes.windll.kernel32.DeviceIoControl.restype = wintypes.BOOL #type: ignore
|
||||
|
||||
|
||||
## Removable drive support for windows
|
||||
class WindowsRemovableDrivePlugin(RemovableDrivePlugin.RemovableDrivePlugin):
|
||||
"""Removable drive support for windows"""
|
||||
|
||||
def checkRemovableDrives(self):
|
||||
drives = {}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue