From 58e43c0a07cbd349e3df433352f5f56aa5e0c26d Mon Sep 17 00:00:00 2001 From: Nino van Hooff Date: Fri, 15 May 2020 13:34:58 +0200 Subject: [PATCH] Convert doxygen to rst for SentryLogger, SimulationView, SliceInfo, SolidView --- plugins/SentryLogger/SentryLogger.py | 8 +++--- plugins/SimulationView/SimulationView.py | 32 +++++++++++++++--------- plugins/SliceInfoPlugin/SliceInfo.py | 15 +++++++---- plugins/SolidView/SolidView.py | 3 ++- 4 files changed, 37 insertions(+), 21 deletions(-) diff --git a/plugins/SentryLogger/SentryLogger.py b/plugins/SentryLogger/SentryLogger.py index 51e77ad589..55bcc7e806 100644 --- a/plugins/SentryLogger/SentryLogger.py +++ b/plugins/SentryLogger/SentryLogger.py @@ -33,10 +33,12 @@ class SentryLogger(LogOutput): super().__init__() self._show_once = set() # type: Set[str] - ## Log the message to the sentry hub as a breadcrumb - # \param log_type "e" (error), "i"(info), "d"(debug), "w"(warning) or "c"(critical) (can postfix with "_once") - # \param message String containing message to be logged def log(self, log_type: str, message: str) -> None: + """Log the message to the sentry hub as a breadcrumb + + :param log_type: "e" (error), "i"(info), "d"(debug), "w"(warning) or "c"(critical) (can postfix with "_once") + :param message: String containing message to be logged + """ level = self._translateLogType(log_type) message = CrashHandler.pruneSensitiveData(message) if level is None: diff --git a/plugins/SimulationView/SimulationView.py b/plugins/SimulationView/SimulationView.py index 28d10c5f40..c0dd7ea820 100644 --- a/plugins/SimulationView/SimulationView.py +++ b/plugins/SimulationView/SimulationView.py @@ -48,8 +48,9 @@ if TYPE_CHECKING: catalog = i18nCatalog("cura") -## The preview layer view. It is used to display g-code paths. class SimulationView(CuraView): + """The preview layer view. It is used to display g-code paths.""" + # Must match SimulationViewMenuComponent.qml LAYER_VIEW_TYPE_MATERIAL_TYPE = 0 LAYER_VIEW_TYPE_LINE_TYPE = 1 @@ -294,23 +295,28 @@ class SimulationView(CuraView): self.currentPathNumChanged.emit() - ## Set the layer view type - # - # \param layer_view_type integer as in SimulationView.qml and this class def setSimulationViewType(self, layer_view_type: int) -> None: + """Set the layer view type + + :param layer_view_type: integer as in SimulationView.qml and this class + """ + if layer_view_type != self._layer_view_type: self._layer_view_type = layer_view_type self.currentLayerNumChanged.emit() - ## Return the layer view type, integer as in SimulationView.qml and this class def getSimulationViewType(self) -> int: + """Return the layer view type, integer as in SimulationView.qml and this class""" + return self._layer_view_type - ## Set the extruder opacity - # - # \param extruder_nr 0..3 - # \param opacity 0.0 .. 1.0 def setExtruderOpacity(self, extruder_nr: int, opacity: float) -> None: + """Set the extruder opacity + + :param extruder_nr: 0..3 + :param opacity: 0.0 .. 1.0 + """ + if 0 <= extruder_nr <= 3: self._extruder_opacity[extruder_nr] = opacity self.currentLayerNumChanged.emit() @@ -372,8 +378,8 @@ class SimulationView(CuraView): scene = self.getController().getScene() self._old_max_layers = self._max_layers - ## Recalculate num max layers new_max_layers = -1 + """Recalculate num max layers""" for node in DepthFirstIterator(scene.getRoot()): # type: ignore layer_data = node.callDecoration("getLayerData") if not layer_data: @@ -449,9 +455,11 @@ class SimulationView(CuraView): busyChanged = Signal() activityChanged = Signal() - ## Hackish way to ensure the proxy is already created, which ensures that the layerview.qml is already created - # as this caused some issues. def getProxy(self, engine, script_engine): + """Hackish way to ensure the proxy is already created + + which ensures that the layerview.qml is already created as this caused some issues. + """ if self._proxy is None: self._proxy = SimulationViewProxy(self) return self._proxy diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index c21d70819a..a4b17236dd 100755 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -26,10 +26,13 @@ if TYPE_CHECKING: catalog = i18nCatalog("cura") -## This Extension runs in the background and sends several bits of information to the Ultimaker servers. -# The data is only sent when the user in question gave permission to do so. All data is anonymous and -# no model files are being sent (Just a SHA256 hash of the model). class SliceInfo(QObject, Extension): + """This Extension runs in the background and sends several bits of information to the Ultimaker servers. + + The data is only sent when the user in question gave permission to do so. All data is anonymous and + no model files are being sent (Just a SHA256 hash of the model). + """ + info_url = "https://stats.ultimaker.com/api/cura" def __init__(self, parent = None): @@ -54,9 +57,11 @@ class SliceInfo(QObject, Extension): if self._more_info_dialog is None: self._more_info_dialog = self._createDialog("MoreInfoWindow.qml") - ## Perform action based on user input. - # Note that clicking "Disable" won't actually disable the data sending, but rather take the user to preferences where they can disable it. def messageActionTriggered(self, message_id, action_id): + """Perform action based on user input. + + Note that clicking "Disable" won't actually disable the data sending, but rather take the user to preferences where they can disable it. + """ self._application.getPreferences().setValue("info/asked_send_slice_info", True) if action_id == "MoreInfo": self.showMoreInfoDialog() diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index bfe803f224..dc88265d68 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -33,9 +33,10 @@ import math catalog = i18nCatalog("cura") -## Standard view for mesh models. class SolidView(View): + """Standard view for mesh models.""" + _show_xray_warning_preference = "view/show_xray_warning" def __init__(self):