Merge branch '4.5'

Conflicts:
	cura_app.py -> Due to moving some imports around.
This commit is contained in:
Ghostkeeper 2020-02-25 12:07:47 +01:00
commit a1438e91d0
No known key found for this signature in database
GPG Key ID: 37E2020986774393
20 changed files with 113 additions and 121 deletions

View File

@ -10,7 +10,7 @@ import os.path
import uuid
import json
import locale
from typing import cast
from typing import cast, Any
try:
from sentry_sdk.hub import Hub
@ -32,6 +32,8 @@ from UM.Resources import Resources
from cura import ApplicationMetadata
catalog = i18nCatalog("cura")
home_dir = os.path.expanduser("~")
MYPY = False
if MYPY:
@ -83,6 +85,21 @@ class CrashHandler:
self.dialog = QDialog()
self._createDialog()
@staticmethod
def pruneSensitiveData(obj: Any) -> Any:
if isinstance(obj, str):
return obj.replace(home_dir, "<user_home>")
if isinstance(obj, list):
return [CrashHandler.pruneSensitiveData(item) for item in obj]
if isinstance(obj, dict):
return {k: CrashHandler.pruneSensitiveData(v) for k, v in obj.items()}
return obj
@staticmethod
def sentryBeforeSend(event, hint):
return CrashHandler.pruneSensitiveData(event)
def _createEarlyCrashDialog(self):
dialog = QDialog()
dialog.setMinimumWidth(500)

View File

