mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Convert doxygen to rst for SentryLogger, SimulationView, SliceInfo,
SolidView
This commit is contained in:
parent
a09cd0e63e
commit
58e43c0a07
4 changed files with 37 additions and 21 deletions
|
@ -33,10 +33,12 @@ class SentryLogger(LogOutput):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self._show_once = set() # type: Set[str]
|
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:
|
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)
|
level = self._translateLogType(log_type)
|
||||||
message = CrashHandler.pruneSensitiveData(message)
|
message = CrashHandler.pruneSensitiveData(message)
|
||||||
if level is None:
|
if level is None:
|
||||||
|
|
|
@ -48,8 +48,9 @@ if TYPE_CHECKING:
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
|
|
||||||
## The preview layer view. It is used to display g-code paths.
|
|
||||||
class SimulationView(CuraView):
|
class SimulationView(CuraView):
|
||||||
|
"""The preview layer view. It is used to display g-code paths."""
|
||||||
|
|
||||||
# Must match SimulationViewMenuComponent.qml
|
# Must match SimulationViewMenuComponent.qml
|
||||||
LAYER_VIEW_TYPE_MATERIAL_TYPE = 0
|
LAYER_VIEW_TYPE_MATERIAL_TYPE = 0
|
||||||
LAYER_VIEW_TYPE_LINE_TYPE = 1
|
LAYER_VIEW_TYPE_LINE_TYPE = 1
|
||||||
|
@ -294,23 +295,28 @@ class SimulationView(CuraView):
|
||||||
|
|
||||||
self.currentPathNumChanged.emit()
|
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:
|
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:
|
if layer_view_type != self._layer_view_type:
|
||||||
self._layer_view_type = layer_view_type
|
self._layer_view_type = layer_view_type
|
||||||
self.currentLayerNumChanged.emit()
|
self.currentLayerNumChanged.emit()
|
||||||
|
|
||||||
## Return the layer view type, integer as in SimulationView.qml and this class
|
|
||||||
def getSimulationViewType(self) -> int:
|
def getSimulationViewType(self) -> int:
|
||||||
|
"""Return the layer view type, integer as in SimulationView.qml and this class"""
|
||||||
|
|
||||||
return self._layer_view_type
|
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:
|
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:
|
if 0 <= extruder_nr <= 3:
|
||||||
self._extruder_opacity[extruder_nr] = opacity
|
self._extruder_opacity[extruder_nr] = opacity
|
||||||
self.currentLayerNumChanged.emit()
|
self.currentLayerNumChanged.emit()
|
||||||
|
@ -372,8 +378,8 @@ class SimulationView(CuraView):
|
||||||
scene = self.getController().getScene()
|
scene = self.getController().getScene()
|
||||||
|
|
||||||
self._old_max_layers = self._max_layers
|
self._old_max_layers = self._max_layers
|
||||||
## Recalculate num max layers
|
|
||||||
new_max_layers = -1
|
new_max_layers = -1
|
||||||
|
"""Recalculate num max layers"""
|
||||||
for node in DepthFirstIterator(scene.getRoot()): # type: ignore
|
for node in DepthFirstIterator(scene.getRoot()): # type: ignore
|
||||||
layer_data = node.callDecoration("getLayerData")
|
layer_data = node.callDecoration("getLayerData")
|
||||||
if not layer_data:
|
if not layer_data:
|
||||||
|
@ -449,9 +455,11 @@ class SimulationView(CuraView):
|
||||||
busyChanged = Signal()
|
busyChanged = Signal()
|
||||||
activityChanged = 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):
|
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:
|
if self._proxy is None:
|
||||||
self._proxy = SimulationViewProxy(self)
|
self._proxy = SimulationViewProxy(self)
|
||||||
return self._proxy
|
return self._proxy
|
||||||
|
|
|
@ -26,10 +26,13 @@ if TYPE_CHECKING:
|
||||||
catalog = i18nCatalog("cura")
|
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):
|
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"
|
info_url = "https://stats.ultimaker.com/api/cura"
|
||||||
|
|
||||||
def __init__(self, parent = None):
|
def __init__(self, parent = None):
|
||||||
|
@ -54,9 +57,11 @@ class SliceInfo(QObject, Extension):
|
||||||
if self._more_info_dialog is None:
|
if self._more_info_dialog is None:
|
||||||
self._more_info_dialog = self._createDialog("MoreInfoWindow.qml")
|
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):
|
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)
|
self._application.getPreferences().setValue("info/asked_send_slice_info", True)
|
||||||
if action_id == "MoreInfo":
|
if action_id == "MoreInfo":
|
||||||
self.showMoreInfoDialog()
|
self.showMoreInfoDialog()
|
||||||
|
|
|
@ -33,9 +33,10 @@ import math
|
||||||
|
|
||||||
catalog = i18nCatalog("cura")
|
catalog = i18nCatalog("cura")
|
||||||
|
|
||||||
## Standard view for mesh models.
|
|
||||||
|
|
||||||
class SolidView(View):
|
class SolidView(View):
|
||||||
|
"""Standard view for mesh models."""
|
||||||
|
|
||||||
_show_xray_warning_preference = "view/show_xray_warning"
|
_show_xray_warning_preference = "view/show_xray_warning"
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue