Updated comments in Models

Converted doxygen style comments to reStructuredText style in the files
 found in Cura/cura/Model directory recursively  using the script
dox_2_rst.py (provided in the Uranium repo). Comments were manually
 checked and changed if needed.

 Note: dox_2rst.py struggles with decorated functions.
This commit is contained in:
Jelle Spijker 2020-05-08 18:59:38 +02:00 committed by Jelle Spijker
parent d69bf84424
commit 120541a8db
No known key found for this signature in database
GPG key ID: 6662DC033BE6B99A
26 changed files with 577 additions and 441 deletions

View file

@ -9,9 +9,9 @@ if TYPE_CHECKING:
class DiscoveredCloudPrintersModel(ListModel):
"""
Model used to inform the application about newly added cloud printers, which are discovered from the user's account
"""
"""Model used to inform the application about newly added cloud printers, which are discovered from the user's
account """
DeviceKeyRole = Qt.UserRole + 1
DeviceNameRole = Qt.UserRole + 2
DeviceTypeRole = Qt.UserRole + 3
@ -31,18 +31,24 @@ class DiscoveredCloudPrintersModel(ListModel):
self._application = application # type: CuraApplication
def addDiscoveredCloudPrinters(self, new_devices: List[Dict[str, str]]) -> None:
"""
Adds all the newly discovered cloud printers into the DiscoveredCloudPrintersModel.
"""Adds all the newly discovered cloud printers into the DiscoveredCloudPrintersModel.
Example new_devices entry:
.. code-block:: python
:param new_devices: List of dictionaries which contain information about added cloud printers. Example:
{
"key": "YjW8pwGYcaUvaa0YgVyWeFkX3z",
"name": "NG 001",
"machine_type": "Ultimaker S5",
"firmware_version": "5.5.12.202001"
}
:param new_devices: List of dictionaries which contain information about added cloud printers.
:return: None
"""
self._discovered_cloud_printers_list.extend(new_devices)
self._update()
@ -51,21 +57,21 @@ class DiscoveredCloudPrintersModel(ListModel):
@pyqtSlot()
def clear(self) -> None:
"""
Clears the contents of the DiscoveredCloudPrintersModel.
"""Clears the contents of the DiscoveredCloudPrintersModel.
:return: None
"""
self._discovered_cloud_printers_list = []
self._update()
self.cloudPrintersDetectedChanged.emit(False)
def _update(self) -> None:
"""
Sorts the newly discovered cloud printers by name and then updates the ListModel.
"""Sorts the newly discovered cloud printers by name and then updates the ListModel.
:return: None
"""
items = self._discovered_cloud_printers_list[:]
items.sort(key = lambda k: k["name"])
self.setItems(items)