@ -8,9 +8,17 @@ import faulthandler
import os
import sys
# Workaround for a race condition on certain systems where there
# is a race condition between Arcus and PyQt. Importing Arcus
# first seems to prevent Sip from going into a state where it
# tries to create PyQt objects on a non-main thread.
import Arcus # @UnusedImport
import Savitar # @UnusedImport
from UM.Platform import Platform
from cura import ApplicationMetadata
from cura.ApplicationMetadata import CuraAppName
from cura.CrashHandler import CrashHandler
try:
import sentry_sdk
@ -44,6 +52,7 @@ if with_sentry_sdk:
pass
sentry_sdk.init("https://5034bf0054fb4b889f82896326e79b13@sentry.io/1821564",
before_send = CrashHandler.sentryBeforeSend,
environment = sentry_env,
release = "cura%s" % ApplicationMetadata.CuraVersion,
default_integrations = False,
@ -166,13 +175,6 @@ if sys.stderr:
elif sys.stdout:
faulthandler.enable(file = sys.stdout, all_threads = True)
# Workaround for a race condition on certain systems where there
# is a race condition between Arcus and PyQt. Importing Arcus
# first seems to prevent Sip from going into a state where it
# tries to create PyQt objects on a non-main thread.
import Arcus #@UnusedImport
import Savitar #@UnusedImport
from cura.CuraApplication import CuraApplication

View File

@ -3,6 +3,9 @@
from UM.Logger import LogOutput
from typing import Set
from cura.CrashHandler import CrashHandler
try:
from sentry_sdk import add_breadcrumb
except ImportError:
@ -10,8 +13,6 @@ except ImportError:
from typing import Optional
import os
home_dir = os.path.expanduser("~")
class SentryLogger(LogOutput):
# Sentry (https://sentry.io) is the service that Cura uses for logging crashes. This logger ensures that the
@ -37,7 +38,7 @@ class SentryLogger(LogOutput):
# \param message String containing message to be logged
def log(self, log_type: str, message: str) -> None:
level = self._translateLogType(log_type)
message = self._pruneSensitiveData(message)
message = CrashHandler.pruneSensitiveData(message)
if level is None:
if message not in self._show_once:
level = self._translateLogType(log_type[0])
@ -47,12 +48,6 @@ class SentryLogger(LogOutput):
else:
add_breadcrumb(level = level, message = message)
@staticmethod
def _pruneSensitiveData(message):
if home_dir in message:
message = message.replace(home_dir, "<user_home>")
return message
@staticmethod
def _translateLogType(log_type: str) -> Optional[str]:
return SentryLogger._levels.get(log_type)

View File

@ -46,10 +46,19 @@ class SimulationPass(RenderPass):
self._layer_view = layerview
self._compatibility_mode = layerview.getCompatibilityMode()
def _updateLayerShaderValues(self):
def render(self):
if not self._layer_shader:
if self._compatibility_mode:
shader_filename = "layers.shader"
shadow_shader_filename = "layers_shadow.shader"
else:
shader_filename = "layers3d.shader"
shadow_shader_filename = "layers3d_shadow.shader"
self._layer_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("SimulationView"), shader_filename))
self._layer_shadow_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("SimulationView"), shadow_shader_filename))
self._current_shader = self._layer_shader
# Use extruder 0 if the extruder manager reports extruder index -1 (for single extrusion printers)
self._layer_shader.setUniformValue("u_active_extruder",
float(max(0, self._extruder_manager.activeExtruderIndex)))
self._layer_shader.setUniformValue("u_active_extruder", float(max(0, self._extruder_manager.activeExtruderIndex)))
if self._layer_view:
self._layer_shader.setUniformValue("u_max_feedrate", self._layer_view.getMaxFeedrate())
self._layer_shader.setUniformValue("u_min_feedrate", self._layer_view.getMinFeedrate())
@ -62,7 +71,7 @@ class SimulationPass(RenderPass):
self._layer_shader.setUniformValue("u_show_skin", self._layer_view.getShowSkin())
self._layer_shader.setUniformValue("u_show_infill", self._layer_view.getShowInfill())
else:
# defaults
#defaults
self._layer_shader.setUniformValue("u_max_feedrate", 1)
self._layer_shader.setUniformValue("u_min_feedrate", 0)
self._layer_shader.setUniformValue("u_max_thickness", 1)
@ -74,20 +83,6 @@ class SimulationPass(RenderPass):
self._layer_shader.setUniformValue("u_show_skin", 1)
self._layer_shader.setUniformValue("u_show_infill", 1)
def render(self):
if not self._layer_shader:
if self._compatibility_mode:
shader_filename = "layers.shader"
shadow_shader_filename = "layers_shadow.shader"
else:
shader_filename = "layers3d.shader"
shadow_shader_filename = "layers3d_shadow.shader"
self._layer_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("SimulationView"), shader_filename))
self._layer_shadow_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("SimulationView"), shadow_shader_filename))
self._current_shader = self._layer_shader
self._updateLayerShaderValues()
if not self._tool_handle_shader:
self._tool_handle_shader = OpenGL.getInstance().createShaderProgram(Resources.getPath(Resources.Shaders, "toolhandle.shader"))
@ -102,6 +97,7 @@ class SimulationPass(RenderPass):
nozzle_node = None
for node in DepthFirstIterator(self._scene.getRoot()):
if isinstance(node, ToolHandle):
tool_handle_batch.addItem(node.getWorldTransformation(), mesh = node.getSolidMesh())
@ -116,24 +112,29 @@ class SimulationPass(RenderPass):
# Render all layers below a certain number as line mesh instead of vertices.
if self._layer_view._current_layer_num > -1 and ((not self._layer_view._only_show_top_layers) or (not self._layer_view.getCompatibilityMode())):
start = self._layer_view.start_elements_index
end = self._layer_view.end_elements_index
index = self._layer_view._current_path_num
offset = 0
layer = layer_data.getLayer(self._layer_view._current_layer_num)
if layer is None:
continue
for polygon in layer.polygons:
# The size indicates all values in the two-dimension array, and the second dimension is
# always size 3 because we have 3D points.
if index >= polygon.data.size // 3 - offset:
index -= polygon.data.size // 3 - offset
offset = 1 # This is to avoid the first point when there is more than one polygon, since has the same value as the last point in the previous polygon
continue
# The head position is calculated and translated
head_position = Vector(polygon.data[index + offset][0], polygon.data[index + offset][1],
polygon.data[index + offset][2]) + node.getWorldPosition()
break
start = 0
end = 0
element_counts = layer_data.getElementCounts()
for layer in sorted(element_counts.keys()):
# In the current layer, we show just the indicated paths
if layer == self._layer_view._current_layer_num:
# We look for the position of the head, searching the point of the current path
index = self._layer_view._current_path_num
offset = 0
for polygon in layer_data.getLayer(layer).polygons:
# The size indicates all values in the two-dimension array, and the second dimension is
# always size 3 because we have 3D points.
if index >= polygon.data.size // 3 - offset:
index -= polygon.data.size // 3 - offset
offset = 1 # This is to avoid the first point when there is more than one polygon, since has the same value as the last point in the previous polygon
continue
# The head position is calculated and translated
head_position = Vector(polygon.data[index+offset][0], polygon.data[index+offset][1], polygon.data[index+offset][2]) + node.getWorldPosition()
break
break
if self._layer_view._minimum_layer_num > layer:
start += element_counts[layer]
end += element_counts[layer]
# Calculate the range of paths in the last layer
current_layer_start = end

