diff --git a/PrinterApplication.py b/PrinterApplication.py index 0a97ace131..5ee8757eb8 100644 --- a/PrinterApplication.py +++ b/PrinterApplication.py @@ -239,6 +239,15 @@ class PrinterApplication(QtApplication): job.finished.connect(lambda j: node.setMeshData(j.getResult())) job.start() + @pyqtSlot(result=str) + def getEngineLog(self): + log = "" + + for entry in self.getBackend().getLog(): + log += entry.decode() + + return log + def _onActiveMachineChanged(self): machine = self.getActiveMachine() if machine: diff --git a/qml/EngineLog.qml b/qml/EngineLog.qml new file mode 100644 index 0000000000..5f96f3d367 --- /dev/null +++ b/qml/EngineLog.qml @@ -0,0 +1,41 @@ +import QtQuick 2.2 +import QtQuick.Dialogs 1.2 +import QtQuick.Controls 1.2 +import QtQuick.Layouts 1.1 + +Dialog { + id: dialog + + title: qsTr("Cura Engine Log"); + + standardButtons: StandardButton.Close; + modality: Qt.NonModal; + + width: 640; + + TextArea { + id: textArea + + anchors.left: parent.left; + anchors.right: parent.right; + + implicitHeight: 480; + } + + onVisibleChanged: { + if(visible) { + textArea.text = Printer.getEngineLog(); + updateTimer.start(); + } else { + updateTimer.stop(); + } + } + + Timer { + id: updateTimer; + interval: 1000; + running: false; + repeat: true; + onTriggered: textArea.text = Printer.getEngineLog(); + } +} diff --git a/qml/Printer.qml b/qml/Printer.qml index 59ac3fde10..4c63d50055 100644 --- a/qml/Printer.qml +++ b/qml/Printer.qml @@ -116,6 +116,7 @@ UM.MainWindow { //: Help menu title: qsTr("&Help"); + MenuItem { action: actions.showEngineLog; } MenuItem { action: actions.documentation; } MenuItem { action: actions.reportBug; } MenuSeparator { } @@ -300,6 +301,7 @@ UM.MainWindow { documentation.onTriggered: Qt.openUrlExternally("https://ultimaker.com/en/support"); reportBug.onTriggered: Qt.openUrlExternally("https://github.com/Ultimaker/PluggableCura/issues"); + showEngineLog.onTriggered: engineLog.open(); } Menu { @@ -372,6 +374,10 @@ UM.MainWindow { } } + EngineLog { + id: engineLog; + } + AddMachineWizard { id: addMachine; } diff --git a/qml/PrinterActions.qml b/qml/PrinterActions.qml index 4c754d856f..2bff9052f4 100644 --- a/qml/PrinterActions.qml +++ b/qml/PrinterActions.qml @@ -25,6 +25,8 @@ Item { property alias configureMachines: settingsAction; property alias preferences: preferencesAction; + + property alias showEngineLog: showEngineLogAction; property alias documentation: documentationAction; property alias reportBug: reportBugAction; property alias about: aboutAction; @@ -169,4 +171,11 @@ Item { iconName: "document-save"; shortcut: StandardKey.Save; } + + Action { + id: showEngineLogAction; + //: Show engine log action + text: qsTr("Show engine log..."); + iconName: "view-list-text"; + } }