mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-30 04:05:25 +08:00
Add a dialog that shows the engine log
This commit is contained in:
parent
52d4424635
commit
1118219f7d
@ -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:
|
||||
|
41
qml/EngineLog.qml
Normal file
41
qml/EngineLog.qml
Normal file
@ -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();
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user