View File

@ -73,8 +73,6 @@ class SimulationView(CuraView):
self._max_paths = 0
self._current_path_num = 0
self._minimum_path_num = 0
self.start_elements_index = 0
self.end_elements_index = 0
self.currentLayerNumChanged.connect(self._onCurrentLayerNumChanged)
self._busy = False
@ -252,7 +250,6 @@ class SimulationView(CuraView):
self._minimum_layer_num = self._current_layer_num
self._startUpdateTopLayers()
self.recalculateStartEndElements()
self.currentLayerNumChanged.emit()
@ -267,7 +264,7 @@ class SimulationView(CuraView):
self._current_layer_num = self._minimum_layer_num
self._startUpdateTopLayers()
self.recalculateStartEndElements()
self.currentLayerNumChanged.emit()
def setPath(self, value: int) -> None:
@ -281,7 +278,6 @@ class SimulationView(CuraView):
self._minimum_path_num = self._current_path_num
self._startUpdateTopLayers()
self.recalculateStartEndElements()
self.currentPathNumChanged.emit()
def setMinimumPath(self, value: int) -> None:
@ -369,24 +365,6 @@ class SimulationView(CuraView):
return 0.0 # If it's still max-float, there are no measurements. Use 0 then.
return self._min_thickness
def recalculateStartEndElements(self):
self.start_elements_index = 0
self.end_elements_index = 0
scene = self.getController().getScene()
for node in DepthFirstIterator(scene.getRoot()): # type: ignore
layer_data = node.callDecoration("getLayerData")
if not layer_data:
continue
# Found a the layer data!
element_counts = layer_data.getElementCounts()
for layer in sorted(element_counts.keys()):
if layer == self._current_layer_num:
break
if self._minimum_layer_num > layer:
self.start_elements_index += element_counts[layer]
self.end_elements_index += element_counts[layer]
def getMaxThickness(self) -> float:
return self._max_thickness
@ -608,7 +586,6 @@ class SimulationView(CuraView):
def _startUpdateTopLayers(self) -> None:
if not self._compatibility_mode:
return
self.recalculateStartEndElements()
if self._top_layers_job:
self._top_layers_job.finished.disconnect(self._updateCurrentLayerMesh)
self._top_layers_job.cancel()

View File

@ -5602,9 +5602,9 @@ msgstr "Firmware-Update-Prüfer"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "Es wurden neue Drucker gefunden, die Sie zu Ihrem Konto hinzufügen können. Sie finden diese in der Liste gefundener Drucker."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "Diese Meldung nicht mehr anzeigen"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "Diese Meldung nicht mehr anzeigen"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5603,9 +5603,9 @@ msgstr "Buscador de actualizaciones de firmware"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "Se han encontrado nuevas impresoras conectadas a tu cuenta; puedes verlas en la lista de impresoras descubiertas."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "No volver a mostrar este mensaje"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "No volver a mostrar este mensaje"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5603,9 +5603,9 @@ msgstr "Vérificateur des mises à jour du firmware"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "De nouvelles imprimantes ont été trouvées connectées à votre compte. Vous pouvez les trouver dans votre liste d'imprimantes découvertes."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "Ne plus afficher ce message"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "Ne plus afficher ce message"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5604,9 +5604,9 @@ msgstr "Controllo aggiornamento firmware"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "Sono state trovate nuove stampanti collegate al tuo account. Puoi vederle nell'elenco delle stampanti rilevate."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "Non mostrare nuovamente questo messaggio"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "Non mostrare nuovamente questo messaggio"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5597,9 +5597,9 @@ msgstr "ファームウェアアップデートチェッカー"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "アカウントに接続された新しいプリンターが見つかりました。検出されたプリンターのリストで確認できます。"
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "今後このメッセージを表示しない"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "今後このメッセージを表示しない"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5592,9 +5592,9 @@ msgstr "펌웨어 업데이트 검사기"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "새 프린터가 계정에 연결되어 있습니다. 발견한 프린터를 목록에서 찾을 수 있습니다."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "다시 메시지 표시 안 함"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "다시 메시지 표시 안 함"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5459,9 +5459,9 @@ msgstr "Firmware-updatecontrole"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "Er zijn nieuwe printers gedetecteerd die zijn verbonden met uw account. U kunt ze vinden in uw lijst met gedetecteerde printers."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "Dit bericht niet meer weergeven"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "Dit bericht niet meer weergeven"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5603,9 +5603,9 @@ msgstr "Sprawdzacz Aktualizacji Oprogramowania"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "Nowe drukarki podłączone do Twojego konta zostały znalezione, można je odszukać na liście wykrytych drukarek."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "Nie pokazuj tego komunikatu ponownie"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "Nie pokazuj tego komunikatu ponownie"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5606,9 +5606,9 @@ msgstr "Verificador de Atualizações de Firmware"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "Novas impressoras foram encontradas conectadas à sua conta; você as pode ver na sua lista de impressoras descobertas."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "Não mostrar essa mensagem novamente"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "Não mostrar essa mensagem novamente"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5660,9 +5660,9 @@ msgstr "Verificador Atualizações Firmware"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "Foram encontradas novas impressoras associadas à sua conta. Pode encontrá-las na sua lista de impressoras detetadas."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "Não mostrar esta mensagem novamente"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "Não mostrar esta mensagem novamente"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5613,9 +5613,9 @@ msgstr "Проверка обновлений"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "Обнаружены новые принтеры, подключенные к вашей учетной записи; вы можете найти их в списке обнаруженных принтеров."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "Больше не показывать это сообщение"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "Больше не показывать это сообщение"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5604,9 +5604,9 @@ msgstr "Bellenim Güncelleme Denetleyicisi"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "Hesabınıza bağlı yeni yazıcılar bulundu. Keşfedilen yazıcılar listenizde bunları görüntüleyebilirsiniz."
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "Bu mesajı bir daha gösterme"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "Bu mesajı bir daha gösterme"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5596,9 +5596,9 @@ msgstr "固件更新检查程序"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "发现有新打印机连接到您的帐户。您可以在已发现的打印机列表中查找新连接的打印机。"
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "不再显示此消息"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "不再显示此消息"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -5598,9 +5598,9 @@ msgstr "韌體更新檢查"
#~ msgid "New printers have been found connected to your account, you can find them in your list of discovered printers."
#~ msgstr "新找到的印表機已連接到你的帳戶,你可以在已發現的印表機清單中找到它們。"
#~ msgctxt "@info:option_text"
#~ msgid "Do not show this message again"
#~ msgstr "不要再顯示這個訊息"
msgctxt "@info:option_text"
msgid "Do not show this message again"
msgstr "不要再顯示這個訊息"
#~ msgctxt "@info:status"
#~ msgid "Cura does not accurately display layers when Wire Printing is enabled"

View File

@ -160,7 +160,7 @@ UM.PreferencesPage
append({ text: "日本語", code: "ja_JP" })
append({ text: "한국어", code: "ko_KR" })
append({ text: "Nederlands", code: "nl_NL" })
append({ text: "Polski", code: "pl_PL" })
//Polish is disabled for being incomplete: append({ text: "Polski", code: "pl_PL" })
append({ text: "Português do Brasil", code: "pt_BR" })
append({ text: "Português", code: "pt_PT" })
append({ text: "Русский", code: "ru_RU" })